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])
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)
gammaint = Integrate(E^(-x) * x^(a-1), [x,0,Infinity])
Out[5]:
In InputForm
style
In [6]:
OutputStyle(InputForm)
gammaint
Out[6]:
And back to JupyterForm
style
In [7]:
OutputStyle(JupyterForm)
gammaint
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]:
In [20]:
N(Pi)
Out[20]:
In [21]:
N(Pi) * 10^10
Out[21]:
In [22]:
FloatFormat(Short);
In [23]:
N(Pi)
Out[23]:
In [24]:
N(Pi) * 10^10
Out[24]:
Print three digits
In [25]:
FloatFormat(3);
In [26]:
N(Pi)
Out[26]:
In [27]:
N(Pi) * 10^10
Out[27]:
Changing the number of digits printed does not change the precision of the number.
In [28]:
Precision(N(Pi))
Out[28]:
The format of BigFloat numbers is not affected by FloatFormat
In [29]:
N(Pi,50)
Out[29]:
Use BigFloatFormat
for this
In [30]:
BigFloatFormat(Short);
In [31]:
N(Pi,50)
Out[31]:
In [32]:
Precision(N(Pi,50))
Out[32]:
In [33]:
FloatFormat(Full);
In [34]:
N(Pi)
Out[34]:
In [35]:
BigFloatFormat(Full);
In [36]:
N(Pi,50)
Out[36]:
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 [37]:
OutputStyle(InputForm);
In [38]:
[π + 𝕖 + 𝕚 + a, Pi + E + I + a] # \pi + \Bbbe + \Bbbi
Out[38]:
In [39]:
OutputStyle(UnicodeForm);
In [40]:
[π + 𝕖 + 𝕚 + a, Pi + E + I + a]
Out[40]:
In [41]:
OutputStyle(JupyterForm);
In [42]:
[π + 𝕖 + 𝕚 + a, Pi + E + I + a]
Out[42]:
Pi
and π, etc. refer to the same symbol.
In [43]:
[Pi == π, E == 𝕖, I == 𝕚, EulerGamma == γ, Gamma == Γ]
Out[43]:
In [44]:
Cos([Pi, π])
Out[44]:
In Symata
, in both the command line REPL and IJulia
, you can use TAB completion to complete built-in and user-defined 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. (This feature may be broken in both Julia and Symata)
You can get the same doc string (and the corresponding sympy
document) by typing ?
followed by the symbol.
In [45]:
? OutputStyle
In [46]:
VersionInfo()
In [47]:
InputForm(Now())
Out[47]: