Maxima: trigsimp() introducing errors ??



Hi Stavros and Barton,

Thanks for the response.

I am using maxima 5.10 and 5.12. 

I implemented dividethru() from Stavros and this gives the same result (see 
below).

Its not clear why trigsimp() introduces a singularity in Maxima 5.10/5.12 but
seemingly not in Maxima 5.13.99.

Note that I also get a singularity when I apply the following Maxima 
functions to q:

ratsimp(), fullratsimp(), radcan().

trigrat(q) produces a  big expression asking whether it is pos, neg, etc.

Any assistance would be appreciated.

I would like to take the opportunity to wish everybody on the Maxima list ALL 
THE BEST FOR 2008, and especially thank Stavros Macrakis, Barton Willis, 
Robert Dodier and others for their kind assistance with Maxima questions over 
the past two years.

Regards,

C. Frangos.



q :  -k*Lc/(Lc*(cos(delta3)*sqrt(sin(delta3)^2*Lc^2
                                     /(2*sin(delta3)*L2+cos(delta3)*Lc)^2
                                     +1)
                  +1)
              +2*sin(delta3)*L2
                *sqrt(sin(delta3)^2*Lc^2/(2*sin(delta3)*L2+cos(delta3)*Lc)^2
                       +1))

(%i113) limit(q,delta3,0);

(%o113) -k/2
(%i114) limit(trigsimp(q),delta3,0);

Is  Lc  positive or negative?

positive;
(%o114) -k/2
(%i115) subst(0,delta3,q);

(%o115) -k/2
(%i116) subst(0,delta3,trigsimp(q));

Division by 0
 -- an error.  Quitting.  To debug this try debugmode(true);
(%i117) subst(0,delta3,dividethru(q));

(%o117) -k/2
(%i118)

(%i121) subst(0,delta3,dividethru(trigsimp(q)));

Division by 0
 -- an error.  Quitting.  To debug this try debugmode(true);
(%i122)

On Wednesday 19 December 2007 22:06, Stavros Macrakis wrote:
> Try limit(trigsimp(q),delta3,0) ... this is a removable singularity.
>
> You can confirm that they are equal by comparing the taylor series at 0:
>
> q: ...<your expression>
>
> taylor(q, delta3, 0, 5);
>
> taylor(trigsimp(q), delta3, 0, 5);
>
> You can also reorganize the expression using my divthru function:
>
> divthru(a):=block([n,d,div],
>         if mapatom(a) then a elseif inpart(a,0) = "*" and
> numberp(n:inpart(a,1))
>             then (div:divthru(a/n),if not atom(div) and inpart(div,0) = "+"
> then multthru(n*div) else n*div) elseif part(a,0) = "//"
>             then (n:part(a,1),d:part(a,2),div:divide(n,d),div[2]/d+div[1])
> elseif part(a,0) = "-" then -divthru(-a) else a)$
>
> then subst(0,delta3,divthru(trigsimp(q))) gives -k/2.
>
>            -s
>
> On Dec 19, 2007 1:46 PM, Constantine Frangos <cfrangos at telkomsa.net> wrote:
> > I have an expression q consisting of trigonometric terms, and q(delta3=0)
> > =
> > -k/2.
> >
> > When I apply trigsimp(q), the resulting expression has a singularity at
> > delta3 = 0 (see below). It appears that trigsimp() is introducing errors
> > ??
> >
> > Any assistance would be appreciated.
> >
> > Regards,
> >
> > C. Frangos.
> >
> >
> > (%i82) q;
> >
> > (%o82) -k*Lc/(Lc*(cos(delta3)*sqrt(sin(delta3)^2*Lc^2
> >                                    /(2*sin(delta3)*L2+cos(delta3)*Lc)^2
> >                                    +1)
> >                 +1)
> >             +2*sin(delta3)*L2
> >
> > *sqrt(sin(delta3)^2*Lc^2/(2*sin(delta3)*L2+cos(delta3)*Lc)^2 +1))
> > (%i83) subst(0,delta3,q);
> >
> > (%o83) -k/2
> > (%i84) subst(0,delta3,trigsimp(q));
> >
> > Division by 0
> >  -- an error.  Quitting.  To debug this try debugmode(true);
> > (%i85)
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima