Ticket #13011 (closed defect: fixed)

Opened 12 months ago

Last modified 11 months ago

several optional tests fail in the sage/mathematica interface with mathematica 8.0

Reported by: was Owned by: was
Priority: major Milestone: sage-5.1
Component: interfaces Keywords: sd40.5
Cc: Work issues:
Report Upstream: N/A Reviewers: Mike Hansen, Volker Braun
Authors: William Stein Merged in: sage-5.1.beta5
Dependencies: Stopgaps:

Description (last modified by vbraun) (diff)

On OS X 10.7 with the newest version of Mathematica (8.0), several optional tests fail, probably due to changes in mathematica. Fix this, since with the optional tests, we aim at having the tests work in the latest released version (since that is stable).

blastoff:interfaces wstein$ sage -t -optional mathematica.py 
sage -t -optional "devel/sage-main/sage/interfaces/mathematica.py"
**********************************************************************
File "/Users/wstein/sage/build/sage-5.0/devel/sage-main/sage/interfaces/mathematica.py", line 128:
    sage: sys.Solve('{x, y}')               # optional - mathematica
Expected:
    {{y -> -1, x -> 0}, {y -> 11, x -> 6}}
Got:
    {{x -> 0, y -> -1}, {x -> 6, y -> 11}}
**********************************************************************
File "/Users/wstein/sage/build/sage-5.0/devel/sage-main/sage/interfaces/mathematica.py", line 152:
    sage: v.Solve(['x', 'y'])               # optional - mathematica
Expected:
    {{y -> -1, x -> 0}, {y -> 11, x -> 6}}
Got:
    {{x -> 0, y -> -1}, {x -> 6, y -> 11}}
**********************************************************************
File "/Users/wstein/sage/build/sage-5.0/devel/sage-main/sage/interfaces/mathematica.py", line 270:
    sage: print n                   # optional - mathematica
Expected:
                  1.5707963267948966192313216916397514420985846996876
Got:
    1.5707963267949
**********************************************************************
File "/Users/wstein/sage/build/sage-5.0/devel/sage-main/sage/interfaces/mathematica.py", line 315:
    sage: math_bessel_K(2,I)                      # optional - mathematica
Exception raised:
    Traceback (most recent call last):
      File "/Users/wstein/sage/build/sage-5.0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/Users/wstein/sage/build/sage-5.0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/Users/wstein/sage/build/sage-5.0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_0[75]>", line 1, in <module>
        math_bessel_K(Integer(2),I)                      # optional - mathematica###line 315:
    sage: math_bessel_K(2,I)                      # optional - mathematica
      File "<doctest __main__.example_0[74]>", line 2, in math_bessel_K
        return mathematica(nu).BesselK(x).N(Integer(20))
      File "element.pyx", line 634, in sage.structure.element.Element.numerical_approx (sage/structure/element.c:4983)
      File "/Users/wstein/sage/build/sage-5.0/local/lib/python/site-packages/sage/misc/functional.py", line 1286, in numerical_approx
        return sage.rings.complex_field.ComplexField(prec)(x)
      File "/Users/wstein/sage/build/sage-5.0/local/lib/python/site-packages/sage/rings/complex_field.py", line 277, in __call__
        return Parent.__call__(self, x)
      File "parent.pyx", line 1058, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:7941)
      File "coerce_maps.pyx", line 82, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3345)
      File "coerce_maps.pyx", line 77, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3248)
      File "/Users/wstein/sage/build/sage-5.0/local/lib/python/site-packages/sage/rings/complex_field.py", line 308, in _element_constructor_
        return complex_number.ComplexNumber(self, x)
      File "complex_number.pyx", line 165, in sage.rings.complex_number.ComplexNumber.__init__ (sage/rings/complex_number.c:3464)
    TypeError: unable to coerce to a ComplexNumber: <class 'sage.interfaces.mathematica.MathematicaElement'>
**********************************************************************
1 items had failures:
   4 of  85 in __main__.example_0
***Test Failed*** 4 failures.
For whitespace errors, see the file /Users/wstein/.sage//tmp/mathematica_95798.py
	 [5.1 s]
 
----------------------------------------------------------------------
The following tests failed:


	sage -t -optional "devel/sage-main/sage/interfaces/mathematica.py"
Total time for all tests: 5.1 seconds
blastoff:interfaces wstein$ 

Apply

Attachments

trac_13011.patch Download (1.8 KB) - added by was 12 months ago.
trac_13011-part2.patch Download (917 bytes) - added by was 12 months ago.

Change History

comment:1 Changed 12 months ago by was

  • Keywords sd40.5 added

Changed 12 months ago by was

comment:2 Changed 12 months ago by was

  • Status changed from new to needs_review

I have Mathematica 8 on my laptop if you want to see this work.

comment:3 Changed 12 months ago by was

Note -- in the patch I fixed a very serious bug with ".N()" that was introduced into Sage a year or two ago.

comment:4 Changed 12 months ago by mhansen

  • Reviewers set to Mike Hansen
  • Authors set to William Stein

You need to mark the N() tests as optional, otherwise looks good.

comment:5 Changed 12 months ago by mhansen

  • Status changed from needs_review to needs_work

Changed 12 months ago by was

comment:6 Changed 12 months ago by was

  • Status changed from needs_work to needs_review

comment:7 Changed 12 months ago by vbraun

  • Status changed from needs_review to positive_review
  • Reviewers changed from Mike Hansen to Mike Hansen, Volker Braun
  • Description modified (diff)

Let's Get That Money!

comment:8 Changed 11 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-5.1.beta5
Note: See TracTickets for help on using tickets.