On 28/02/2008, Richard Fateman <fateman at cs.berkeley.edu> wrote:
>
> No, there is not a "max simplification search depth".
>
> It would be nice if you didn't change your notation from line to line, e.g.
> do you want rx or dx.
>
Yes, I'm sorry. (I did try to unify the two notations, but clearly forgot at
least one line)
If you detect a common subexpression, E and want to replace it by F, then
> try
> subst(F,E, expression)
>
> or
> ratsubst(F, E, expression).
>
Thanks! I saw subst(...), but that didn't work, and never noticed ratsubst.
It does work a bit strange, though, when I do
integrate((x-d*r)/(a*r^2+b*r+c)^(1/2),r,0,1);
maxima again gives a result that can be simplified; when I then ask it to
ratsubst(S, sqrt(4*a*c-b^2),%);
appart from substituting, it also combines the asinh()'s that have the same
parameter, thus doing what I wanted maxima to do all along (see below).
Also, I notice that when i do
integrate((x+dx*r)*((x+dx*r)^2+(y+dy*r)^2+(z+dz*r)^2)^-(3/2),r);
(question: nonzero)
maxima gives a result of more than one page. But if I then do:
ratsubst(notexist,notexist,%);
then it simplifies the result greatly (to just a few lines). (the reverse
also happens)
So, clearly ratsubst() does do more than just substituting.
Here the ratsubst() that combines the asinh()'s, while integrate didn't do
that:
assume(4*a*c-b^2>0);
assume(b>0);
assume(a>0);
integrate((x-d*r)/(a*r^2+b*r+c)^(1/2),r,0,1);
(%o94) (sqrt(a) (- 2 a asinh(----------------) x - b asinh(----------------)
d)
2 2
sqrt(4 a c - b ) sqrt(4 a c - b )
2 b + 2 a
+ 2 a sqrt(c) d)/(2 a ) - (sqrt(a) (- 2 a asinh(----------------) x
2
sqrt(4 a c - b )
b + 2 a 2
- b asinh(----------------) d) + 2 a sqrt(c + b + a) d)/(2 a )
2
sqrt(4 a c - b )
(%i95) ratsubst(S, sqrt(4*a*c-b^2),%);
3/2 b + 2 a
(%o95) ((2 a x + sqrt(a) b d) asinh(-------)
S
3/2 b
+ (- 2 a x - sqrt(a) b d) asinh(-) + (2 a sqrt(c) - 2 a sqrt(c + b + a))
d)
S
2
/(2 a )
(This is with ubuntu's maxima 5.12.0)
Anyway, thanks (and to Stavros) for your replies!