[Maxima] factor/simplification problem
macrakis at alum.mit.edu
Wed May 16 14:14:23 CDT 2007
On 5/15/07, Ryan Krauss <ryanlists at gmail.com> wrote:
> Thanks Stavros, that is powerful and flexible and I have learned a lot
> from your example. I think I now mostly understand substpart and it
> will definitely help with fine tuning.
> Is there a way to do this sort of thing less interactively? It seems
> like I need to first use part to find out which terms I want to work
> with and then use substpart on those terms.
Well, it depends exactly what you want to do. As my example showed, these
partial factorizations are not unique, and factorsum doesn't handle the
numerator case -- which is why I used substpart.
To take a simpler example showing non-uniqueness:
ex:a*b+b*c+c*a => b c + a c + a b
substpart(factor(piece),ex,[1,2]) => (b + a) c + a b
substpart(factor(piece),ex,[1,3]) => b (c + a) + a c
substpart(factor(piece),ex,[2,3]) => a (c + b) + b c
rat(ex,a,b,c) => (b + a) c + a b
rat(ex,a,c,b) => (c + a) b + a c
rat(ex,b,a,c) => (a + b) c + b a
rat(ex,b,c,a) => (c + b) a + b c
rat(ex,c,a,b) => (a + c) b + c a
rat(ex,c,b,a) => (b + c) a + c b
These forms are all equivalent, and all equally short. Depending on the
structure of the problem, any one of them may be ideal. In fact, the
original, unfactored form may be ideal if the real structure is sum(
The "obvious" factorization of the 4-term version
a*b+b*c+c*d+d*a = (a+c)*(b+d)
may be a fluke if you also care about the 3- and 5-term versions....
You can perform an exhaustive search (looking at all partitions) for a
factorsum -- in fact I posted some code for this on the list a while ago --
but that may or may not do what you want and it gets slow on large
As a first step in this direction, I tried to just call
> factorsum on the numerator and denominator from num and denom (my
> expressions will always be fractions of transcendental expressions).
> But the weird thing is that factorsum doesn't seem to work on the
Yes, factorsum only works under fairly narrow conditions:
factorsum(a*b+a*c+b*c) => a*b+a*c+b*c
factorsum(a*b+a*c+c*d+e*d) => a*b+a*c+c*d+e*d NOT d*(e+c)+a*(c+b)
> If I could make factorsum always work on the numerator and denominator
> separately, I think I could make this work algorithmically (i.e.
Yes, that is the challenge. If you know the structure of your expressions a
priori, you can do a lot more. For example,
if atom(ex) then ex
then block([quorem: divide(ex,div)], quorem*div + quorem)
Hope this helps,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Maxima