Changeset 7733:90f94138caf3
- Timestamp:
- 12/12/07 10:34:36 (5 years ago)
- Branch:
- default
- Location:
- sage
- Files:
-
- 2 edited
-
interfaces/mathematica.py (modified) (3 diffs)
-
misc/functional.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/interfaces/mathematica.py
r7672 r7733 226 226 FunctionElement, AsciiArtString) 227 227 228 from sage.misc.misc import verbose 228 from sage.misc.misc import verbose, graphics_filename 229 229 230 230 def clean_output(s): … … 390 390 return "}" 391 391 392 ########################################### 393 # System -- change directory, etc 394 ########################################### 395 def chdir(self, dir): 396 """ 397 Change Mathematica's current working directory. 398 399 EXAMPLES: 400 """ 401 self.eval('SetDirectory["%s"]'%dir) 402 392 403 def _true_symbol(self): 393 404 return ' True' … … 454 465 P = self._check_valid() 455 466 return P.get(self._name, ascii_art=True) 467 468 def show(self, filename=None, ImageSize=600): 469 """ 470 Show a mathematica plot in the Sage notebook. 471 472 EXAMPLES: 473 sage: P = mathematica('Plot[Sin[x],{x,-2Pi,4Pi}]') 474 sage: show(P) 475 sage: P.show(ImageSize=800) 476 """ 477 P = self._check_valid() 478 if filename is None: 479 filename = graphics_filename() 480 orig_dir = P.eval('Directory[]').strip() 481 P.chdir(os.path.abspath(".")) 482 s = 'Export["%s", %s, ImageSize->%s]'%(filename, self.name(), ImageSize) 483 P.eval(s) 484 P.chdir(orig_dir) 456 485 457 486 def str(self): -
sage/misc/functional.py
r7471 r7733 29 29 import sage.server.support 30 30 import sage.interfaces.expect 31 import sage.interfaces.mathematica 31 32 32 33 … … 875 876 OPTIONAL INPUT: 876 877 filename -- (default: None) string 878 879 SOME OF THESE MAY APPLY: 877 880 dpi -- dots per inch 878 881 figsize -- [width, height] (same for square aspect) … … 886 889 except AttributeError: 887 890 pass 891 if isinstance(x, sage.interfaces.mathematica.MathematicaElement): 892 return x.show(*args, **kwds) 893 888 894 _do_show(x) 889 895
Note: See TracChangeset
for help on using the changeset viewer.
