## 1072 Reputation

12 years, 70 days

## DataFrame limit equation length displaye...

Maple

This is a follow on from and earlier question on tabulation. Some procdures returs up tp eight values. So using a Table make it easier to see what is what. Sometimes the equations returned are very long. Is there a way to truncate what is display in the table using something along the lines of term elision? Say the 1st 300 chatacters for example?

Edit: Corrected an error in the worksheet.

 > restart
 > QQFProj := proc(q12::algebraic, q23::algebraic,                 q34::algebraic, q14::algebraic,                   prnt::boolean:=true) #{columns:=[QQFproj,Q13proj,Q24proj]}   description "Projective quadruple quad formula and intermediate 13 and 24 quads. Useful for cyclic quadrilaterals";   local qqf,q13,q24, sub1,sub2,sub3, R,values,DF,lens;   uses   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       values:=;    DF:=DataFrame(, columns=[`"Values Equations"`],rows=[`#1  QQF`,`#2  Q13`,`#3  Q24`]);    lens := [4 +8* max(op(length~(RowLabels(DF)))),4+ min(max( 10*(length~(values))),1000)];#op(length~(ColumnLabels(DF)0)    Tabulate(DF,width=add(lens),widthmode = pixels,weights = lens);   return qqf,q13,q24   end if;   return qqf,q13,q24 end proc:
 > Q:=QQFProj(q12,q23,q34,q41,true):
 > #Q[1]
 > #(Q[2])
 > #Q[3]
 > length(Q[1])
 (1)
 > length(Q[2])
 (2)
 > length(Q[3])
 (3)

## ReScaliing a projective vector...

Maple 2024

I want to rescale a projective vector. Have been using gcd on the numerators and denominators. This works in simple situations. It doesn;t work well here, admitadely the points have been just made up for the question.  Square roots seem to make it mal-preform. I run into a lot of squate roots in symbolic situations. What would be a better way? I have been wondering if frontend would help?

 > restart
 > Prntmsg::boolean:=true; Normalise_Projective_Point:=1; ReScl::boolean:=true;
 (1)
 >
 > ProjLP:=overload([       proc(A::Vector[row],B::Vector[row],prnt::boolean:=Prntmsg)       description "2 projective points to create a projective line vector";       option overload;       local Vp ,gcdn,gcdd,vp ;       uses LinearAlgebra;               Vp:=CrossProduct(A,B)^%T;#print("2nd ",Vp);       if ReScl then          gcdn := gcd(gcd(numer(Vp[1]),numer(Vp[2])), numer(Vp[3]));          gcdd := gcd(gcd(denom(Vp[1]),denom(Vp[2])), denom(Vp[3]));          Vp:=simplify(Vp*gcdd/gcdn);       end if;       if Prntmsg then          print("Line vector from two projective points. " );       end if;       return Vp       end proc,       proc(A::Vector[column],B::Vector[column],prnt::boolean:=Prntmsg)       description "2 lines to get intersection projective point";       option overload;       uses LinearAlgebra;       local  Vp;            Vp:=CrossProduct(A,B)^%T;                   if Vp[3]<>0 and Normalise_Projective_Point<>0 then            Vp:=Vp/Vp[3];       end if;       if Prntmsg then            print("Meet of two Lines ");       end if;       return Vp    end proc       ]);
 >
 (2)
 > #maplemint(ProjLP)
 > pt1:=: pt2:=: pt3:=: pt4:=:
 >
 > l1:=ProjLP(pt1,pt2)
 (3)
 > l2:=ProjLP(pt3,pt4)
 (4)
 > l3:=ProjLP(pt1,pt4)
 (5)
 > l4:=ProjLP(pt2,pt4)
 (6)
 > pl1l2:=simplify(ProjLP(l1,l2))
 (7)
 > pl2l3:=simplify(ProjLP(l2,l3))
 (8)
 > (ProjLP(pl1l2,pl2l3)); length(%)
 (9)
 > ReScl:=false
 (10)
 > # doing nothing seems to work better here than rescaling
 > (ProjLP(pl1l2,pl2l3)); length(%)
 (11)
 >

## Can .mpl type files be combined?...

Maple 2024

I have  4 worksheets with derived equations. So I export the equations and  possibly some procedures (but they can be handled seperately if needed)  from each worksheet as a .mpl file.

I want to combine the .mpl files  together without using copy/paste. Then I can open that single file in the VS code editor.
There may be other ways to achieve this so I am open to suggestions.

## How do I get this to factor?...

Maple 2024

I chased down a problem to factoring a square that has sqrt in the coefficients. All numbers are real,
The code is inside a procedure in a package. Iso I could do with something robust.

```expand((sqrt(A+B)*x+sqrt(7-K)*y)^2)
2      2            (1/2)          (1/2)        2      2
A x  + B x  + 2 (A + B)      x (7 - K)      y - K y  + 7 y

factor(%)
```

## Seperate Real and Imaginary...

Maple 2024

I any trying to seperate the real and imaginary components but they are mixed up inside and outside a square root.

Their seems to be a problem displaying the worksheet.

```restart

expand((a+I*b)*(a-I*b))
(a+I*b)+(a-I*b)
# z = x *Iy    I need to seperate out solution to [x,y] & [x,-y]
#https://math.stackexchange.com/questions/44391/foci-of-a-general-conic-equation
eq := T*z^2 - (R + S*I)*z +G-K + H*I
sol:=solve(eq,z)
expand(sol[1]*sol[2])=a^2+b^2
simplify(sol[1]+sol[2]=2*a)
simplify(sol[1]-sol[2]=2*b)
```

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/2024-04-20_Q_Seperate_Real_&_Imaginary.mw .