[Maxima] The factor function is a little bit silly.
jcpiza at gmail.com
Mon Apr 7 13:11:50 CDT 2008
On Monday 07 April 2008 10:47:39 CDT 2008, Alexey Beshenov wrote:
> On Monday 07 April 2008 15:45, J.C. Pizarro wrote:
> > To fix this problem in the future: better artificial sustitution in the
> > solving of factor or intelligent lazy computation as
> > factor(expand(Alpha)) => Alpha.
> You're passing a verb to factor(...), so it's not "silly" when Maxima
> evaluates it and does expansion of such huge polynomial.
But Maxima sometimes can't factorize some factorizable huge polynomials
that were expanded or sometimes it is trying to factorize it for excess time.
> Your rule is obviously wrong, e.g.
> factor(expand((x^2+4*x+4)^3)) => (x+2)^6
> You can add your own rules of form
> factor(expand((f)^n)) => (factor(f))^n,
Ohh, i did make a mistake, you're OK.
Officially, i'm not a mathematic expert when i did put above.
> but I guess it's not very useful---why not to remove expand(...) when it's not
> > factor(expand((sqrt(x+a)+b)^10));
> > i got once the imprecise solution
> > 10 b x^4 sqrt(x+a) + 120 b^3 x^3 sqrt(x+a) + ... + 45 a^4 b^2 + a^5
> > but i got many times (sqrt(x+a)+b)^10 .
> > I think that the maxima system uses memoization that remember some internal
> > answers of previous computations but it's non-deterministic.
> Maybe you just have removed expand(...)?
No, no, i didn't remove expand(...)!
I did put exactly factor(expand((sqrt(x+a)+b)^10)) and
maxima did strange computations using Haible's
common lisp when i repeated many times the same formula.
Maxima 5.14.0 http://maxima.sourceforge.net
Using Lisp CLISP 2.41 (2006-10-13)
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.
(%o1) (x + b + a)
4 3 3 3
(%o2) 10 b x sqrt(x + a) + 120 b x sqrt(x + a) + 40 a b x sqrt(x + a)
5 2 3 2 2 2
+ 252 b x sqrt(x + a) + 360 a b x sqrt(x + a) + 60 a b x sqrt(x + a)
7 5 2 3
+ 120 b x sqrt(x + a) + 504 a b x sqrt(x + a) + 360 a b x sqrt(x + a)
3 9 7
+ 40 a b x sqrt(x + a) + 10 b sqrt(x + a) + 120 a b sqrt(x + a)
2 5 3 3 4 5
+ 252 a b sqrt(x + a) + 120 a b sqrt(x + a) + 10 a b sqrt(x + a) + x
2 4 4 4 3 2 3 2 3 6 2
+ 45 b x + 5 a x + 210 b x + 180 a b x + 10 a x + 210 b x
4 2 2 2 2 3 2 8 6 2 4
+ 630 a b x + 270 a b x + 10 a x + 45 b x + 420 a b x + 630 a b x
3 2 4 10 8 2 6 3 4 4 2 5
+ 180 a b x + 5 a x + b + 45 a b + 210 a b + 210 a b + 45 a b + a
(%i2) the same above
(%o2) the same above
(%i9) the same above
(%o9) the same above
but if i put sqrt2 instead of sqrt then the symbolic computation is "different":
(%o10) (sqrt2(x + a) + b)
It demonstrates that there is some strange symbolic computation.
> factor(expand((sqrt(x+a)+b)^10)) =>
> 10*b*x^4*sqrt(x+a) + 120*b^3*x^3*sqrt(x+a) + ...,
> factor(sqrt(x+a)+b)^10) =>
> Alexey Beshenov <al at beshenov.ru>
I'm still waiting the answer of
and the top says ~79 MB at 10:00 minutes of lisp.run,
~106 MB at 16:00 minutes of lisp.run, ... and
still running for only the above simple formula.
But i aborted it with Ctrl-C due to its excess time.
Maxima encountered a Lisp error:
Ctrl-C: User break
To reenable the Lisp debugger set *debugger-hook* to nil.
If i remove the expression "-z" then it solved in few seconds:
(%o12) (y - x)
More information about the Maxima