Dividing through in fractions



On 9/6/07, Rupert Swarbrick <rupert.swarbrick at lineone.net> wrote:
> I've got a fraction, say:
>
> a*%e^x/(b*%e^y + d*%e^x)
>
> and I'd much prefer
>
> a/(b*%e^(y-x) + d)
>
> because it's simpler....
>
> Is there a function with which I can "divide through" by exp(x)?

It's easy to define such a function:

numdenmul(expr, mul) :=
    if op(expr) = "-" then - numdenmul(- expr, mul) /* handle -a/b */
    elseif op(expr) = "//" then apply("//", expand(mul args(expr))) /*
a*[b,c] => [a*b,a*c] */
    else expr   /* if it's not a division, just return it unchanged */ $

numdenmul(a*%e^x/(b*%e^y+d*%e^x),%e^-x) =>
    a/(b*%e^(y-x)+d)

> is it easily callable by format(), which I've recently started using?

Sorry, I don't know.

> If not, is there a method list members favour for doing "custom
> simplification" of expressions like this - i.e. simplifying stuff
> because you know more than maxima about the formula, e.g. getting
> dimensions to cancel etc. ?

The hardest part of doing simplifications like this is figuring out
*which* simplification to do.  There are also a few "gotchas" to look
out for, for example Maxima treats -a/b as -(a/b) and not (-a)/b --
internally, it is actually -1*a*b^-1 (cf. inpart).

You might look at the pattern-matching subsystem in Maxima, or you can
just write out explicit code like the above.

          -s