4.9.3 Loading and saving

Mathematica has an excellent InputForm function, which makes saving and loading Mathematica objects possible. The first examples test saving and loading to strings.

sage: x = mathematica(pi/2)
sage: x
Pi/2
sage: loads(dumps(x)) == x
True
sage: n = x.N(50)
sage: n
1.5707963267948966192313216916397514420985846996875529104874722962622    #
32-bit
1.5707963267948966192313216916397514420985846996875529104874722961539081733
4735   # 64-bit
sage: loads(dumps(n)) == n
True

This example illustrates saving to a file in the local directory and to one in the SAGE database directory.

sage: n.save('n')
sage: n.db('n')

Author Log:

Module-level Functions

clean_output( s)

mathematica_console( [readline=True])

reduce_load( X)

Class: Mathematica

class Mathematica
Interface to the Mathematica interpreter.
Mathematica( self, [maxread=None], [script_subdirectory=None], [logfile=], [server=100])

Functions: console,$  $ eval,$  $ function_call,$  $ get,$  $ help,$  $ set,$  $ trait_names

get( self, var)

Get the value of the variable var.

Author Log:

set( self, var, value)

Set the variable var to the given value.

Special Functions: _assign_symbol,$  $ _equality_symbol,$  $ _eval_line,$  $ _false_symbol,$  $ _install_hints,$  $ _keyboard_interrupt,$  $ _left_list_delim,$  $ _object_class,$  $ _read_in_file_command,$  $ _right_list_delim,$  $ _true_symbol

_install_hints( self)

Hints for installing mathematica on your computer.

Author: William Stein and Justin Walker (2006-02-12).

Class: MathematicaElement

class MathematicaElement

Special Functions: __float__,$  $ __getitem__,$  $ __reduce__,$  $ _latex_,$  $ _reduce

Class: MathematicaFunction

class MathematicaFunction

Special Functions: _sage_doc_

Class: MathematicaFunctionElement

class MathematicaFunctionElement

Special Functions: _sage_doc_

See About this document... for information on suggesting changes.