Symata
. Switch to the development version with Pkg.checkout("Symata")
. Switch back to the latest version with Pkg.free("Symata")
¶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, Plain
and Unicode
. In the notebook, a third style, called IJulia
, is available. The notebook starts with the IJulia
style.
using Symata; isymata() # load the package and enter Symata mode
Integrate(f(x+I),[x,0,Infinity]) # input is interpreted as Symata code
Here is the same thing in Plain
style
OutputStyle(Plain), Out(2)
Integrate(f(I + x),[x,0,Infinity])
In Unicode
style, some of the symbols are pretty printed.
OutputStyle(Unicode), Out(2)
Integrate(f(𝕚 + x),[x,0,∞])
Assume(a, Positive), Integrate(E^(-x) * x^(a-1), [x,0,Infinity])
Γ(a)
In Plain
style
OutputStyle(Plain), Out(5)
Gamma(a)
And back to IJulia
style
OutputStyle(IJulia), Out(5)
Plain
style output is closest to the internal form of the expression. It can be copied and pasted as input. (This is also true of Unicode
style)
OutputStyle(Plain),Expand((x+y)^3)
x^3 + 3(x^2)*y + 3x*(y^2) + y^3
FullForm(Out(8)) # Internal form of the previous output
Plus(Power(x,3),Times(3,Power(x,2),y),Times(3,x,Power(y,2)),Power(y,3))
Plus(Power(x,3),Times(3,Power(x,2),y),Times(3,x,Power(y,2)),Power(y,3)) # This is also valid input
x^3 + 3(x^2)*y + 3x*(y^2) + y^3
Compare this to IJulia
output style which cannot in general be copied as input.
OutputStyle(IJulia);
Integrate(g(x), [x,0,Infinity])
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:
( g(x_) := Exp(-x), Out(12) )
In Plain
style, you can make the output more compact or less compact like this:
(OutputStyle(Plain), CompactOutput(False), Out(10))
x^3 + 3(x^2) * y + 3x * (y^2) + y^3
CompactOutput(True), Out(10)
x^3 + 3(x^2)*y + 3x*(y^2) + y^3
Here are some examples of formatting with IJulia
output style
OutputStyle(IJulia), (1/2 + a^b)/(x+y)
Sum(g(i,j), [i,0,Infinity], [j,0,Infinity]) + Sum(h(i,j), [i,0,Infinity], [j,1,n])
Integrate(g(x,y), [x,0,1], [y,0,1])
a < b < c/d
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.
OutputStyle(Plain);
[π + 𝕖 + 𝕚 + a, Pi + E + I + a] # \pi + \Bbbe + \Bbbi
[I + a + E + Pi,I + a + E + Pi]
OutputStyle(Unicode);
[π + 𝕖 + 𝕚 + a, Pi + E + I + a]
[𝕚 + a + 𝕖 + π,𝕚 + a + 𝕖 + π]
OutputStyle(IJulia);
[π + 𝕖 + 𝕚 + a, Pi + E + I + a]
Pi
and π, etc. refer to the same symbol.
[Pi == π, E == 𝕖, I == 𝕚, EulerGamma == γ, Gamma == Γ]
Cos([Pi, π])
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.
? OutputStyle
OutputStyle(Plain)
print plain 1d text output.
OutputStyle(Unicode)
print 1d text output with pretty unicode characters.
OutputStyle(IJulia)
in IJulia, print in typeset mathematics style using latex.
OutputStyle()
return the current output style.
Plain
and Unicode
give output that is valid Symata
input for the same expression.
Help( OutputStyle) See also CompactOutput. Attributes(OutputStyle) = [Protected]