# [Maxima] Maxima: compiling with cmucl, sbcl and gcl.

C. Frangos cfrangos at telkomsa.net
Tue Jul 17 07:04:40 CDT 2007

```Hi Robert,

Regarding the testing results, I have created a short test program testms.mac
below with the relevant lines from my original program.

Any assistance with the following would be appreciated:

(1) I ran the test program with Maxima 5.10 and 5.12. From the results below
it appears that 5.10 simplifies somewhat the matrix Aconz, while 5.12 does
not. This difference propagates up to the end of the original program
producing different results, and different running times.

(2) An element of the matrix Aconz has a term of the form:
expr1*sqrt(expr2^2)/expr2

where expr2 = 2*sin(delta3)*Lo1+cos(delta3)*Lc.

It seems that 5.10 assumes that expr2  > 0, and performs the cancellation,
while 5.12 does not perform the cancellation.

(3) In this case the assumption expr2 > 0 is physically correct. What is the
Maxima command to implement this ?

Thanks very much.

Regards,

C. Frangos.

testms() := block(

[Aconz,phi,delta3,t,t0,t1],

display2d : false,

depends([phi,delta3],t),

Aconz : matrix([1,0,Lo1*sin(phi),-a*sin(phi),0,0,0,0,0],
[0,1,-Lo1*cos(phi),a*cos(phi),0,0,0,0,0],
[1,0,-Lo1*sin(phi),0,-a*sin(phi),0,0,0,0],
[0,1,Lo1*cos(phi),0,a*cos(phi),0,0,0,0],
[1,0,Lo1*sin(phi)-Lc*cos(phi),0,0,0,
-a*(cos(delta3)*sin(phi)+sin(delta3)*cos(phi)),0,0],
[0,1,-(Lc*sin(phi)+Lo1*cos(phi)),0,0,0,
a*(cos(delta3)*cos(phi)-sin(delta3)*sin(phi)),0,0],
[1,0,-(Lo1*sin(phi)+Lc*cos(phi)),0,0,
-a*(sin(phi)/sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1)
+sin(delta3)*Lc*cos(phi)
/((2*sin(delta3)*Lo1+cos(delta3)*Lc)
*sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1))),0,0,0],
[0,1,-(Lc*sin(phi)-Lo1*cos(phi)),0,0,
a*(cos(phi)/sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1)
-sin(delta3)*Lc*sin(phi)
/((2*sin(delta3)*Lo1+cos(delta3)*Lc)
*sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1))),0,0,0],[0,0,0,1,1,0,0,0,-kon]),

display(Aconz),

t0 : elapsed_run_time(),
Aconz : mysimprec(Aconz),
t1 : elapsed_run_time(),
print("Time for mysimprec() = ",t1-t0),

display(Aconz),

return([])

);

/*Maxima 5.10 results*/
Maxima 5.10.0 http://maxima.sourceforge.net
Using Lisp CMU Common Lisp 19d (19D)
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function bug_report()
provides bug reporting information.
(%i1)
(%o1) 		       /home/cfrangos/axiom/myutils.mac
(%i2)
batching /home/cfrangos/axiom/displayr.mac
(%i3) 	    displayr_do_it(L) := map(lambda([a%], a% = ev(a%)), L)
(%o3) 	    displayr_do_it(L) := map(lambda([a%], a% = ev(a%)), L)
#<Interpreted Function (LAMBDA (L) (MFUNCALL '|\$displayr_do_it| `#))
{586720F1}>
(%o4) 		      /home/cfrangos/axiom/myjacobian.mac
(%i5)
(%o5) 			     elapsed_run_time.lisp
(%i6)
(%o6) 		        /home/cfrangos/axiom/testms.mac
(%i7)
Aconz = matrix([1,0,Lo1*sin(phi),-a*sin(phi),0,0,0,0,0],
[0,1,-Lo1*cos(phi),a*cos(phi),0,0,0,0,0],
[1,0,-Lo1*sin(phi),0,-a*sin(phi),0,0,0,0],
[0,1,Lo1*cos(phi),0,a*cos(phi),0,0,0,0],
[1,0,Lo1*sin(phi)-Lc*cos(phi),0,0,0,
-a*(cos(delta3)*sin(phi)+sin(delta3)*cos(phi)),0,0],
[0,1,-Lc*sin(phi)-Lo1*cos(phi),0,0,0,
a*(cos(delta3)*cos(phi)-sin(delta3)*sin(phi)),0,0],
[1,0,-Lo1*sin(phi)-Lc*cos(phi),0,0,
-a*(sin(phi)/sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1)
+sin(delta3)*Lc*cos(phi)
/((2*sin(delta3)*Lo1+cos(delta3)*Lc)
*sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1))),0,0,0],
[0,1,Lo1*cos(phi)-Lc*sin(phi),0,0,
a*(cos(phi)/sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1)
-sin(delta3)*Lc*sin(phi)
/((2*sin(delta3)*Lo1+cos(delta3)*Lc)
*sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1))),0,0,0],[0,0,0,1,1,0,0,0,-kon])

indexlist = [858,trigsimp,740]

