The title of this notebook does not mean "fantastic, amazing things". The title does describe more or less literally the content. Many of the features and commands in Symata will be familiar from other programs. This notebook presents a few things that may be unfamiliar and not documented elsewhere. Also note that many of the "unique" features appear in other tutorial notebooks.
In [1]:
using Symata; isymata() # enter Symata mode
In [2]:
VersionInfo()
In [3]:
? OutputStyle
? prints help on the Help function.
Help(topic), Help("topic"), or ? topic prints documentation for topic.
h"words" does a case insensitive search of the contents of help documents.
Syamta uses the python package SymPy extensivley. Help prints relevant SymPy documentation along with Symata documentation. Type ShowSymPyDocs(False) to disable printing SymPy documentation.
In [ ]:
In [4]:
2^100 # overflow
Out[4]:
In [5]:
? BigIntInput
In [6]:
BigIntInput(True);
In [7]:
2^100
Out[7]:
Note that this only applies to input integers (at the moment)
In [8]:
Head(Cos(Pi))
Out[8]:
In [9]:
Head( BI(Cos(Pi))) # Convert explicitly to BigInt
Out[9]:
Symata's host language is Julia. There are several ways to interact with Julia in a Symata session.
Julia and Symata keep separate lists of symbols. For instance, x may be defined in Julia, but not Symata, and vice versa.
Use SetJ to bind (i.e. set) a Julia symbol to a Symata expression.
In [10]:
expr = x + y
Out[10]:
In [11]:
? SetJ
Bind the Julia variable z to the result of evaluating expr.
In [12]:
SetJ(z , expr)
Out[12]:
Execute Julia code, by enclosing it in :( ). We ask for the value of z.
In [29]:
J( Main.z )
Out[29]:
We can also leave Symata and return to Julia
In [14]:
Julia() # begin interpreting expressions as Julia code. ;
In [15]:
z # Now in Julia
Out[15]:
The unexported Julia function symval returns the Symata binding of a symbol.
In [16]:
? Symata.symval
Out[16]:
In [17]:
Symata.symval(:expr)
Out[17]:
We can do the reverse, set a Symata variable to the value of a Julia variable.
Set a variable in Jula.
In [18]:
a = 1 # Set a Julia symbol (bind an identifier to a value)
Out[18]:
In [19]:
isymata() # Enter Symata mode again
In [20]:
(expr2 = J( Main.a ); expr2)
Out[20]:
Symata symbol expr2 is now set to 1.
Use Symata's help search feature to find commands related to SymPy.
In [21]:
h"sympy"
In [22]:
? SymPyError
For debugging, you can disable converting SymPy objects to Symata.
In [23]:
? ReturnSymPy
In [24]:
? ToSymata
In [25]:
? ToSymPy
Use ToSymPy and ToSymata to convert between the languages.
In [26]:
(OutputStyle(InputForm), pyobj = ToSymPy(Integrate(f(x),x)))
Out[26]:
In [30]:
( OutputStyle(JupyterForm), Head(pyobj))
Out[30]:
Recover the Symata expression.
In [28]:
ToSymata(pyobj)
Out[28]:
In [ ]: