Ronan

1267 Reputation

14 Badges

12 years, 279 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are replies submitted by Ronan

Does it happen with rational numbers aswell

(123/100)/(n^(165/100)). 

I am not at my home pc to try.

@Kitonum Thank you. So it is sort of a little bug. I think I will keep the Tabulate and live with it.

@Kitonum Ok. But what I am looking for is needed in terms of varp. I can't get it to work.

varp:=alpha     but could be beta, lambda,  t etc.

`#3  Q24` (`&varp;`);  # not working

to give 

@acer Oh that is not a problem. You a busier than I and you find time to help a lot.

@acer That works perfectly. I would not have worked out the AddType for a long time. I did however manage to figure out the spellchecking by looking inside the Maple routine for Vector. But not as efficient as yours.
 

ProjVector := proc(a, b, c) 
      local cfs, vectr; 
      description " A Projective Line or Row Vector in Reduced format";
      if type(procname, 'indexed') then
         if procname::anyindex(identical(':-row')) then
            cfs := sign(c)*FactReduce([a, b, c]); 
            vectr := <[<cfs>^%T]>^%T;
            return vectr,type(vectr,ProjVR);
          elif procname::anyindex(identical(':-column')) then
            cfs := FactReduce([a, b, c]); 
            vectr := <[<cfs>]>;
            return vectr,type(vectr,ProjVC);
          else 
            error "either row or column is spelt incorrectly"; 
         end if;
       else
         cfs := FactReduce([a, b, c]); 
         vectr := <[<cfs>]>;
         return vectr,type(vectr,ProjVC);
      end if;
      end proc:

 

@acer I have just edited the question and put a link in.

@acer Thank you and the NSHO shall be heeded. I tried altering the procedure so it would catch typos for "row" and not default to the column option. Can't get it working properly. 

Secondly using the module from my prior question How to setup special type check in a procedure? - MaplePrimes I was trying to AddType for the vector construction of <[<a,b,c>]>  but can't get that to work either. 
Just to explain. I have to have a way of differentiating between standard vectors and projective vectors in the package. Using matrices were causing other problems. This is why I am trying this vector stucture. I doubt it is commonly used.

restart;

FactReduce:=overload([
     proc(v::{list,Vector})
          option overload;
          description " removes linear factor from",
                      " a list, vector, matrix or expression";
          uses LinearAlgebra;
          local i, num,tgdc,dnm, V1;
          num:=`ifelse`(type(v,Vector),numelems(v),nops(v));
          dnm:=frontend(lcm, [seq(denom(v[i]),i=1..num)]);
          V1:=radnormal(v*~dnm);
          tgdc:=V1[1];

          for i from 2 to num do
               tgdc:=frontend(gcd, [tgdc, V1[i]]);
          end do;

          return  simplify(V1/~tgdc);
     end proc,

     proc(M::{Matrix})
          option overload;
          uses LinearAlgebra;
          local i, num,r,c, tgdc,dnm, V1, Ml;
          r,c:=Dimension(M);
          num:=r*c;
          V1:=convert(M,list);
          dnm:=frontend(lcm, [seq(denom(V1[i]),i=1..num)]);
          Ml:=radnormal(dnm*~M);
          V1:=convert(Ml,list);#print((dnm,V1));
          tgdc:=V1[1];#print("xx")

          for i from 2 to num do
               tgdc:=frontend(gcd, [tgdc, V1[i]])
          end do;

          return  simplify(Ml/~tgdc);   
     end proc,

     proc(l::{`+`,`*`,`=`, `symbol`,procedure},  {vars::list:=[:-x,:-y]})
          option overload;
          uses LinearAlgebra;
          local i, num,f1,f1a,lv,lr, tgdc,dnm, V1,Vs;
          f1 := `if`(l::procedure, l(vars[]), l);
               f1a:=`if`(f1::`=`,lhs(f1)-rhs(f1),f1)  ; # Remequal(f1);
          lr:=primpart(f1a,vars);
          return lr
end proc

]):

 

#ProjVector := proc(a, b, c)
#local cfs, vectr;
#description " A Projective (Line) Vector in Reduced format";
#if procname::anyindex(identical(':-row')) then
#  cfs := sign(c)*FactReduce([a, b, c]);
#  vectr := <[<cfs>^%T]>^%T;
#else
 # cfs := FactReduce([a, b, c]);
 # vectr := <[<cfs>]>;
#end if;
#vectr;
#end proc:

 

NULL

M:= module()
local
    AddType:= proc(T::name, H::{type, procedure})
    uses TT= TypeTools;
        if TT:-Exists(T) then TT:-RemoveType(T) fi;
        TT:-AddType(T,H)
    end proc,

    ModuleLoad:= proc()
        AddType(Point, (e, n::{2,3})-> type(e, [algebraic$n]));
        AddType(Line, (e, n::{2,3})-> type(e, [Point(n)$2]));
        AddType(ProjVC,'Vector(1,'[Vector(3)]')');
        AddType(ProjVR,'Vector[':-row'](1,'[Vector[':-row'](3)]')');
    end proc
