Dmitry Shkirmanov <piminusmeson at bk.ru> writes:
> Hello, list. Is there any function in maxima, that can
> 1/(A*B)+1/(AC)+1/(A^2*E)+1/(A^2*D) rewrite into
> 1/A*(1/B+1/C)+1/A^2*(1/D+1/E) ?
As usual with this sort of question: why are you trying to do this? If
you're trying to collect up factors of 1/A, you could try something like
(%i1) display2d: false$
(%i2) expr: 1/(A*B)+1/(A*C)+1/(A^2*E)+1/(A^2*D)$
(%i3) subst (1/A, Am, rat (ratsubst (Am, 1/A, expr), Am));
(%o3) ((B*C*E+B*C*D)/A^2+(C+B)*D*E/A)/(B*C*D*E)
But notice that rat() turns 1/B+1/C into (B+C)/BC and so on. If you
really, really want to get the form you wrote you could try something
like this:
(%i1) display2d: false$
(%i2) expr: 1/(A*B)+1/(A*C)+1/(A^2*E)+1/(A^2*D)$
(%i3) forwards: [A=1/Am, B=1/Bm, C=1/Cm, D=1/Dm, E=1/Em]$
(%i4) backwards: map (lambda ([eq], 1/rhs(eq)=1/lhs(eq)), forwards);
(%o4) [Am = 1/A,Bm = 1/B,Cm = 1/C,Dm = 1/D,Em = 1/E]
(%i5) subst (forwards, expr);
(%o5) Am^2*Em+Am^2*Dm+Am*Cm+Am*Bm
(%i6) rat (%, Am);
(%o6) (Em+Dm)*Am^2+(Cm+Bm)*Am
(%i7) map (lambda ([u], map (lambda ([v], subst (backwards, v)), u)), %);
(%o7) (1/E+1/D)/A^2+(1/C+1/B)/A
Invoking map twice like this doesn't allow the simplifier to collect up
the 1/A terms and things. Frankly, I don't see the point though: after
all, what are you going to do with the result? As soon as you touch it
with any other computation, it'll get re-simplified in a way you don't
recognise...
There might be another way of getting this result using the format
library, but that's somewhat unmaintained if I remember correctly.
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/20111214/7cbcf454/attachment.pgp>