Menu

#476 Simplifying (a*t+a)^q/(b*t+b)^r

open
nobody
5
2006-09-09
2003-12-17
No

This report ties together the discussion of several other
bug reports. Fixing the individual bugs reported
separately will be a good thing, but it will also be good
to keep the big picture in mind, and make sure that all
these cases are handled properly by the system. It has
been rather frustrating trying to simplify what are, after
all, rather simple cases.

---------------------

Consider

rad(a,b,q,r):= (a*t+a)^q/(b*t+b)^r

This is obviously equivalent to a^q/b^r * (t+1)^(q-r).

In Maxima, when a and b are equal, this simplifies nicely
and automatically:

rad(5,5,q,r) => (5*t+5)^(q-r)

However, when a and b are not equal (e.g. a=1 and b=-
1), simplification is not automatic. So far, so good --
default simplification isn't supposed to perform GCD's; it
doesn't even simplify rad(a,b,1,1) to a/b.

So what functions should we use to simplify? I can think
of four: ratsimp, factor, rootscontract, and radcan. (In
all that follows, I have gcd:'spmod and algebraic:true.)

Ratsimp has the annoying (but expected) property of
expanding out:

ratsimp(rad(1,-1,3,7))
=> -1/(t^4+4*t^3+6*t^2+4*t+1)

and still doesn't reduce to simplest form for fractional
exponents:

ratsimp(rad(1,-1,1/2,2))
=> SQRT(t+1)/(t^2+2*t+1)

Rootscontract/rootconmode:all sometimes works well:

rootall(ex):=block([rootsconmode:all],rootscontract
(ex))$

rootall(rad(1,-1,3/7,2/5))
=> (t + 1)^(1/35)

but other times has an annoying tendency to expand
unnecessarily:

rootall(rad(1,-1,7/13,3/11))
=> (-t^38-38*t^37-703*t^36-......)^(1/143)

instead of

-(t+1)^(38/143)

(reported as bug 861870)

It also does not work at all when either p or q is an
integer:

rootall(rad(1,-1,1/2,1))
=> SQRT(t+1)/(-t-1)

Factor is sometimes useful:

factor(rad(1,2,2/3,1/3)) => (t+1)^(1/3)/2^(1/3)

scanmap/factor is sometimes better, but both fail
sometimes, too:

factor(rad(1,-1,100,300/7))
=> (t+1)^58/(-t-1)^(6/7)

(see bugs 861827 and 861880)

scanmap/factor sometimes helps, but not in this case.

None of these approaches alone simplifies rad(1,-
1,9/2,3/2) to %i*(t+1)^3, though factor(radcan(...))
does, as does rectform(...).

Consider also

map(radcan, [1/SQRT(t+1),SQRT(-t-1)/(t+1),SQRT
(t+1)/(-t-1),1/SQRT(-t-1)])

The most surprising difference is in the treatment of rad
(1,-1,1/2,1) and rad(-1,1,1/2,1). Ratsimp, Factor, and
Radcan all correctly handle rad(1,-1,...), and all fail on
rad(-1,1,...). On the other hand, they work identically
on rad(2,3,...) and rad(3,2,...). Apparently they
are "uncomfortable" with pulling out %I.

The only way I have found to simplify rad(-1,1,1/2,1)
and rad(1,-1,1,1/2) -- that is, where the term with the
square root is negative -- is to first use rectform, e.g.
factor(rectform(rad(-1,1,1/2,1))) -- but that only works
if you respond that t+1 is positive.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    You may try this:

    ex2:(a*t+a)^q/(b*t+b)^r;
    ratsubst(z, t+1, %);
    radcan(%);
    subst(t + 1, z, %);

     
  • Robert Dodier

    Robert Dodier - 2006-07-19
    • labels: --> 460522
     
  • Robert Dodier

    Robert Dodier - 2006-09-09
    • labels: 460522 --> Lisp Core - Simplification
     

Log in to post a comment.