Ronan

1396 Reputation

16 Badges

13 years, 352 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are replies submitted by Ronan

@dharr I edited the code above as you suggested. Hilighted in green. There is a print statement at the end on ModuleLoad so added some "xxx" 's to it so I would know which one is printing. THe Inforlevel seems to control the print statement not what is supposed to be displayed from infolevel. Also message is displayed for any infolevel number 0,1,2,3,4. But at least I have some control over the message now.

restart

infolevel[RationalTrigonometry]:=0
 "xxxxDefault global settings:-

     GeomClr = "Blue",

      Prntmsg = true,

       Prjpsn = 3 can be set to 1,

      Normalgpt = 1 or set to 0, 

    Metric is a 3 x3 symmetric matrix defaults to the Identity 

    matrix "


              infolevel[RationalTrigonometry] := 0

with(RationalTrigonometry)

 

@dharr   Below outlines my package structure. I just can't get the infolevel system to work. I have tried (I think) both you methods.

Any ideas of where I am going wrong?

restart:
infolevel[RationalTrigonometry]:=3;
with(RationalTrigonometry)

RationalTrigonometry:=module()
    option package;
    
    export 
        AcuteObstuseQ,
#about 20 exports

# load = `Default global settings`;
     
local ModuleLoad, ModuleUnload,Colour_Test,Remequal, Dsp, pzp, xpsn, ypsn, zpsn, prnt,
        RMatrix, GMatrix, RProjM,`Default global settings` ;   #RelDPxyz, WhichMyType,
global  Metric,normalgpt, Prntmsg, prjpsn, GeomClr ;
 

ModuleLoad:= proc()
          
     uses TT= TypeTools;
     global _T1, _T2L,  _T2VR, _T3L,  _T3VC, _T3VR, _T4L, _T4VC, _MyType;
          #_a1:=1, _a2:=1, _a3:=1, _b1:=0, _b2:=0, _b3:=0 #GCb, GCg, GCr,xpsn, ypsn, zpsn,
     userinfo(2,RationalTrigonometry, "Default global settings:-\n GeomClr = ""Blue"",\n Prntmsg = true,\n Prjpsn = 3 can be set to 1,\n Normalgpt = 1 or set to 0, \n Metric is a 3 x3 symmetric matrix defaults to the Identity matrix ");
     GeomClr:="Blue";
     Prntmsg::boolean:=true;
     prjpsn::{1,3}:=3;
     normalgpt::{0,1}:=1;
     Metric:=Matrix(3,shape=symmetric,[[1,0,0],[0,1,0],[0,0,1]]);
  
     local 
     MyTypes:= {_T1, _T2L,  _T2VR, _T3L, _T3VC, _T3VR, _T4L,_T4VC},
     AllMyTypes:= MyTypes union {_MyType};
 
     g, #iterator over module globals
     e;
      ModuleUnload:= proc()
     local T;
          for T in AllMyTypes do if TT:-Exists(T) then TT:-RemoveType(T) end if; end do;
          return
     end proc;
     alias (eparm=CircleParmUHG,LinePts=Lines);   
    
     TT:-AddType(_T1, {algebraic,symbol});
     TT:-AddType(_T2VC, 'Vector[column](2, algebraic)');
     TT:-AddType(_T2VR, 'Vector[row](2, algebraic)');
     TT:-AddType(_T2L, [algebraic $ 2]);
     TT:-AddType(_T3VC, 'Vector[column](3, algebraic)');
     TT:-AddType(_T3VR, 'Vector[row](3, algebraic)');
     TT:-AddType(_T3L, [algebraic $ 3]);
     TT:-AddType(_T4L, [algebraic $ 4]);
     TT:-AddType(_T4VC, 'Vector[column](4, algebraic)');
     TT:-AddType(_MyType, MyTypes);

     :-print("xxxxDefault global settings:-\n  GeomClr = ""Blue"",\n   Prntmsg = true,\n    Prjpsn = 3 can be set to 1,\n   Normalgpt = 1 or set to 0, \n Metric is a 3 x3 symmetric matrix defaults to the Identity matrix ");
     return
end proc;


$include "Rational_Trigonometry\Acute Obtuse Quadrances.mpl"

#about 20  $include....

end module:

 

@dharr   I have made some progress. I would like to structure the TOC so that the main package commands are directly under the Rational Trigonometry heading i.e. TOCtop. Then I have two sub packages UHG and RT Projective. I would like these to be under TOCsub1 and TOCsub2 rsspectivels.  Have tried several modifications to do with std2 & children () but no luck yet.

