#4948 closed enhancement (fixed)
[with patch, positive review] implement the transfer of Mathematica lists back to Sage
Reported by: | mabshoff | Owned by: | was |
---|---|---|---|
Priority: | major | Milestone: | sage-4.1.2 |
Component: | interfaces | Keywords: | |
Cc: | jason | Merged in: | Sage 4.1.2.alpha2 |
Authors: | Felix Lawrence | Reviewers: | William Stein, Minh Van Nguyen |
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Make the following work:
---------------------------------------------------------------------- | Sage Version 3.2.3, Release Date: 2009-01-05 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: slist = [1,2,3] sage: mathematica(slist) {1, 2, 3} sage: list(mathematica(slist)) --------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last) /home/mabshoff/.sage/temp/sage/11670/_home_mabshoff__sage_init_sage_0.py in <module>() ----> 1 2 3 4 5 /usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.pyc in __len__(self) 1345 1346 def __len__(self): -> 1347 raise NotImplementedError 1348 1349 def __reduce__(self): NotImplementedError:
Attachments (2)
Change History (12)
comment:1 Changed 12 years ago by
- Cc jason added
comment:2 Changed 12 years ago by
- Milestone changed from sage-3.4 to sage-3.4.1
Changed 12 years ago by
comment:3 Changed 12 years ago by
- Summary changed from implement the transfer of Mathematica lists back to Sage to [with patch, needs review] implement the transfer of Mathematica lists back to Sage
The patch I just attached does a little more than the scope of this ticket - it also gets mmalist.sage() working, as well as allowing import of floats with exponents (e.g. 4.5e80) from both mathematica and GP (plus it lays the groundwork for importing nonstandard exponent notation from other programs too).
comment:4 Changed 11 years ago by
- Summary changed from [with patch, needs review] implement the transfer of Mathematica lists back to Sage to [with patch, positive review] implement the transfer of Mathematica lists back to Sage
Great work! I hope you'll do more to improve the Sage /Mathematica interface. Thanks!
comment:5 Changed 11 years ago by
What about doctest for this function in sage/interfaces/expect.py
?
1142 def _exponent_symbol(self): 1143 """ 1144 Return the symbol used to denote *10^ in floats, e.g 'e' in 1.5e6 1145 """ 1146 return 'e'
comment:6 Changed 11 years ago by
- Summary changed from [with patch, positive review] implement the transfer of Mathematica lists back to Sage to [with patch, needs work] implement the transfer of Mathematica lists back to Sage
comment:7 Changed 11 years ago by
- Component changed from misc to interfaces
- Owner changed from cwitty to was
- Summary changed from [with patch, needs work] implement the transfer of Mathematica lists back to Sage to [with patch, partial positive review, needs review] implement the transfer of Mathematica lists back to Sage
I added the requested doctest for the generic _exponent_symbol(), a method that is meant to be overloaded by each derived class (i.e. the interface to gp, mathematica, etc). Since this is meant to be overloaded by each of the interfaces, I didn't use any existing interface in this doctest, as when _exponent_symbol() was overloaded by that interface the doctest would become misleading. Instead I created a fake interface so that the doctest would always call the correct version of _exponent_symbol. It's a bit messy but it's the most stable way of doctesting the function that I could think of.
The approach could be taken to write doctests for the rest of the methods in the Expect class.
comment:8 Changed 11 years ago by
- Merged in set to Sage 4.1.2.alpha2
- Resolution set to fixed
- Reviewers set to William Stein, Minh Van Nguyen
- Status changed from new to closed
- Summary changed from [with patch, partial positive review, needs review] implement the transfer of Mathematica lists back to Sage to [with patch, positive review] implement the transfer of Mathematica lists back to Sage
Merged patches in this order:
trac-4948-mathematica_lists.patch
trac-4948-mathematica_lists 12660.patch
comment:9 Changed 11 years ago by
comment:10 Changed 11 years ago by
N.B. the doctests introduced by the above patches fail on 32-bit systems - see #6999.
Jason comments:
Cheers,
Michael