#8731: update/upgrade maxima to latest upstream (5.21.1)
---------------------------+------------------------------------------------
Reporter: jason | Owner: tbd
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.4.2
Component: packages | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------+------------------------------------------------
Changes (by jason):
* cc: mhansen (added)
* status: needs_review => needs_work
Comment:
The doctests that still fail after the patch is applied (under ptestlong)
are listed below:
I couldn't find a way to double-check that the new answer is correct in
the following output mismatch
{{{
sage -t -long "4.4.1/devel/sage/sage/symbolic/integration/integral.py"
**********************************************************************
File
"/home/grout/sage-4.4.1/devel/sage/sage/symbolic/integration/integral.py",
line 464:
sage: integrate(sin(x)*cos(10*x)*log(x), x)
Expected:
1/18*log(x)*cos(9*x) - 1/22*log(x)*cos(11*x) -
1/18*integrate(cos(9*x)/x, x) + 1/22*integrate(cos(11*x)/x, x)
Got:
1/198*(11*cos(9*x) - 9*cos(11*x))*log(x) + 1/44*Ei(-11*I*x) -
1/36*Ei(-9*I*x) - 1/36*Ei(9*I*x) + 1/44*Ei(11*I*x)
**********************************************************************
}}}
The next doctest is testing that #780 is fixed. Here, it appears that
#780 is *not* fixed again. However, the actual maxima bug that was fixed
for #780 is still fixed. The problem seems to be that we use keepfloat:
true, and when we have keepfloat: true, the erroneous question pops up.
{{{
File
"/home/grout/sage-4.4.1/devel/sage/sage/symbolic/integration/integral.py",
line 486:
sage: res = integral(f,x,0.0001414, 1.); res
Exception raised:
Traceback (most recent call last):
File "/home/grout/sage/local/bin/ncadoctest.py", line 1231, in
run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/grout/sage/local/bin/sagedoctest.py", line 38, in
run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File "/home/grout/sage/local/bin/ncadoctest.py", line 1172, in
run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_10[56]>", line 1, in <module>
res = integral(f,x,RealNumber('0.0001414'), RealNumber('1.'));
res###line 486:
sage: res = integral(f,x,0.0001414, 1.); res
File "/home/grout/sage/local/lib/python/site-
packages/sage/misc/functional.py", line 720, in integral
return x.integral(*args, **kwds)
File "expression.pyx", line 7330, in
sage.symbolic.expression.Expression.integral
(sage/symbolic/expression.cpp:29048)
File "/home/grout/sage/local/lib/python/site-
packages/sage/symbolic/integration/integral.py", line 589, in integrate
return definite_integral(expression, v, a, b)
File "function.pyx", line 425, in
sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4359)
File "/home/grout/sage/local/lib/python/site-
packages/sage/symbolic/integration/integral.py", line 174, in _eval_
return integrator(*args)
File "/home/grout/sage/local/lib/python/site-
packages/sage/symbolic/integration/external.py", line 21, in
maxima_integrator
result = expression._maxima_().integrate(v, a, b)
File "/home/grout/sage/local/lib/python/site-
packages/sage/interfaces/maxima.py", line 2112, in integral
return I(var, min, max)
File "/home/grout/sage/local/lib/python/site-
packages/sage/interfaces/expect.py", line 1408, in __call__
return self._obj.parent().function_call(self._name, [self._obj] +
list(args), kwds)
File "/home/grout/sage/local/lib/python/site-
packages/sage/interfaces/expect.py", line 1316, in function_call
return self.new(s)
File "/home/grout/sage/local/lib/python/site-
packages/sage/interfaces/expect.py", line 1097, in new
return self(code)
File "/home/grout/sage/local/lib/python/site-
packages/sage/interfaces/expect.py", line 1032, in __call__
return cls(self, x, name=name)
File "/home/grout/sage/local/lib/python/site-
packages/sage/interfaces/expect.py", line 1451, in __init__
raise TypeError, x
TypeError: Computation failed since Maxima requested additional
constraints (try the command 'assume((y-1)*(y+1)>0)' before integral or
limit evaluation, for example):
Is (y-1)*(y+1) positive, negative, or zero?
}}}
Here is a maxima session (5.21.1) showing the problem. When keepfloat is
false, an integral comes right back
{{{
% sage -maxima
;;; Loading #P"/home/grout/sage/local/lib/ecl/sb-bsd-sockets.fas"
;;; Loading #P"/home/grout/sage/local/lib/ecl/sockets.fas"
;;; Loading #P"/home/grout/sage/local/lib/ecl/defsystem.fas"
;;; Loading #P"/home/grout/sage/local/lib/ecl/cmp.fas"
;;; Loading #P"/home/grout/sage/local/lib/ecl/sysfun.lsp"
Maxima 5.21.1 http://maxima.sourceforge.net
using Lisp ECL 10.4.1
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) assume(y^2>1);
2
(%o1) [y > 1]
(%i2) keepfloat: true;
(%o2) true
(%i3) integrate(log(x^2+y^2),x,0,1);
2 1
2 log(y + 1) + 4 atan(-) y - 4
y
(%o3) -------------------------------
2
(%i4) integrate(log(x^2+y^2),x,0.0001414,1);
Is (y - 1) (y + 1) positive, negative, or zero?
}}}
There is some output mismatch in transform.pyx. This occurs in an
explanatory section of the docs, and just consists of simplifying a
horrendous matrix. The matrix just simplifies differently now (we get
explicit imaginary values now, for some reason). Does anyone want to
check that the simplifications are actually correct now?
{{{
sage -t -long "4.4.1/devel/sage/sage/plot/plot3d/transform.pyx"
**********************************************************************
File "/home/grout/sage-4.4.1/devel/sage/sage/plot/plot3d/transform.pyx",
line 217:
sage: m
Expected:
[ -(cos(theta) - 1)*x^2 +
cos(theta) -(cos(theta) - 1)*sqrt(-x^2 - z^2 + 1)*x -
sqrt(z^2)*sin(theta) -((cos(theta) - 1)*x*z^2 - sqrt(-x^2 - z^2 +
1)*sqrt(z^2)*sin(theta))/z]
[ -(cos(theta) - 1)*sqrt(-x^2 - z^2 + 1)*x +
sqrt(z^2)*sin(theta) (cos(theta) - 1)*x^2
+ (cos(theta) - 1)*z^2 + 1 -((cos(theta) - 1)*sqrt(-x^2 - z^2 +
1)*sqrt(z^2)*z + x*z*sin(theta))/sqrt(z^2)]
[ -((cos(theta) - 1)*x*z^2 + sqrt(-x^2 - z^2 +
1)*sqrt(z^2)*sin(theta))/z -((cos(theta) - 1)*sqrt(-x^2 - z^2 +
1)*sqrt(z^2)*z - x*z*sin(theta))/sqrt(z^2)
-(cos(theta) - 1)*z^2 + cos(theta)]
Got:
[
-(cos(theta) - 1)*x^2 + cos(theta) -((cos(theta) -
1)*sqrt(-x^2 + 1)*sqrt(-x^2 - z^2 + 1)*x*sqrt(z^(-2)) - I*sqrt(x^2 -
1)*sin(theta))*sqrt(z^2)/sqrt(-x^2 + 1) -((cos(theta) -
1)*sqrt(-x^2 + 1)*x*z^2*sqrt(z^(-2)) + I*sqrt(x^2 - 1)*sqrt(-x^2 - z^2 +
1)*sin(theta))*sqrt(z^2)/(sqrt(-x^2 + 1)*z)]
[ -((cos(theta) - 1)*sqrt(-x^2 + 1)*sqrt(-x^2 - z^2 +
1)*x*sqrt(z^(-2)) + I*sqrt(x^2 - 1)*sin(theta))*sqrt(z^2)/sqrt(-x^2 + 1)
(cos(theta) - 1)*x^2 + (cos(theta) - 1)*z^2 + 1 (sqrt(-x^2 + 1)*sqrt(x^2
- 1)*x*z*sqrt(z^(-2))*sin(theta) - sqrt(-x^2 - z^2 + 1)*((I*cos(theta) -
I)*x^2 - I*cos(theta) + I)*z)/(I*x^2 - I)]
[ -((cos(theta) - 1)*sqrt(-x^2 + 1)*x*z^2*sqrt(z^(-2)) -
I*sqrt(x^2 - 1)*sqrt(-x^2 - z^2 + 1)*sin(theta))*sqrt(z^2)/(sqrt(-x^2 +
1)*z) -(sqrt(-x^2 + 1)*sqrt(x^2 - 1)*x*z*sqrt(z^(-2))*sin(theta) +
sqrt(-x^2 - z^2 + 1)*((I*cos(theta) - I)*x^2 - I*cos(theta) + I)*z)/(I*x^2
- I)
-(cos(theta) - 1)*z^2 + cos(theta)]
**********************************************************************
}}}
There are a few errors in the interfaces/maxima.py file. These seem to
all stem from more output, rather than actual errors.
{{{
sage -t -long "4.4.1/devel/sage/sage/interfaces/maxima.py"
**********************************************************************
File "/home/grout/sage-4.4.1/devel/sage/sage/interfaces/maxima.py", line
871:
sage: maxima._command_runner('describe', 'gcd')
Expected:
-- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
...
Got:
;;; Loading #P"/home/grout/sage/local/lib/ecl/cmp.fas"
;;; Loading #P"/home/grout/sage/local/lib/ecl/sysfun.lsp"
<BLANKLINE>
-- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
Returns the greatest common divisor of <p_1> and <p_2>. The flag
`gcd' determines which algorithm is employed. Setting `gcd' to
`ez', `subres', `red', or `spmod' selects the `ezgcd',
subresultant `prs', reduced, or modular algorithm, respectively.
If `gcd' `false' then `gcd (<p_1>, <p_2>, <x>)' always returns 1
for all <x>. Many functions (e.g. `ratsimp', `factor', etc.)
cause gcd's to be taken implicitly. For homogeneous polynomials
it is recommended that `gcd' equal to `subres' be used. To take
the gcd when an algebraic is present, e.g., `gcd (<x>^2 -
2*sqrt(2)*<x> + 2, <x> - sqrt(2))', `algebraic' must be `true'
and
`gcd' must not be `ez'.
<BLANKLINE>
The `gcd' flag, default: `spmod', if `false' will also prevent
the
greatest common divisor from being taken when expressions are
converted to canonical rational expression (CRE) form. This will
sometimes speed the calculation if gcds are not required.
<BLANKLINE>
<BLANKLINE>
There are also some inexact matches for `gcd'.
Try `?? gcd' to see them.
<BLANKLINE>
true
<BLANKLINE>
**********************************************************************
File "/home/grout/sage-4.4.1/devel/sage/sage/interfaces/maxima.py", line
896:
sage: maxima.help('gcd')
Expected:
-- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
...
Got:
;;; Loading #P"/home/grout/sage/local/lib/ecl/cmp.fas"
;;; Loading #P"/home/grout/sage/local/lib/ecl/sysfun.lsp"
<BLANKLINE>
-- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
Returns the greatest common divisor of <p_1> and <p_2>. The flag
`gcd' determines which algorithm is employed. Setting `gcd' to
`ez', `subres', `red', or `spmod' selects the `ezgcd',
subresultant `prs', reduced, or modular algorithm, respectively.
If `gcd' `false' then `gcd (<p_1>, <p_2>, <x>)' always returns 1
for all <x>. Many functions (e.g. `ratsimp', `factor', etc.)
cause gcd's to be taken implicitly. For homogeneous polynomials
it is recommended that `gcd' equal to `subres' be used. To take
the gcd when an algebraic is present, e.g., `gcd (<x>^2 -
2*sqrt(2)*<x> + 2, <x> - sqrt(2))', `algebraic' must be `true'
and
`gcd' must not be `ez'.
<BLANKLINE>
The `gcd' flag, default: `spmod', if `false' will also prevent
the
greatest common divisor from being taken when expressions are
converted to canonical rational expression (CRE) form. This will
sometimes speed the calculation if gcds are not required.
<BLANKLINE>
<BLANKLINE>
There are also some inexact matches for `gcd'.
Try `?? gcd' to see them.
<BLANKLINE>
true
<BLANKLINE>
**********************************************************************
File "/home/grout/sage-4.4.1/devel/sage/sage/interfaces/maxima.py", line
906:
sage: maxima.example('arrays')
Expected:
a[n]:=n*a[n-1]
a := n a
n n - 1
a[0]:1
a[5]
120
a[n]:=n
a[6]
6
a[4]
24
done
Got:
;;; Loading #P"/home/grout/sage/local/lib/ecl/cmp.fas"
;;; Loading #P"/home/grout/sage/local/lib/ecl/sysfun.lsp"
a[n]:=n*a[n-1]
a := n a
n n - 1
a[0]:1
a[5]
120
a[n]:=n
a[6]
6
a[4]
24
done
<BLANKLINE>
**********************************************************************
File "/home/grout/sage-4.4.1/devel/sage/sage/interfaces/maxima.py", line
2384:
sage: m.gcd._sage_doc_()
Expected:
-- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
...
Got:
;;; Loading #P"/home/grout/sage/local/lib/ecl/cmp.fas"
;;; Loading #P"/home/grout/sage/local/lib/ecl/sysfun.lsp"
<BLANKLINE>
-- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
Returns the greatest common divisor of <p_1> and <p_2>. The flag
`gcd' determines which algorithm is employed. Setting `gcd' to
`ez', `subres', `red', or `spmod' selects the `ezgcd',
subresultant `prs', reduced, or modular algorithm, respectively.
If `gcd' `false' then `gcd (<p_1>, <p_2>, <x>)' always returns 1
for all <x>. Many functions (e.g. `ratsimp', `factor', etc.)
cause gcd's to be taken implicitly. For homogeneous polynomials
it is recommended that `gcd' equal to `subres' be used. To take
the gcd when an algebraic is present, e.g., `gcd (<x>^2 -
2*sqrt(2)*<x> + 2, <x> - sqrt(2))', `algebraic' must be `true'
and
`gcd' must not be `ez'.
<BLANKLINE>
The `gcd' flag, default: `spmod', if `false' will also prevent
the
greatest common divisor from being taken when expressions are
converted to canonical rational expression (CRE) form. This will
sometimes speed the calculation if gcds are not required.
<BLANKLINE>
<BLANKLINE>
There are also some inexact matches for `gcd'.
Try `?? gcd' to see them.
<BLANKLINE>
true
<BLANKLINE>
**********************************************************************
File "/home/grout/sage-4.4.1/devel/sage/sage/interfaces/maxima.py", line
2395:
sage: maxima.gcd._sage_doc_()
Expected:
-- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
...
Got:
;;; Loading #P"/home/grout/sage/local/lib/ecl/cmp.fas"
;;; Loading #P"/home/grout/sage/local/lib/ecl/sysfun.lsp"
<BLANKLINE>
-- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
Returns the greatest common divisor of <p_1> and <p_2>. The flag
`gcd' determines which algorithm is employed. Setting `gcd' to
`ez', `subres', `red', or `spmod' selects the `ezgcd',
subresultant `prs', reduced, or modular algorithm, respectively.
If `gcd' `false' then `gcd (<p_1>, <p_2>, <x>)' always returns 1
for all <x>. Many functions (e.g. `ratsimp', `factor', etc.)
cause gcd's to be taken implicitly. For homogeneous polynomials
it is recommended that `gcd' equal to `subres' be used. To take
the gcd when an algebraic is present, e.g., `gcd (<x>^2 -
2*sqrt(2)*<x> + 2, <x> - sqrt(2))', `algebraic' must be `true'
and
`gcd' must not be `ez'.
<BLANKLINE>
The `gcd' flag, default: `spmod', if `false' will also prevent
the
greatest common divisor from being taken when expressions are
converted to canonical rational expression (CRE) form. This will
sometimes speed the calculation if gcds are not required.
<BLANKLINE>
<BLANKLINE>
There are also some inexact matches for `gcd'.
Try `?? gcd' to see them.
<BLANKLINE>
true
<BLANKLINE>
}}}
Finally, I'm not sure what is happening in this error:
{{{
**********************************************************************
File "/home/grout/sage-4.4.1/devel/sage/sage/interfaces/maxima.py", line
729:
sage: maxima.eval('sage0: x == x;')
Expected:
Traceback (most recent call last):
...
TypeError: error evaluating "sage0: x == x;":...
Got:
'x'
**********************************************************************
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8731#comment:22>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.