Symbolic mathematics language
Passes all test with Julia v0.5.
Branch v0.6-a of Symata works with at least Julia v0.6-rc2, although more slowly and with some features disabled.
Symata is sufficiently complex to make keeping up with changes to Julia an enormous task, requiring much more than simply changing syntax. I won't update Symata until after the Julia API stabilizes with 1.0.
-
a language for symbolic computations and mathematics, where, for the most part, "mathematics" means what it typically does for a scientist or engineer.
-
a language based mostly on expressions, on "evaluating" and rewriting them, like Wolfram, Maple, or Maxima. It is neither a language, nor an extension of a language, that is mostly procedural, or designed around data types and functions, or a hierarchy of classes, etc., like C or Python or Java. Nor is it language like Sage; that is, one meant to provide a unifying interface to a number of mathematics languages with various programming models.
-
meant to be useful to people who do not like to program computers, as well as those who do. The former includes people who prefer not to think about classes, methods, objects, dispatch, stack traces, etc.
Symata is largely modeled on the pattern matching and evaluation sequence of Mathematica. Evaluation, pattern matching, flow control, etc. are written in Julia. Much of the mathematics and symbolic manipulation is achieved by wrapping SymPy. There are more than 500 functions implemented, including integration, transformation of special functions, expression manipulation, writing and reading expressions to and from a file etc. These are the best places for examples and help:
- static snapshots of Symata tutorial notebooks. (If you can't get to the nbviewer link, here is the example directory at github.
- Symata functions written in Symata are here.
- examples are in the test directory (note this is
sjtest
, nottest
) - when running Symata
TAB
completion? Topic
(with completion)h"word"
regular expression search
You can use Symata with Mathematica syntax in addition to the usual Julia-like syntax. To use Mathematica syntax, install the SymataSyntax.jl package.
A few tutorial notebooks can be viewed here. Lower-quality renderings of the same notebooks are in the example directory. These are all snapshots, not live, so you can view them immediately with your browswer.
In order to run the examples in the notebooks, you need to use the development version of Symata
Switch to the development version with Pkg.checkout("Symata")
. (Later, you can return to the latest versioned
branch with Pkg.free("Symata")
.)
Symata is a registered module. It can be installed like this
julia> Pkg.update()
julia> Pkg.add("Symata")
julia> using Symata
symata> Help() # type '=' alone on a line to enter symata mode
Symata
can be installed on Linux, OSX, and Windows, and Julia v0.5, and v0.6.
Symata
depends on the PyCall
package and
the python sympy
module.
When you load Symata
with using Symata
, sympy
is installed automatically via PyCall
, which uses Conda
.
However, to do this, PyCall
must be configured to not use you system version of python
.
If you do not have PyCall
installed, do this
julia> ENV["PYTHON"]=""
julia> Pkg.add("PyCall")
If you do have PyCall
installed, but it is configured to use your system python
, reconfigure
it like this.
julia> ENV["PYTHON"]=""
julia> Pkg.build("PyCall")
If you use linux, you may have your distribution's sympy
package installed and it may be
out of date. In this case, try the procedure above, and/or try removing your distribution's sympy
package.
SymPy
, or sympy
, here refers to the python SymPy distribution
(sometimes called sympy), not the Julia package SymPy
. Symata
does not require the Julia package
SymPy.jl, which has a different goal.
Symata requires mpmath
package for python. This
should be automatically installed when installing sympy
via
PyCall
as described above. This also works on OSX.
However, if you use pip
, you should just be able to run pip install mpmath
.
Three environments for running Symata
are supported: the Julia
REPL, Jupyter
, and a dumb terminal
A Symata
mode is added to the Julia
REPL. Enter the mode by typing =
as the first character. Exit
the mode by typing backspace
as the first character.
julia> using Symata
symata 1> # after entering `=`
There is also an executable symata
included in top level directory of this distribution. It is a (UNIX
sh) shell script that just starts julia and loads the module.
#
julia -i -e "using Symata" $*
Upon running this script, Symata
mode is entered automatically.
Toggle between Julia and Symata modes by typing =
as the first character on a line.
(If loading Symata from the julia
prompt via using Symata
, you use =
and backspace.)
In Symata mode, the input is not interpreted as Julia expressions, but rather Symata expressions. You can do tab completion to see a list of functions and symbols.
Versions v1.3.0 through v1.3.2 of IJulia.jl
are supported.
In [1]: using Symata
In [2]: Expand((a+b)^2)
Out[2]: a^2 + 2a*b + b^2
In [3]: Julia() # return to Julia mode
In Jupyter
, the Symata
expressions In(n)
and Out(n)
reevaluate the input and output cells. TAB completion
works in Jupyter
. To see a list of all possible completions, type *[TAB]
.
If you do using Symata
in a dumb terminal, the Symata
prompt should appear automatically.
From the julia prompt, type isympy()
to enter the sympy shell.
The best source of examples is the test directory.
The documentation can be printed from within Symata by entering ? SymName
at the symata
prompt. Help(Symname)
prints the same
documentation. For many Symata functions, the SymPy docstring is
printed along with the Symata documentation.
Try Help()
. Type h"topic"
to search for items containing the
string "topic"
. Hit TAB
at the command line REPL for a list of all
builtin symbols. (i.e. variables and functions) Symbols that are
associated with some functionality can be listed with
BuiltIns()
. Type Example()
to see a list of topics with examples.
Type Example(topic)
to run the examples. (But, far more examples are
in the test directory ). The input strings from the examples are pushed
to the history so that they can be recalled and edited and
re-evaluated.
Run the test suite from the symata
prompt with Tests()
.
This runs tests in the directory sjtest.
Pkg.test("Symata")
runs the same test suite from Julia
.