"Tidiest" simplification?



Ardillas del Monte <ardillasdelmonte at gmail.com> writes:
> Let's suppose we need to solve this quadratic equation for Us1:
>
>  ec: (d/(2*Uo))*(Us1^2)-(d*Us1)+Md=0;
>
> Maxima says this:
> [Us1=-(sqrt(d)*sqrt(d*Uo^2-2*Md*Uo)-d*Uo)/d,Us1=(sqrt(d)*sqrt(d*Uo^2-2*Md*Uo)+d*Uo)/d];
>
> If I solve it on paper, I can get this (tidier) expression of the same
> solution:
> [Us1=(1-sqrt(1-(2*Md)/(d*Uo)))*Uo, Us1=(1+sqrt(1-(2*Md)/(d*Uo)))*Uo];
>
> I'd like that Maxima arrives to a "tidy" solution such as the one I got
> manually, but supposing that's unreasonable for a CAS package, at least I'd
> wish that Maxima checks if my solution is exactly the same as the one
> Maxima got.
>
> I tried to subtract the two solutions, but the result wasn't zero. Then I
> tried to either factor(%); expand(%); or fullratsimp(%); but didn't get
> zero either...
>
> So... how can I tell Maxima to verify if the two solutions are exactly the
> same?

The problem here is with the square roots. The functions factor, expand,
ratsimp etc. are designed to work well with rational functions (ratios
of two polynomials) and they treat other functions (sin, sqrt, ...) as
basically black boxes. Fortunately, there is another function called
"radcan" that deals well with radicals:

  (%i1) ec: (d/(2*Uo))*(Us1^2)-(d*Us1)+Md=0;
                                   2
                              d Us1
  (%o1)                       ------ - d Us1 + Md = 0
                               2 Uo
  (%i2) solve(ec, Us1);
                       2   2
                 sqrt(d  Uo  - 2 d Md Uo) - d Uo
  (%o2) [Us1 = - -------------------------------, 
                                d
                                                       2   2
                                                 sqrt(d  Uo  - 2 d Md Uo) + d Uo
                                           Us1 = -------------------------------]
                                                                d
  (%i3) map (rhs, %o2) - [(1-sqrt(1-(2*Md)/(d*Uo)))*Uo, (1+sqrt(1-(2*Md)/(d*Uo)))*Uo];
                 2   2
           sqrt(d  Uo  - 2 d Md Uo) - d Uo                 2 Md
  (%o3) [- ------------------------------- - (1 - sqrt(1 - ----)) Uo, 
                          d                                d Uo
                             2   2
                       sqrt(d  Uo  - 2 d Md Uo) + d Uo             2 Md
                       ------------------------------- - (sqrt(1 - ----) + 1) Uo]
                                      d                            d Uo
  (%i4) radcan(%);
  (%o4)                               [0, 0]


Tada!

> Also, if there's some way of telling Maxima to get the "tidiest"
> simplification for a solution, please tell me!!

I think the problem is that this isn't really well defined. I'm also not
particularly expert at forcing the simplifier to give me particular
forms of an expression. Someone else might be able to be more help here.

Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20130216/22166654/attachment.pgp>;