ratsubst within logarithm



Tamas Papp <tkpapp at gmail.com> writes:
> Hi,
>
> If I do
>
> texput(%lambda,"\\lambda");
> assume(%lambda > 0);
> integrate(1/(1+A*exp(%lambda*(p-s))),p,x,inf);
>
> I get an expression where x-s always occurs together, so it would be
> convenient to replace them by a single parameter y=x-s.  I tried
>
> ratsubst(y,x-s,%);
>
> but the substitution is not performed inside the logarithm.  Is there
> a way I could make Maxima simplify this?  I guess I need to cancel the
> exp(something)*exp(-something) terms first inside the log, but I don't
> know how.

There's a slight work-around that I generally use in this sort of
situation. Instead substitute y+s for x:

(%i1) assume(? > 0);
(%o1)                               [? > 0]
(%i2) assume(A > 0);
(%o2)                               [A > 0]
(%i3) integrate(1/(1+A*exp(?*(p-s))),p,x,inf);
Is s ? an integer?

no;
                      - s ?      x ?     s ?
                log(%e      (A %e    + %e   ))   log(A)
(%o3)           ------------------------------ - ------ - x + s
                              ?                    ?
(%i4) subst(y+s, x, %);
                     - s ?      (y + s) ?     s ?
               log(%e      (A %e          + %e   ))   log(A)
(%o4)          ------------------------------------ - ------ - y
                                ?                       ?
(%i5) factor(%);
                                y ?
                        log(A %e    + 1) - y ? - log(A)
(%o5)                   -------------------------------
                                       ?

Tada!

I'm not sure how to convince ratsubst to deal with the exponentials
correctly: my attempts with map and scanmap failed miserably. Anyone got
any suggestions?

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/20120405/f6472c94/attachment.pgp>;