Comparing Symbolics.jl with Mathematica

Here I compare performing some simple CAS calculations on Mathematica and on Julia using Symbolics

On Mathematica

On Julia

``````using Pkg
Pkg.activate("/Users/ssiew/juliascript/Symbolics")
using Symbolics
using Nemo
# using SymbolicNumericIntegration

@variables x

Expr = -279//16 + x^2 ~ 0
println("Expr is ",Expr)
println()

soln = symbolic_solve(Expr,x)

mybuildfunction(ans)=build_function(ans,x,expression=Val{false})

FuncArray = eval.(FuncBuilderArray)
``````

with output

``````  Activating project at `~/juliascript/Symbolics`
Expr is -(279//16) + x^2 ~ 0

Symbolic solution is SymbolicUtils.BasicSymbolic{Real}[(1//2)*√(279//4), (-1//2)*√(279//4)]
Float solution is [4.1758, -4.1758]
``````

My observations: Julia cannot simplify to “3*sqrt(31)/4” and turning the final answer to Floating point requires multiple lines of code.

1 Like

the conversion to floating point can be made a bit simpler (Convert symbolic expression to floating point?):

``````FloatAnswer = map(x->substitute(x,Dict()), answer)
``````

I think the functionality/(licensing fee) ratio is still better for Symbolics.jl That said, there’s the free Wolfram Engine…

3 Likes

There is an even better part about open source. If you don’t like something, just change it.

8 Likes