"Tidiest" simplification?



On 02/16/2013 05:44 AM, Rupert Swarbrick wrote:
> Ardillas del Monte<ardillasdelmonte at gmail.com>  writes:

>> 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.

Yes, it's definitely not well defined. On the list there have been 
several variants on a kind of simplification optimizer. Things like 
"shortest written string" and soforth. You can search the list archives.

Here's how to get the form you want from your solution. The key is to 
ask Maxima to rewrite it in terms of the ratio (2*Md/d/Uo) which you 
will put "in a box" so that it's treated as one block (it's kind of like 
giving it its own symbolic name). You use ratsubst to do this because 
ratsubst knows about mathematics, whereas subst just knows about 
identity of two subexpressions.

ec: (d/(2*Uo))*(Us1^2)-(d*Us1)+Md=0;

soln:solve(ec,Us1);
desired:[Us1=(1-sqrt(1-(2*Md)/(d*Uo)))*Uo, 
Us1=(1+sqrt(1-(2*Md)/(d*Uo)))*Uo];

assume(Uo>0,d>0);
factor(ratsubst(box(2*Md/d/Uo),2*Md/d/Uo,soln));
rembox(%);


The rembox at the end makes it remove the box from around the stuff of 
interest.

It's not quite exactly the form you asked for but so close that I didn't 
work further on it.