Symata runs in either the ipython (Jupyter) notebook or the Julia REPL (or even in a dumb terminal). In the Julia REPL two output styles are available, InputForm
and UnicodeForm
. In the notebook, a third style, called JupyterForm
, is available. The notebook starts with the JupyterForm
style.
In [1]:
using Symata # load the package and enter Symata mode
In [2]:
Integrate(f(x+I),[x,0,Infinity]) # input is interpreted as Symata code
Out[2]:
Here is the same thing in InputForm
style
In [3]:
OutputStyle(InputForm)
Out(2)
Out[3]:
In UnicodeForm
style, some of the symbols are pretty printed.
In [4]:
OutputStyle(UnicodeForm)
Out(2)
Out[4]:
In [5]:
Assume(a, Positive)
Integrate(E^(-x) * x^(a-1), [x,0,Infinity])
Out[5]:
In InputForm
style
In [6]:
OutputStyle(InputForm)
Out(5)
Out[6]:
And back to JupyterForm
style
In [7]:
OutputStyle(JupyterForm)
Out(5)
Out[7]:
In [8]:
OutputStyle(InputForm), Expand((x+y)^3)
Out[8]:
In [9]:
FullForm(Out(8)) # Internal form of the previous output
Out[9]:
In [10]:
Plus(Power(x,3),Times(3,Power(x,2),y),Times(3,x,Power(y,2)),Power(y,3)) # This is also valid input
Out[10]:
Compare this to JupyterForm
output style which cannot in general be copied as input.
In [11]:
OutputStyle(JupyterForm);
Integrate(g(x), [x,0,Infinity])
Out[11]:
This is what we get by cutting and pasting from the typset integral in Out[12]: ∫∞0g(x)𝕕x. Not valid input. But, you can still refer to the output cell:
In [12]:
g(x_) := Exp(-x)
Out(11)
Out[12]:
In InputForm
style, you can make the output more compact or less compact like this:
In [13]:
OutputStyle(InputForm), CompactOutput(False), Out(10)
Out[13]:
In [14]:
CompactOutput(True), Out(10)
Out[14]:
In [15]:
OutputStyle(JupyterForm), (1/2 + a^b)/(x+y)
Out[15]:
In [16]:
Sum(g(i,j), [i,0,Infinity], [j,0,Infinity]) + Sum(h(i,j), [i,0,Infinity], [j,1,n])
Out[16]:
In [17]:
Integrate(g(x,y), [x,0,1], [y,0,1])
Out[17]:
In [18]:
a < b < c/d
Out[18]:
To cut and past from Jupyter to another application, right click on the displayed output. Then choose from the menu which format you like, such as the $\LaTeX$ source. (You can also choose math display options here)
To get an expression that can be cut and pasted as Symata
input, say to text editor, you can either switch formats using OutputStyle(InputForm)
, or wrap a single expression in InputForm
.
In [19]:
InputForm( a< b < c/d )
Out[19]:
Unicode input is inherited from Julia and the ipython/Jupyter notebook. In both the REPL and the notebook, you can enter a $\LaTeX$ macro and hit TAB
to convert it to a symbol. For instance, \alpha[TAB]
gives α. You can also copy/paste unicode symbols into the notebook.
A few symbols, such as π, are intepreted as builtin Symata symbols.
In [20]:
OutputStyle(InputForm);
In [21]:
[π + 𝕖 + 𝕚 + a, Pi + E + I + a] # \pi + \Bbbe + \Bbbi
Out[21]:
In [22]:
OutputStyle(UnicodeForm);
In [23]:
[π + 𝕖 + 𝕚 + a, Pi + E + I + a]
Out[23]:
In [24]:
OutputStyle(JupyterForm);
In [25]:
[π + 𝕖 + 𝕚 + a, Pi + E + I + a]
Out[25]:
Pi
and π, etc. refer to the same symbol.
In [26]:
[Pi == π, E == 𝕖, I == 𝕚, EulerGamma == γ, Gamma == Γ]
Out[26]:
In [27]:
Cos([Pi, π])
Out[27]:
In Symata
, in both the command line REPL and IJulia
, you can use TAB completion to complete built-in symbols, in the same way that you do in Julia
. In IJulia
, typing Shift-TAB
when the cursor is at the end of a built-in symbol displays a pop-up with the doc string, if available.
You can get the same doc string (and the corresponding sympy
document) by typing ?
followed by the symbol.
In [28]:
? OutputStyle