What would you suggest?

Edit:- I have being wondering about structuring the help files for the sub packages is sub folders and doing a seperate database document for each.

NULL

with(HelpTools)

[Database, TableOfContents, Worksheet]

(1)

currentdir()

"D:\User Account Ronan\Documents\MAPLE\Rational Trigonometry"

(2)

 

NULL

NULL

HelpTools[Database][Create]("C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help")

"C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help"

(3)

HelpTools[Database][Add]("C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help")

["C:\Program Files\Maple 2024\lib\maple.help", "C:\Program Files\Maple 2024\lib\maple_ja.help", "C:\Users\Ronan\maple\toolbox\CodeBuilder\lib\CodeBuilder.help", "C:\Users\Ronan\maple\toolbox\DirectSearch\lib\DirectSearch.help", "C:\Users\Ronan\maple\toolbox\OEIS\lib\OEIS.help", "C:\Users\Ronan\maple\toolbox\UTF8\lib\UTF8.help"]

(4)

HelpTools[Database][GetActive]()

["C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", "C:\Program Files\Maple 2024\lib\maple.help", "C:\Program Files\Maple 2024\lib\maple_ja.help", "C:\Users\Ronan\maple\toolbox\CodeBuilder\lib\CodeBuilder.help", "C:\Users\Ronan\maple\toolbox\DirectSearch\lib\DirectSearch.help", "C:\Users\Ronan\maple\toolbox\OEIS\lib\OEIS.help", "C:\Users\Ronan\maple\toolbox\UTF8\lib\UTF8.help", "C:\Users\Ronan\maple\toolbox\personal\lib\RationalTrigonometry.help"]

(5)

NULL

makehelp("RationalTrigonometry", "Rational Trigonometry Overiew Help.mw", "C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", aliases = ["RatTrig", "Rat Trig", "RT", "R T"], browser = ["Rational Trigonometry", " Overview"])

["C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", "C:\Program Files\Maple 2024\lib\maple.help", "C:\Program Files\Maple 2024\lib\maple_ja.help", "C:\Users\Ronan\maple\toolbox\CodeBuilder\lib\CodeBuilder.help", "C:\Users\Ronan\maple\toolbox\DirectSearch\lib\DirectSearch.help", "C:\Users\Ronan\maple\toolbox\OEIS\lib\OEIS.help", "C:\Users\Ronan\maple\toolbox\UTF8\lib\UTF8.help", "C:\Users\Ronan\maple\toolbox\personal\lib\RationalTrigonometry.help"]

(6)

makehelp("RationalTrigonometry,Quadrance", "Help Quadrance.mw", "C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", browser = ["Rational Trigonometry", "Quadrance"])

makehelp("RationalTrigonometry,Cross Law", "Help Cross Law.mw", "C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", browser = ["Rational Trigonometry", "CrossLaw"])

makehelp("RationalTrigonometry,Spread", "Help Spread.mw", "C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", aliases = ["RT Spread", "R T Spread"], browser = ["Rational Trigonometry", "Spread"])

makehelp("RationalTrigonometry,Spread Law", "Help Spread Law.mw", "C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", aliases = ["RT Spread Law", "Spread Law Quadrea"], browser = ["Rational Trigonometry", "Spread Law"])

makehelp("RationalTrigonometry,TQF", "Help Triple Quad Formula.mw", "C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", aliases = ["Triple Quad Formula", "TQF"], browser = ["Rational Trigonometry", "Triple Quad Formula"])

makehelp("RationalTrigonometry,TSF", "Help Triple Spread Formula.mw", "C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", aliases = ["Triple Spread Formula", "TSF"], browser = ["Rational Trigonometry", "Triple Spread Formula"])

makehelp("RationalTrigonometry,QQF", "Help Quadruple Quad Formula.mw", "C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", aliases = ["Quadruple Quad Formula", "QQF"], browser = ["Rational Trigonometry", "Quadruple Quad Formula"])

makehelp("RationalTrigonometry,QSF", "Help Quadruple Spread Formula.mw", "C:/Users/Ronan/Maple/toolbox/personal/lib/RationalTrigonometry.help", aliases = ["Quadruple Spread Formula", "QSF"], browser = ["Rational Trigonometry", "Quadruple Spread Formula"])

NULL

Download Help_Edit_to_Database_2023.mw

@C_R I removed Java because I don't really need it. That has definately made Explorer a lot snappier. Don't get the white page for 5-10 secs.

