"trigrat" caught in infinite loop - depending on how you call it
Subject: "trigrat" caught in infinite loop - depending on how you call it
From: Barton Willis
Date: Fri, 9 Nov 2012 04:41:45 +0000
_______________________________________
> Adding ?varlist:false to the list of variables in the block fixes the bug.
> I guess at this point we need to figure out which of the built-in functions is not restoring VARLIST ....
Maybe the trouble maker is rat(ratsimp(expand(exponentialize(exp ...). I think this fixes the bug:
#$trigrat(exp):=
if matrixp (exp) or listp (exp) or setp (exp) or trigrat_equationp (exp)
then map (trigrat, exp)
else block([e,n,d,lg,f,lexp,ls,d2,l2,alg,gcd1],
alg:algebraic,gcd1:gcd,
algebraic:true,gcd:subres,
e : block([?varlist : false], rat(ratsimp(expand(exponentialize(exp))))),
n:num(e),d:denom(e),
listofei(d),
l2:map(lambda([u,v],u^((hipow(d2,v)+lopow(d2,v))/2)),
lexp,lg),
f:if length(lexp)=0 then 1
else if length(lexp)=1 then part(l2,1)
else apply("*",l2),
n:rectform(ratexpand(n/f)),
d:rectform(ratexpand(d/f)),
e:ratsimp(n/d,%i),
algebraic:alg,gcd:gcd1,
e)$
--bw