Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#13011 closed defect (fixed)

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: Merged in: sage-5.1.beta5
Authors: William Stein Reviewers: Mike Hansen, Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by chapoton)

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 (2)

trac_13011.patch (1.8 KB) - added by was 7 years ago.
trac_13011-part2.patch (917 bytes) - added by was 7 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by was

  • Keywords sd40.5 added

Changed 7 years ago by was

comment:2 Changed 7 years 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 7 years 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 7 years ago by mhansen

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

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

comment:5 Changed 7 years ago by mhansen

  • Status changed from needs_review to needs_work

Changed 7 years ago by was

comment:6 Changed 7 years ago by was

  • Status changed from needs_work to needs_review

comment:7 Changed 7 years ago by vbraun

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

Let's Get That Money!

comment:8 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.1.beta5
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:9 Changed 4 years ago by chapoton

  • Description modified (diff)
Note: See TracTickets for help on using tickets.