Double clicking on a Maple file to open is better, but some do just hang Maple with the white window. I left it for 10 mins to see.

@C_R Explorer has also strated handing for 10 seecs or so. Java is a good clue here. It installed a Jave viewer (I think) less than a month ago when I was looking ast how to export 3D plots for 3D pdfs. Shall remove that tonight when I get home and let you know.

 

Edit:- Maple always starts from the task bar. Rarely use the start menu for it

@acer Oh good. Nothing complex then. I had tried {colour,color}. Didn't work. 

@acer  "...a double printing of qqf,q13,q24".  I meant that it would tabulate the values and then also return them seperately onto the screen,

@acer  I am most supprised that 

DocumentTools:-Tabulate([columns,[qqf,q13,q24]],'width'=55);
  return qqf,q13,q24

don't produce a double printing of qqf,q13,q24.  Because that is exactly what I didn't try.

I have altered the proc so Tabulate is inside the if statement.

QQFProj := proc(q12::algebraic, q23::algebraic,
                q34::algebraic, q14::algebraic,
                {columns:=[QQFproj,Q13proj,Q24proj]},  prnt::boolean:=true) 
  description "Projective quadruple quad formula and intermediate 13 and 24 quads. Useful for cyclic quadrilaterals";
  local qqf,q13,q24, sub1,sub2,sub3, R;
  uses  DT = DocumentTools;
  sub1:= (q12 + q23 + q34 + q14)^2 - 2*(q12^2 + q23^2 + q34^2 + q14^2) ;
  sub2:=-4*(q12*q23*q34+q12*q23*q14+q12*q34*q14+q23*q34*q14)+8*q12*q23*q34*q14;
  sub3:=64*q12*q23*q34*q14*(1-q12)*(1-q23)*(1-q34)*(1-q14);
  qqf:=(sub1+sub2)^2=sub3;
  q13:=((q12-q23)^2-(q34-q14)^2)/(2*(q12+q23-q34-q14-2*q12*q23+2*q34*q14));#check this
  q24:=((q23-q34)^2-(q12-q14)^2)/(2*(q23+q34-q12-q14-2*q23*q34+2*q12*q14));#check this
  if prnt then
  DT:-Tabulate([columns,[qqf,q13,q24]],'width'=55);
  return qqf,q13,q24
  end if;
  return qqf,q13,q24
end proc:

 

@dharr I have just returned to this. Thank you for the work you put into finding out what can be done. I too found that Maple would only export 3D objects not lines points or text. I don't know whether this is a file type restriction or a Maple export limitation. Maybe an enhancment request should be submitted for this type of functionality.
 

@dharr Thank you. I will spend the next night or so studying that.

@WD0HHU 

simplify(res) assuming `real`

 

@acer The timing differences are striking. I need to do more of the tests on my own code.

@acer That is a great answer. I tested it and it so far is working in the package. 

In the code below why does :-align not have the unevaluation quotes,

                                             symbol has nothing

                                            'color'  doesn't have  :-  

Qdim := proc(P1, P2, {Q:=[ NULL,:-align={':-left'}]},
                     {vec1::list:=[NULL,:-align={':-below',':-right'}]},
                     {scale::{list,numeric}:=1},
                     {leader::{-1,0,1}:= 1},
                     {dimoffset::{1,2,3,4,5,6}:=1},
                     {point::list:=['color' = ':-blue', symbol = ':-solidcircle', 'symbolsize' = 8]},
                     {line::list:=['thickness'=3]},
                     {plopts::list:=[]})

While I am asking al lot of keywords in 1d input are enclosed in the single back quotes ` ` but what do they actually do? Sometimes it seems to make no differance whether they are used or not. I know the are also used in prefix notation too.  

@acer Ok so what I have here with the procedure is outside of the package. So that may be affecting things.

I have altered the parameter names annotated in in the worksheet. Now `clr` is changed to `colour` that causes a clash. `Colour` works. `points` changed to `Point` not working. I can solve the problem. I was just trying to come up with sensible names. I was concerned about my capatilised names conflicting with other packages also I wasnted to keep them lower case if possible. @Carl Love indicated that this would not be a problem inside a package.

I will probably settle on names such as pointdata, linedata, message::boolean =true instead of prnt="y" 

2024-03-09_Example_parm_names_changed.mw

@acer Basically I don't know using nicer, parameter names suck as line, point, and colour, and print (I am sure print clashes)will clash.  Hopefully this will demonstrate sufficiently.  


 

