one question about Maxima



On June 23, 2009, Richard Fateman wrote:
---------------------------------------------------------


> try this:
>
> eqn, exponentialize;
>
> solve(%,x);
>
> you get 2 answers.  The second is
> -%i*log(a/(2*b-%i*a)-(2*%i*b)/(2*b-%i*a))
>
> which is the same as the atan() you found.  Proving that they are 
> equivalent
> does not seem to be easy.   The first solution is different, though.
>
> RJF
>
>
Thanks, Richard, for the suggestion.

Using exponentialize is easier than Renzo's method and returns the
same results:
--------------------------------------
(%i1) display2d:false$
(%i2) eqn : a*(1-sin(x)) - 2*b*cos(x) = 0$
(%i3) solve ( eqn, x );
(%o3) [sin(x) = -(2*b*cos(x)-a)/a]
(%i4) eqn, exponentialize;
(%o4) a*(%i*(%e^(%i*x)-%e^-(%i*x))/2+1)-b*(%e^(%i*x)+%e^-(%i*x)) = 0
(%i5) solve ( %, x );
(%o5) [x = -%i*log(2*%i*b/(2*b-%i*a)+a/(2*b-%i*a)),
       x = -%i*log(a/(2*b-%i*a)-2*%i*b/(2*b-%i*a))]
(%i6) %, rectform, ratsimp;
(%o6) [ x = %pi/2,  x = -atan2 ((4*b^2-a^2)/(4*b^2+a^2),4*a*b/(4*b^2+a^2))]
(%i7) [x1, x2] : map ( 'rhs, % );
(%o7) [%pi/2, -atan2((4*b^2-a^2)/(4*b^2+a^2), 4*a*b/(4*b^2+a^2))]
(%i8) eqn, x=x1, ratsimp;
(%o8) 0 = 0
(%i9) eqn, x=x2, ratsimp;
(%o9) 0 = 0
(%i10) part ( x2, 1 );
(%o10) atan2 ((4*b^2-a^2)/(4*b^2+a^2),4*a*b/(4*b^2+a^2))
(%i11) [yy, xx] : args ( part ( x2, 1 ) );
(%o11) [(4*b^2-a^2)/(4*b^2+a^2),4*a*b/(4*b^2+a^2)]
(%i12) x2  :  to_atan ( x2, yy, xx );
(%o12) -atan ((4*b^2-a^2)/(4*a*b))

  which is the correct answer for one of the roots, bear in mind
  that tan(-x) = -tan(x).
In the above, I used one of my utility functions from the upcoming
completely rewritten chapter 1, getting started:

/* replace atan2(y,x) by atan(y/x) */

to_atan(e,y,x) := ratsubst ( atan(y/x), atan2(y,x), e )$

 However, we get a mess trying to verify
  this final form as being a correct root.

(%i13) eqn, x = x2, ratsimp;
(%o13) -(abs(a)*sqrt(16*b^4+8*a^2*b^2+a^4)*abs(b)-4*a*b^3-a^3*b)/(4*b^3+a^2*b)
         = 0
(%i14) assume(a>0, b>0)$
(%i15) eqn, x = x2, ratsimp;
(%o15) -(a*sqrt(16*b^4+8*a^2*b^2+a^4)-4*a*b^2-a^3)/(4*b^2+a^2) = 0

---------------------------------------------
Ted Woollett