Hello everyone,
I’m happy to announce Giac.jl (v0.11.0), now registered in the General registry and installable with Pkg.add("Giac").
Giac.jl provides a Julia interface to the Giac computer algebra system, giving you access to 2200+ CAS commands directly from Julia.
What is Giac?
Giac is a mature, general-purpose C++ computer algebra system developed by Bernard Parisse at Université Grenoble Alpes since 2000. It powers GeoGebra (since 2013) and the HP Prime calculator, and is available as an engine in SageMath. Giac provides robust algorithms for polynomial arithmetic, symbolic integration, limits, series, Gröbner bases, differential equation solving, and much more.
Why Giac.jl?
Julia already has great symbolic tooling with Symbolics.jl (native Julia CAS) and SymPy.jl (Python bridge). Giac.jl complements these by providing direct access to Giac’s battle-tested C++ engine via CxxWrap.jl — no Python layer, no manual compilation. The Giac library and its C++ wrapper are shipped automatically via JLL packages.
Installation
using Pkg
Pkg.add("Giac")
That’s it — the Giac C++ library is provided automatically via GIAC_jll and libgiac_julia_jll. No manual compilation or environment variables needed. Requires Julia 1.11+.
Quick Start
using Giac
using Giac.Commands: factor, expand, diff, integrate, limit, simplify, solve
# Create symbolic variables
@giac_var x y
# Arithmetic — just works
x + y # x+y
x ^ 2 # x^2
x - (1//2) # x-1/2 (Rational)
x + π # x+pi (Irrational)
# Algebra
factor(x^2 - 1) # (x-1)*(x+1)
expand((x + y)^2) # x^2+2*x*y+y^2
simplify((x^2 - 1)/(x - 1)) # x+1
# Equations with ~ operator (Symbolics.jl convention)
solve(x^2 - 4 ~ 0, x) # list[-2,2]
# Calculus
diff(sin(x^2), x) # 2*x*cos(x^2)
integrate(x * exp(x), x) # x*exp(x)-exp(x)
limit(sin(x)/x, x, 0) # 1
# Convert to Julia types
to_julia(giac_eval("3/4")) # 3//4::Rational{Int64}
Accessing Commands
All 2200+ Giac commands are available through the Giac.Commands submodule. Three access patterns are supported:
# 1. Selective import (recommended)
using Giac.Commands: factor, expand, diff, integrate
# 2. Full import (interactive use)
using Giac.Commands
ifactor(giac_eval("120")) # 2^3*3*5
# 3. Universal invocation (works for ALL commands, including Julia conflicts)
invoke_cmd(:factor, x^2 - 1) # (x-1)*(x+1)
invoke_cmd(:sin, giac_eval("pi/6")) # 1/2
Differential Equations with the D Operator
Giac.jl includes a D operator for natural ODE syntax:
using Giac
using Giac.Commands: desolve
@giac_var t u(t) tau U0
# First-order ODE: τu' + u = U₀, u(0) = 1
ode = tau * D(u) + u ~ U0
result = desolve([ode, u(0) ~ 0], t, :u)
# Returns: U0-U0*exp(-t/tau)
# Second-order: u'' + u = 0, u(0) = 1, u'(0) = 0
ode2 = D(D(u)) + u ~ 0
result2 = desolve([ode2, u(0) ~ 1, D(u)(0) ~ 0], t, :u)
# Returns: cos(t)
Symbolic Linear Algebra
using Giac, LinearAlgebra
@giac_var a b c d
B = GiacMatrix([[a, b], [c, d]])
det(B) # a*d-b*c
inv(B) # symbolic inverse
tr(B) # a+d
# Large symbolic matrices
M = GiacMatrix(:m, 3, 3) # 3×3 with entries m11, m12, ...
Signal Processing
Laplace and Z-transforms for continuous- and discrete-time signal analysis:
using Giac
using Giac.Commands: laplace, ilaplace, ztrans, invztrans
@giac_var t s n z
# Laplace transform
laplace(exp(-t), t, s) # 1/(s+1)
ilaplace(1/(s+1), s, t) # exp(-t)
# Z-transform
ztrans(giac_eval("1"), n, z) # z/(z-1)
More Features
- Symbolics.jl integration: bidirectional conversion with
to_giac/to_symbolics - MathJSON.jl extension: convert expressions to/from MathJSON tree format
- Base function extensions:
sin(expr),cos(expr),exp(expr)work onGiacExpr - Infinity support: use Julia’s
Infand-Infin limits and improper integrals - Variable substitution:
substitute(expr, Dict(x => 2))(Symbolics.jl-compatible) - Tables.jl compatibility: convert
GiacMatrixand command help to DataFrames - LaTeX rendering: automatic LaTeX display in Pluto notebooks
- Command discovery:
search_commands("factor"),giac_help(:factor), and Julia REPL?integration - Indexed variables:
@giac_several_vars a 3 3createsa11, a12, ..., a33
Documentation
Full documentation is available at s-celles.github.io/Giac.jl, covering:
- Mathematics: algebra, calculus, linear algebra, differential equations, trigonometry
- Physics: mechanics, electromagnetism
- Signal processing: Laplace & Z-transforms
- API reference for all exported types and functions
Prior Art
There have been earlier Julia interfaces to Giac by HaraldHofstaetter and Bernard Parisse himself. This package builds on that legacy with a registered package, JLL-based automatic installation, the Giac.Commands submodule for all 2200+ commands, ODE support with the D operator, and extensions for Symbolics.jl and MathJSON.jl.
Feedback Welcome
I’d love to hear from the community:
- Use cases: what symbolic computation tasks would you like to tackle with Giac from Julia?
- API design: suggestions on making the interface more Julian are appreciated
- Bug reports & contributions: issues and PRs are welcome!
Links:
- Repository: github.com/s-celles/Giac.jl
- Documentation: s-celles.github.io/Giac.jl
- Giac homepage: www-fourier.univ-grenoble-alpes.fr/~parisse/giac.html