Need help with SymbolicUtils.jl?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

JuliaSymbolics
155 Stars 19 Forks Other 587 Commits 37 Opened issues

Description

Expression rewriting and simplification

Services available

!
?

Need anything else?

Contributors list

SymbolicUtils.jl

CI

SymbolicUtils.jl provides various utilities for symbolic computing.

Symbols in SymbolicUtils carry type information. Operations on them propagate this information. A rule-based rewriting language can be used to find subexpressions that satisfy arbitrary conditions and apply arbitrary transformations on the matches. The library also contains a set of useful simplification rules for expressions of numeric symbols and numbers. These can be remixed and extended for special purposes.

If you are a Julia package develper in need of a rule rewriting system for your own types, have a look at the interfacing guide.

Go to the manual

SymbolicUtils.jl is on the general registry and can be added the usual way:

julia
pkg> add SymbolicUtils
or
julia
julia> using Pkg; Pkg.add("SymbolicUtils")

"I don't want to read your manual, just show me some cool code"

julia> using SymbolicUtils

julia> SymbolicUtils.show_simplified[] = true

julia> @syms x::Real y::Real z::Complex f(::Number)::Real (x, y, z, f(::Number)::Real)

julia> 2x^2 - y + x^2 (3 * (x ^ 2)) + (-1 * y)

julia> f(sin(x)^2 + cos(x)^2) + z f(1) + z

julia> r = @rule sinh(im * x) => sin(x) sinh(im * x) => sin(x)

julia> r(sinh(im * y)) sin(y)

julia> simplify(cos(y)^2 + sinh(im*y)^2, RuleSet([r])) 1

Citations

  • The pattern matcher is an adaption of the one by Gerald Jay Sussman (as seen in 6.945 at MIT), his use of symbolic programming in the book SICM inspired this package.
  • Rewrite.jl and Simplify.jl by Harrison Grodin also inspired this package.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.