23

I use Mathematica for symbolic math calculations. I am planning to switch to another language. Matlab (which I use for standard computation stuff) includes this feature but I am looking at the possibility of using Julia, since it seems to be the future. Yet, there seems to be no symbolic tool available (no mention in official documentation). Apparently the only package available (SymPy) says "Test Failed" in the official website (http://pkg.julialang.org/).

Has anyone been able to do this in Julia?

luchonacho
  • 6,759
  • 4
  • 35
  • 52
  • The `test failed` is due to the underlying reliance on `Python` and `SymPy`. The package works just fine if you have that set up properly. – jverzani Jul 01 '15 at 13:27
  • What a weird categorization system then... any intuition behind it? – luchonacho Jul 01 '15 at 14:27
  • Well the tests fail, but in general it is nice to know when they pass. In this instance, they fail as there is a dependency on `mpmath` that isn't installed in the testing framework. However, the tests also fail on travis. There for the reason that the test environment installs an older version of SymPy, so the matrix features don't work. Even with the public failures, for developing it is nice to have tests to make sure things are working as expected. Would a heads up on the githup page make a difference? – jverzani Jul 01 '15 at 20:27
  • Out of curiosity what other symbolic tools have use used and are familiar with? – JAlex Nov 09 '20 at 16:05

4 Answers4

22

Now, looking at http://pkg.julialang.org/ one could find more candidates to perform symbolic mathematics in julia:

  • SymEngine.jl

    Julia Wrappers for SymEngine, a fast symbolic manipulation library, written in C++.

  • Symata.jl

    a language for symbolic computations and mathematics, where, for the most part, "mathematics" means what it typically does for a scientist or engineer.

  • SymPy.jl

    Julia interface to SymPy via PyCall

Also:

Reza Afzalan
  • 5,646
  • 3
  • 26
  • 44
9

SymPy Package works fine, it brings Python's Sympy functionality into Julia via PyCall.

SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python and does not require any external libraries.

meawoppl
  • 2,714
  • 1
  • 23
  • 30
Reza Afzalan
  • 5,646
  • 3
  • 26
  • 44
4

Also, consider the Nemo.jl library which they claim is faster than alternatives like SageMath.

Brandon H. Gomes
  • 808
  • 2
  • 9
  • 24
0

I can recommend Symbolics.jl Because it works nicely together with ModelingToolkit.jl, take a lookt at their beginner example:

using ModelingToolkit

@variables t x(t)   # independent and dependent variables
@parameters τ       # parameters
@constants h = 1    # constants have an assigned value
D = Differential(t) # define an operator for the differentiation w.r.t. time

# your first ODE, consisting of a single equation, the equality indicated by ~
@named fol = ODESystem([D(x) ~ (h - x) / τ])

using DifferentialEquations: solve

prob = ODEProblem(fol, [x => 0.0], (0.0, 10.0), [τ => 3.0])
# parameter `τ` can be assigned a value, but constant `h` cannot
sol = solve(prob)

using Plots
plot(sol)

it uses Symbolics.jl to define the variables and then solves the problem using DifferentialEquations.jl.