restart

 

Prntmsg:="y"; Geomclr:="Blue";

"y"

 

"Blue"

(1)

Qdim := proc(P1, P2, {Q:=[ NULL,align={left}]},
                     {vec1::list:=[NULL,align={below,right}]},
                     {scl::{list,numeric}:=1},
                     {leader::{-1,0,1}:= 1},
                     {dimofset::{1,2,3,4,5,6}:=1},
                     {points::list:=[color = blue, symbol = solidcircle, symbolsize = 8]},
                     {linetype::list:=[thickness=3]},
                     {clr::`string`:=Geomclr},
                     {prnt:=Prntmsg})
description " plots Quadrance symbol and value (Q)";
uses plottools; # RationalTrigonometry;
local a,  f,g,h,v1,delta,mp, BoxQ,Qsymbol,pt1,pt2,pt3,pt4,Scl,ptxtp1,ptxtp2,txtplt1,txtplt2,plttyp,thk,l12,pts12;

if P1[1]::{list, Vector[row]} then
   pt1:=`if`(P1[1]::Vector[row],convert(P1[1],list),P1[1]);
   plttyp:=`if`(nops(pt1)=3,3,2); # print(pt1,plttyp);
   ptxtp1:=[op(pt1),op(P1[2..-1])];
   txtplt1:=true;  
 else
   pt1:=`if`(P1::Vector[row],convert(P1,list),P1);#print(pt1);
   plttyp:=nops(pt1);
   txtplt1:=false;
end if;    

if P2[1]::{list, Vector[row]} then
   pt2:=`if`(P2[1]::Vector[row],convert(P2[1],list),P2[1]);#print(pt2);
   if plttyp<>nops(pt2) then error `different dimension in inputs`end if;
   ptxtp2:=[op(pt2),op(P2[2..-1])];
   txtplt2:=true;
 else
   pt2:=`if`(P2::Vector[row],convert(P2,list),P2);#print(pt2);
   if plttyp<>nops(pt2) then error `different dimension in inputs`end if;
   txtplt2:=false;
end if;

#if scl::numeric then
    Scl:=scl;
 #else
  # pt3:=`if`(scl[1]::Vector[row],convert(scl[1],list),scl[1]);
   #pt4:=`if`(scl[2]::Vector[row],convert(scl[2],list),scl[2]);
    #if plttyp = 2 then
     #  Scl:=evalf(sqrt(Quadrance(pt3,pt4,"b","n")/Quadrance(pt1,pt2,"b","n")));
     #else
      # Scl:=evalf(sqrt(Quadrance(pt3,pt4,"n")/Quadrance(pt1,pt2,"n")));
   # end if;
#end if;
if plttyp =2 then
     a :=Scl* dimofset*0.1*leader*[-pt2[2]+pt1[2], pt2[1]-pt1[1]]; #dimension leader lines
  else
     a :=Scl* dimofset*0.1*leader*[-pt2[2]+pt1[2], pt2[1]-pt1[1],pt2[3]-pt1[3]]; #dimension leader lines
end if;
delta:=Scl*(pt2-pt1);
mp:=(1-1/2)*pt1+1/2*pt2;  #midpoint of line
#print(Scl,a,delta,mp);
if plttyp = 2 then
    BoxQ:=[[a[1]+mp[1]+.05*delta[1]-.01*delta[2],a[2]+mp[2]+.05*delta[2]+.01*delta[1]],
           [a[1]+mp[1]-.05*delta[1]-.01*delta[2],a[2]+mp[2]-.05*delta[2]+.01*delta[1]],
           [a[1]+mp[1]-.05*delta[1]+.01*delta[2],a[2]+mp[2]-.05*delta[2]-.01*delta[1]],
           [a[1]+mp[1]+.05*delta[1]+.01*delta[2],a[2]+mp[2]+.05*delta[2]-.01*delta[1]]];
 else
    BoxQ:=[[a[1]+mp[1]+.05*delta[1]-.01*delta[2],a[2]+mp[2]+.05*delta[2]+.01*delta[1],a[3]+mp[3]+.05*delta[3]],
           [a[1]+mp[1]-.05*delta[1]-.01*delta[2],a[2]+mp[2]-.05*delta[2]+.01*delta[1],a[3]+mp[3]-.05*delta[3]],
           [a[1]+mp[1]-.05*delta[1]+.01*delta[2],a[2]+mp[2]-.05*delta[2]-.01*delta[1],a[3]+mp[3]-.05*delta[3]],
           [a[1]+mp[1]+.05*delta[1]+.01*delta[2],a[2]+mp[2]+.05*delta[2]-.01*delta[1],a[3]+mp[3]+.05*delta[3]]];
