Simplifying atan expressions
- Subject: Simplifying atan expressions
- From: Stavros Macrakis
- Date: Mon, 20 Feb 2012 16:12:33 -0500
Henry,
Yes, this derivation is essentially the same as the bottomup rectform. In
fact:
expr: logcontract(logarc(4*atan(1/5)-atan(1/239)));
rectform(substpart(e1:rectform(piece),expr,1,2,1)) => %pi/4
You'll see that e1 here is -%i.
What rectform does internally by default looks more like
rectform(substpart(e2:polarform(piece),expr,1,2,1));
where e2 isn't at all helpful.
I agree that most mathematical functions (sin, etc.) and form-changing
routines (factor etc.) should distribute over "=".
-s
On Mon, Feb 20, 2012 at 15:45, Henry Baker <hbaker1 at pipeline.com> wrote:
> result=4*atan(1/5)-atan(1/239);
> 1 1
> (%o1) result = 4 atan(-) - atan(---)
> 5 239
> (%i2) lhs(%)=logcontract(logarc(rhs(%)));
> 4
> (%i - 5) (%i + 239)
> %i log(- --------------------)
> 4
> (%i - 239) (%i + 5)
> (%o2) result = ------------------------------
> 2
> (%i3) %*2/%i;
> 4
> (%i - 5) (%i + 239)
> (%o3) - 2 %i result = log(- --------------------)
> 4
> (%i - 239) (%i + 5)
> (%i4) exp(lhs(%))=exp(rhs(%));
> 4
> - 2 %i result (%i - 5) (%i + 239)
> (%o4) %e = - --------------------
> 4
> (%i - 239) (%i + 5)
> (%i5) lhs(%)=rectform(rhs(%));
> - 2 %i result
> (%o5) %e = - %i
> (%i6) log(lhs(%))=log(rhs(%));
> (%o6) - 2 %i result = log(- %i)
> (%i7) rectform(lhs(%))=rectform(rhs(%));
> %i %pi
> (%o7) - 2 %i result = - ------
> 2
> (%i8) solve(%,result);
> %pi
> (%o8) [result = ---]
> 4
>
> This example shows why rectform, log, exp, logcontract, logarc, etc.,
> should distribute over "=".
>
> At 11:20 AM 2/20/2012, Stavros Macrakis wrote:
> >Consider the expression 4*atan(1/5)-atan(1/239) (Machin's formula).
> >
> >How can we use Maxima to simplify it to %pi/4?
> >
> >Well, here's one approach:
> >
> >atan(trigexpand(trigexpand(tan(ex))))
> >
> >And here's another way that doesn't depend on trig identities:
> >
> >(%i1) ex:4*atan(1/5)-atan(1/239);
> >(%o1) 4*atan(1/5)-atan(1/239)
> >(%i2) llex: logcontract(logarc(ex));
> >(%o2) %i*log(-(%i-5)^4*(%i+239)/((%i-239)*(%i+5)^4))/2
> >(%i3) rectform(llex);
> >(%o3)
> (atan(sin(4*atan(1/5))/cos(4*atan(1/5)))-atan(sin(4*(%pi-atan(1/5)))/cos(4*(%pi-atan(1/5))))-2*atan(1/239))/2
> > <<< oops, not so helpful
> >(%i4) scanmap(rectform,llex,bottomup);
> > <<< but reorganizing the rectform calculation gives a better
> result
> > <<< makes me think that rectform could be improved...
> >(%o4) %pi/4
> >
> >Are any of these techniques packaged into some analog of trigsimp?
> >
> > -s
>
>