factor does not work as expected



radcan(h) will combine the powers.

To extract all x such that x^base appears in expr, how about:

powers_of(expr,base):=block([inflag:true],
                 if mapatom(expr) then [] elseif part(expr,0) = "^" and
part(expr,1) = base then [part(expr,2)]
                     else
apply('append,maplist(lambda([ex],powers_of(ex,base)),expr)))


On Mon, Jan 31, 2011 at 17:55, andre maute <andre.maute at gmx.de> wrote:

> suppose one has
> ----factor.max---------------------
>
> display2d : false;
>
> declare(a_1,integer);
> declare(a_2,integer);
> declare(a_3,integer);
>
> assume(1-xbar_1 > 0);
> assume(1-xbar_2 > 0);
>
> assume(a_1 >= 0);
> assume(a_2 >= 0);
> assume(a_3 >= 0);
>
> h :
> 2^(a_2-a_1)*4^(a_3-a_2)*(1-xbar_2)^(a_3+a_2)*(1-xbar_1)^(a_3+a_2+a_1)/8^a_3;
>
> factor(ratsimp(h));
> ----factor.max---------------------------
>
> maxima -b factor.max
>
> gives
> -------output---------------------------
> Maxima 5.19.2 http://maxima.sourceforge.net
> Using Lisp SBCL 1.0.40-1.fc14
> Distributed under the GNU Public License. See the file COPYING.
> Dedicated to the memory of William Schelter.
> The function bug_report() provides bug reporting information.
> (%i1)                          batch(factor.max)
>
> batching /home/user/factor.max
> (%i2)                          display2d : false
> (%o2) false
> (%i3) declare(a_1,integer)
> (%o3) done
> (%i4) declare(a_2,integer)
> (%o4) done
> (%i5) declare(a_3,integer)
> (%o5) done
> (%i6) assume(1-xbar_1 > 0)
> (%o6) [xbar_1 < 1]
> (%i7) assume(1-xbar_2 > 0)
> (%o7) [xbar_2 < 1]
> (%i8) assume(a_1 >= 0)
> (%o8) [a_1 >= 0]
> (%i9) assume(a_2 >= 0)
> (%o9) [a_2 >= 0]
> (%i10) assume(a_3 >= 0)
> (%o10) [a_3 >= 0]
> (%i11)
> h:2^(a_2-a_1)*4^(a_3-a_2)*(1-xbar_2)^(a_2+a_3)*(1-xbar_1)^(a_1+a_2+a_3)
>         /8^a_3
> (%o11)
> 2^(a_2-a_1)*4^(a_3-a_2)*(1-xbar_1)^(a_3+a_2+a_1)*(1-xbar_2)^(a_3+a_2)
>        /8^a_3
> (%i12) factor(ratsimp(h))
> (%o12)
> 2^(a_2-a_1)*4^(a_3-a_2)*(1-xbar_1)^(a_3+a_2+a_1)*(1-xbar_2)^(a_3+a_2)
>        /8^a_3
> (%o12) "/home/puck/factor.max"
> -------output---------------------------
>
> 1. Question:
> Is it possible to force maxima to combine the integer powers?
>
> 2. Question:
> How can I extract the exponents of (1-xbar_1) respectively (1-xbar_2)?
>
> Thanks
> Andre
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>