Fwd: Maxima: simplification function error message.
Subject: Fwd: Maxima: simplification function error message.
From: C. Frangos
Date: Thu, 6 Sep 2007 19:23:08 +0200
Hi Stavro,
Thanks for the fast response.
I have set the following:
gcd : spmod,
algebraic : true,
The result is that mysimprec.mac now works, and also simplifies
significantly. See below for an example. It seems that the above settings
have a major effect in the performance of the built-in Maxima functions
fullratsimp, trigsimp, factor, trigreduce.
Regards,
C. Frangos.
This invariably means you have encountered a bug in Maxima's GCD
function, which is called in many places internally. You might try
setting the default GCD to a different algorithm, e.g. `ez', `subres',
`red', or `spmod'. Depending on the version of Maxima you are
running, the default is subres (old version, this error occurs often)
or spmod (believed to be more reliable). Depending on the behavior
you want, you might also look into the value of the 'algebraic' global
variable.
? gcd
? algebraic
-s
---------- Forwarded Message ----------
Subject: Maxima: simplification function error message.
Date: Thu, 6 Sep 2007 13:27:55 +0200
From: C. Frangos <cfrangos at telkomsa.net>
To: maxima at math.utexas.edu
I am applying my own simplification function mysimprec.mac (in Maxima 5.9,
5.10) to some complicated expressions (eg expression for detar pasted below)
and am getting errors like the following:
Quotient by a polynomial of higher degree
-- an error. Quitting. To debug this try debugmode(true);
Its not clear to me what this error message means.
Any assistance would be very much appreciated.
Regards,
C. Frangos.
mysimprec(s) := block(
[indexlist,sx,nf,listsimpf,nsx,nmin,simpf,sxnew],
/*listsimpf : [trigexpand, fullratsimp, trigsimp, factor, trigreduce],*/
/*listsimpf : [fullratsimp, trigrat, trigsimp, factor, trigreduce,
dividethru],*/
listsimpf : [fullratsimp, trigsimp, factor, trigreduce, dividethru],
nf : length(listsimpf),
sx : s,
nmin : length(string(sx)),
indexlist : [nmin],
for i1 : 1 thru nf do (
simpf : listsimpf[i1],
sxnew : apply(simpf,[sx]),
nsx : length(string(sxnew)),
if (nsx < nmin) then (
indexlist : endcons(simpf,indexlist),
indexlist : endcons(nsx,indexlist),
sx : sxnew,
nmin : nsx
)
),
display(indexlist),
return(sx)
);
/*Applying mysimprec.mac to detar produces error given above.*/
detar = -a^2*dpsis*k^2*LC
*(SIN(delta3)*Ld*SIN(PHI)-SIN(delta3)*Lo1*COS(PHI)
-COS(delta3)*LC*COS(PHI))
*(SIN(delta3)*Lo1^2
*SQRT(4*SIN(delta3)^2*Lo1^2
+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)
*SIN(PHI)
+SIN(delta3)*LC^2
*SQRT(4*SIN(delta3)^2*Lo1^2
+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)
*SIN(PHI)-2*COS(delta3)*SIN(delta3)^2*Lo1^3*SIN(PHI)
+4*SIN(delta3)^3*LC*Lo1^2*SIN(PHI)-SIN(delta3)*LC*Lo1^2*SIN(PHI)
+2*COS(delta3)*SIN(delta3)^2*LC^2*Lo1*SIN(PHI)
+SIN(delta3)*LC^3*SIN(PHI)
-SIN(delta3)*Ld*Lo1
*SQRT(4*SIN(delta3)^2*Lo1^2
+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)
*COS(PHI)
-COS(delta3)*LC*Ld
*SQRT(4*SIN(delta3)^2*Lo1^2
+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)
*COS(PHI)
-2*COS(delta3)*SIN(delta3)^2*Ld*Lo1^2*COS(PHI)
+2*SIN(delta3)^3*LC*Ld*Lo1*COS(PHI)
-3*SIN(delta3)*LC*Ld*Lo1*COS(PHI)-COS(delta3)*LC^2*Ld*COS(PHI))
/(2*(SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)
+LC)
*(3*SIN(delta3)^2*LC*Lo1^2
*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)
+3*COS(delta3)*SIN(delta3)*LC^2*Lo1
*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)
+LC^3*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo1
+LC^2)+4*SIN(delta3)^4*Lo1^4
+8*COS(delta3)*SIN(delta3)^3*LC*Lo1^3
+4*COS(delta3)^2*SIN(delta3)^2*LC^2*Lo1^2+5*SIN(delta3)^2*LC^2*Lo1^2
+5*COS(delta3)*SIN(delta3)*LC^3*Lo1+LC^4))
-a^2*dpsis*k^2*LC
*(SIN(delta3)*Lo1*SIN(PHI)+COS(delta3)*LC*SIN(PHI)
+SIN(delta3)*Ld*COS(PHI))
*(SIN(delta3)*Ld*Lo1
*SQRT(4*SIN(delta3)^2*Lo1^2
+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)*SIN(PHI)
+COS(delta3)*LC*Ld
*SQRT(4*SIN(delta3)^2*Lo1^2
+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)*SIN(PHI)
+2*COS(delta3)*SIN(delta3)^2*Ld*Lo1^2*SIN(PHI)
-2*SIN(delta3)^3*LC*Ld*Lo1*SIN(PHI)
+3*SIN(delta3)*LC*Ld*Lo1*SIN(PHI)+COS(delta3)*LC^2*Ld*SIN(PHI)
+SIN(delta3)*Lo1^2
*SQRT(4*SIN(delta3)^2*Lo1^2
+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)*COS(PHI)
+SIN(delta3)*LC^2
*SQRT(4*SIN(delta3)^2*Lo1^2
+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)*COS(PHI)
-2*COS(delta3)*SIN(delta3)^2*Lo1^3*COS(PHI)
+4*SIN(delta3)^3*LC*Lo1^2*COS(PHI)-SIN(delta3)*LC*Lo1^2*COS(PHI)
+2*COS(delta3)*SIN(delta3)^2*LC^2*Lo1*COS(PHI)
+SIN(delta3)*LC^3*COS(PHI))
/(2*(SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)
+LC)
*(3*SIN(delta3)^2*LC*Lo1^2
*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo1
+LC^2)
+3*COS(delta3)*SIN(delta3)*LC^2*Lo1
*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo1
+LC^2)
+LC^3*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo1
+LC^2)+4*SIN(delta3)^4*Lo1^4
+8*COS(delta3)*SIN(delta3)^3*LC*Lo1^3
+4*COS(delta3)^2*SIN(delta3)^2*LC^2*Lo1^2
+5*SIN(delta3)^2*LC^2*Lo1^2+5*COS(delta3)*SIN(delta3)*LC^3*Lo1
+LC^4))
/*Setting gcd : spmod, algebraic : true, and then applying mysimprec.mac
produces significant simplification:*/
indexlist = [3650,FULLRATSIMP,3087,TRIGSIMP,1165,FACTOR,861]
detar = a^2*dpsis*k^2*LC*Ld
*(4*SIN(delta3)^3*LC*Lo1^3
*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo
+LC^2)
+8*COS(delta3)*SIN(delta3)^2*LC^2*Lo1^2
*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo
+LC^2)
-4*SIN(delta3)^3*LC^3*Lo1
*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo
+LC^2)
+5*SIN(delta3)*LC^3*Lo1
*SQRT(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo
+LC^2)
+COS(delta3)*LC^4
*SQRT(4*SIN(delta3)^2*Lo1^2
+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2)
-8*SIN(delta3)^5*Lo1^5-24*COS(delta3)*SIN(delta3)^4*LC*Lo1^4
+24*SIN(delta3)^5*LC^2*Lo1^3-30*SIN(delta3)^3*LC^2*Lo1^3
+8*COS(delta3)*SIN(delta3)^4*LC^3*Lo1^2
-20*COS(delta3)*SIN(delta3)^2*LC^3*Lo1^2+6*SIN(delta3)^3*LC^4
-7*SIN(delta3)*LC^4*Lo1-COS(delta3)*LC^5)
/(8*SIN(delta3)^2*Lo1^2*(SIN(delta3)*Lo1+COS(delta3)*LC)^3
*(4*SIN(delta3)^2*Lo1^2+4*COS(delta3)*SIN(delta3)*LC*Lo1+LC^2))