;
export
    CreateLine:= overload([
        proc(Pts::Line(2), $) option overload; "2D line" end proc,
        proc(Pts::Line(3), $) option overload; "3D line" end proc,
        ()-> "Unrecognized input format"
    ])
;
export
     ProjVector := proc(a, b, c)
      local cfs, vectr;
      description " A Projective Line or Row Vector in Reduced format";
      if procname::anyindex(identical(':-row')) then
         cfs := sign(c)*FactReduce([a, b, c]);
         vectr := <[<cfs>^%T]>^%T;
         return vectr,type(vectr,ProjVR);
       elif procname::anyindex(identical(':-column'))or procname::name then
         cfs := FactReduce([a, b, c]);
         vectr := <[<cfs>]>;
         return vectr,type(vectr,ProjVC);
       else Error;
      end if;
      vectr;
      end proc:

    ModuleLoad()
end module
:
M:-CreateLine([[1,2,3],[4,5,6]]);
                          

M:-CreateLine([[1,2],[4,5]]);

"3D line"

 

"2D line"

(1)

M:-ProjVector(a,b,c);

 

Vector[column](%id = 36893489844854842300), false

(2)

M:-ProjVector[':-row'](a,b,c)

Vector[row](%id = 36893489844854845180), false

(3)

M:-ProjVector[':-column'](a,b,c)

Vector[column](%id = 36893489844854839524), false

(4)

M:-ProjVector[':-raw'](a,b,c); #need to catch typos

 

Vector[column](%id = 36893489844854830012), false

(5)
 

 

Download 2024-11-22_Q_Projective_Vector_Format_ac_Rc.mw

Try changing the hours "Night Light" come on in windows.  I know it's not a very good solution.

@Carl Love Thank you. Is it possible to have a variants in the AddType? In this case  two points or a point and a vector.

I tried this but it didnt work. It still recognises two points though.  I also tried  adding another type  LineLV but haven't made that work either.

AddType(Line, (e, n::{2,3})-> type(e, {[Point(n)$2], [Point(n)$1,Vector(n)$1] }));
M:= module()
local
    AddType:= proc(T::name, H::{type, procedure})
    uses TT= TypeTools;
        if TT:-Exists(T) then TT:-RemoveType(T) fi;
        TT:-AddType(T,H)
    end proc,

    ModuleLoad:= proc()
        AddType(Point, (e, n::{2,3})-> type(e, [algebraic$n]));
        AddType(Line, (e, n::{2,3})-> type(e, [Point(n)$2]));
        AddType(LineLV, (e, n::{2,3})-> type(e, [Point(n)$1,Vector(n)$1]));
    end proc
;
export
    CreateLine:= overload([
        proc(Pts::Line(2), $) option overload; "2D line" end proc,
        proc(Pts::Line(3), $) option overload; "3D line" end proc,
         proc(Pts::LineLV(2), $) option overload; "2D line point and vector" end proc,
         proc(Pts::LineLV(3), $) option overload; "3D line point and vector" end proc,
        ()-> "Unrecognized input format"
    ])
;
    ModuleLoad()
end module
:
M:-CreateLine([[1,2,3],[4,5,6]]);
                           

M:-CreateLine([[1,2],[4,5]]);

M:-CreateLine([[1,2,3],<4,5,6>]);

M:-CreateLine([[1,2],<4,5>]);              
                           "3D line"

                           "2D line"

                  "Unrecognized input format"

                  "Unrecognized input format"

What is the Maple Beta Forum?

 Yes this whole Deleted thing has become a pain. As said by someone else it clutters valid threads. So is it a site bug or somebodies intention?

Basically my feeling is the site needs a good overhaul. I see the Art gallery has been added. That is a nice touch. But that does not fix the long standing issues that have been complained about. 
Who is actually responsible for the maintenance and development of this site? 
@janhardo  No. I don't think it is wrong if you decide to delete your own answer.

Edit: On deleted questions with answers. If such are deleted, which really irritates the responders, does that stick around as deleted?

@acer  I dedided to have a manually adjustable scale factor in the arctan of the angle. This is a a bit fiddly to use but it does work quite well. The procedure also prevents the text from turning upsidedown. It needs more work but it proves out the concept. 

Basically in the package  I have 5 plotting procedures that can all use the same global variables so they work together. I have just inckuded part of the text plotting one here, Some function in it might not work here.

Really what I am using it for it making technical diagrams for the help pages.

Download 2024-10-21_A_Mnaual_scale_adjustment.mw

@acer @nm Thank you for the information.

Acer, I will come back to you on the rotated text question. It might take a few nights. Am stretched a bit thin at the moment. 

@mmcdara Thank you for your good examples. I have to study to Image Tools commands to understand what you have done properly. I think saving  text to an image is probably is to difficult to use in my application. But I will keep the concept in mind. 

@mmcdara Ah.. that question. That was to to do with aligning/rotating text in 3D which currently can't be done.

Really what I trying to find out. Is there a way to access what Maple calculates as a scaling ratio when plots:-display(.....) is unconstrained.

1 2 3 4 5 6 7 Last Page 1 of 30