Reputation: 7167
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?
Upvotes: 22
Views: 13717
Reputation: 428
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
.
Upvotes: 0
Reputation: 5746
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.
Upvotes: 9
Reputation: 898
Also, consider the Nemo.jl
library which they claim is faster than alternatives like SageMath
.
Upvotes: 4
Reputation: 5746
Now, looking at http://pkg.julialang.org/ one could find more candidates to perform symbolic mathematics in julia:
Julia Wrappers for SymEngine, a fast symbolic manipulation library, written in C++.
a language for symbolic computations and mathematics, where, for the most part, "mathematics" means what it typically does for a scientist or engineer.
Julia interface to SymPy via PyCall
Also:
Linear symbolic expressions for the Julia language
Upvotes: 23