end if;

if leader<>0  then
   thk:=thickness=0
 elif linetype<>[] then
   thk:=linetype[op(ListTools:-Search(op(select(has,linetype,thickness)),linetype))];
 else
   thk:=thickness=0;
end if;

Qsymbol:= [line(pt1,pt1+a,thickness=0,_rest),
           line(pt1+a,mp-.05*delta+a,thk,_rest),
           line(op([BoxQ[1],BoxQ[2]]),thickness=0,_rest),
           line(op([BoxQ[2],BoxQ[3]]),thickness=0,_rest),
           line(op([BoxQ[3],BoxQ[4]]),thickness=0,_rest),
           line(op([BoxQ[4],BoxQ[1]]),thickness=0,_rest),
           line(pt2+a,mp+.05*delta+a,thk,_rest),
           line(pt2,pt2+a,thickness=0,_rest)];
    
if points<>[]then           
pts12:=point([pt1,pt2],op(points));  #end points
else
pts12:=NULL;
end if;
if linetype<>[] then
l12:=line(pt1,pt2,op(linetype));
  else
  l12:=NULL;
  end if;
if plttyp = 2 then
    f := plots:-textplot([op((pt1+pt2)/2+1*(a)),op(Q)]);  #Quadrance text
   if txtplt1 then
      g := plots:-textplot( ptxtp1);
    else
      g:=NULL;
   end if;
   if txtplt2 then
      h := plots:-textplot( ptxtp2);
    else
     h:= NULL;
   end if;
    v1:=plots:-textplot([op((pt1+pt2)/2), op(vec1)]);#`#mover(mi("v"),mo("&rharu;"))`[1,2]   {below,right}
 else

   f := plots:-textplot3d([op((pt1+pt2)/2+1*(a)),op(Q)]);
   if txtplt1 then
         g := plots:-textplot3d( ptxtp1);
      else
         g:=NULL;
   end if;
   if txtplt2 then
         h := plots:-textplot3d( ptxtp2);
      else
         h:=NULL;
   end if;
    v1:=plots:-textplot3d([op(pt1+pt2)/2,op(vec1)]);#`#mover(mi("v"),mo("&rharu;"))`[1,2]   {below,right}
end if;
#print("pltyp" , plttyp)  ;
if prnt="y" then print(cat("Quadrance symbols  ",clr,"  geometry")); end if;
if leader = 0 then    
    plots:-display(pts12,f,g,h,Qsymbol,axes=none,scaling=constrained);
 else       
         plots:-display(pts12,l12,f,g,h,Qsymbol,axes=none,scaling=constrained);     
end if;
end proc:

 

 

P1:=[2,3,6]:
P2:=[1,5,7]:
P3:=P1+1/3*(P2-P1)

[5/3, 11/3, 19/3]

(2)

plt1:=Qdim([P1,typeset("P1=",P1),align=below],[P2,P2,align=right ],dimofset=2,Q=["Q12\n",align =above],colour=black); use of _rest, colour=black

 

"Quadrance symbols  Blue  geometry"

 

 

Error, missing operator or `;`

 

plt2:=Qdim([P1,typeset("P1=",P1),align=below],[P3,P3,align=right ],scl=2,Q=["Q13\n",align =above],prnt="n") ; #scl affects the linine up of dimesion lines prnt="n" no message displayed

 

plt3:=Qdim(P3,P2,scl=1,Q=["Q23\n",align =above],points=[],linetype=[],clr="RED"); #doesn't plot points and line. shows use of `clr`

 

 

"Quadrance symbols  RED  geometry"

 

 

plots:-display(plt1,plt2,plt3)

 

P5:=[1,2]:P6:=[-1,4]:

Qdim([P5,"P5   ",align={below,left}],[P6,"   P6",align={right}], Q=[typeset("\nQ[5,6]"),align={below,left}],points=[symbolsize=18])

"Quadrance symbols  Blue  geometry"

 

 

Qdim([P5,"P5   ",align={below,left}],[P6,"   P6",align={right}], leader=0,Q=[typeset("\nQ[5,6]"),align={below,left}],points=[symbolsize=18])

"Quadrance symbols  Blue  geometry"

 

 

 


 

Download 2024-03-09_Example_parm_names.mw

First 8 9 10 11 12 13 14 Last Page 10 of 33