Time for mysimprec() =  .3099999999999999
Aconz = matrix([1,0,Lo1*sin(phi),-a*sin(phi),0,0,0,0,0],
[0,1,-Lo1*cos(phi),a*cos(phi),0,0,0,0,0],
[1,0,-Lo1*sin(phi),0,-a*sin(phi),0,0,0,0],
[0,1,Lo1*cos(phi),0,a*cos(phi),0,0,0,0],
[1,0,Lo1*sin(phi)-Lc*cos(phi),0,0,0,
-a*cos(delta3)*sin(phi)-a*sin(delta3)*cos(phi),0,0],
[0,1,-Lc*sin(phi)-Lo1*cos(phi),0,0,0,
a*cos(delta3)*cos(phi)-a*sin(delta3)*sin(phi),0,0],
[1,0,-Lo1*sin(phi)-Lc*cos(phi),0,0,
-((2*a*sin(delta3)*Lo1+a*cos(delta3)*Lc)*sin(phi)
+a*sin(delta3)*Lc*cos(phi))
/sqrt(4*sin(delta3)^2*Lo1^2+4*cos(delta3)*sin(delta3)*Lc*Lo1
+Lc^2),0,0,0],
[0,1,Lo1*cos(phi)-Lc*sin(phi),0,0,
-(a*sin(delta3)*Lc*sin(phi)
+(-2*a*sin(delta3)*Lo1-a*cos(delta3)*Lc)*cos(phi))
/sqrt(4*sin(delta3)^2*Lo1^2+4*cos(delta3)*sin(delta3)*Lc*Lo1
+Lc^2),0,0,0],
[0,0,0,1,1,0,0,0,-kon])

(%o7) []
(%i8)

/*Maxima 5.12 results*/

Maxima 5.12.0 http://maxima.sourceforge.net
Using Lisp CMU Common Lisp 19d (19D)
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function bug_report()
provides bug reporting information.
(%i1)
(%o1) 		       /home/cfrangos/axiom/myutils.mac
(%i2)
batching /home/cfrangos/axiom/displayr.mac
(%i3) 	    displayr_do_it(L) := map(lambda([a%], a% = ev(a%)), L)
(%o3) 	    displayr_do_it(L) := map(lambda([a%], a% = ev(a%)), L)
#<Interpreted Function (LAMBDA (L) (MFUNCALL '|\$displayr_do_it| `#))
{586ED691}>
(%o4) 		      /home/cfrangos/axiom/myjacobian.mac
(%i5)
(%o5) 			     elapsed_run_time.lisp
(%i6)
(%o6) 		        /home/cfrangos/axiom/testms.mac
(%i7)
Aconz = matrix([1,0,Lo1*sin(phi),-a*sin(phi),0,0,0,0,0],
[0,1,-Lo1*cos(phi),a*cos(phi),0,0,0,0,0],
[1,0,-Lo1*sin(phi),0,-a*sin(phi),0,0,0,0],
[0,1,Lo1*cos(phi),0,a*cos(phi),0,0,0,0],
[1,0,Lo1*sin(phi)-Lc*cos(phi),0,0,0,
-a*(cos(delta3)*sin(phi)+sin(delta3)*cos(phi)),0,0],
[0,1,-Lc*sin(phi)-Lo1*cos(phi),0,0,0,
a*(cos(delta3)*cos(phi)-sin(delta3)*sin(phi)),0,0],
[1,0,-Lo1*sin(phi)-Lc*cos(phi),0,0,
-a*(sin(phi)/sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1)
+sin(delta3)*Lc*cos(phi)
/((2*sin(delta3)*Lo1+cos(delta3)*Lc)
*sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1))),0,0,0],
[0,1,Lo1*cos(phi)-Lc*sin(phi),0,0,
a*(cos(phi)/sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1)
-sin(delta3)*Lc*sin(phi)
/((2*sin(delta3)*Lo1+cos(delta3)*Lc)
*sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1))),0,0,0],[0,0,0,1,1,0,0,0,-kon])

indexlist = [858]

Time for mysimprec() =  2.25
Aconz = matrix([1,0,Lo1*sin(phi),-a*sin(phi),0,0,0,0,0],
[0,1,-Lo1*cos(phi),a*cos(phi),0,0,0,0,0],
[1,0,-Lo1*sin(phi),0,-a*sin(phi),0,0,0,0],
[0,1,Lo1*cos(phi),0,a*cos(phi),0,0,0,0],
[1,0,Lo1*sin(phi)-Lc*cos(phi),0,0,0,
-a*(cos(delta3)*sin(phi)+sin(delta3)*cos(phi)),0,0],
[0,1,-Lc*sin(phi)-Lo1*cos(phi),0,0,0,
a*(cos(delta3)*cos(phi)-sin(delta3)*sin(phi)),0,0],
[1,0,-Lo1*sin(phi)-Lc*cos(phi),0,0,
-a*(sin(phi)/sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1)
+sin(delta3)*Lc*cos(phi)
/((2*sin(delta3)*Lo1+cos(delta3)*Lc)
*sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1))),0,0,0],
[0,1,Lo1*cos(phi)-Lc*sin(phi),0,0,
a*(cos(phi)/sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1)
-sin(delta3)*Lc*sin(phi)
/((2*sin(delta3)*Lo1+cos(delta3)*Lc)
*sqrt(sin(delta3)^2*Lc^2
/(2*sin(delta3)*Lo1+cos(delta3)*Lc)^2
+1))),0,0,0],[0,0,0,1,1,0,0,0,-kon])

(%o7) []
(%i8)

```