# \[ANN\] Giac.jl - Julia interface to the Giac computer algebra system

**URL:** <https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681>\
**Category:** Package Announcements\
**Created:** [April 11, 2026, 1:13pm UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681 "2026-04-11T13:13:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [April 11, 2026, 1:13pm UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/1 "2026-04-11T13:13:05Z")

</div>

Hello everyone,

I’m happy to announce **[Giac.jl](https://github.com/s-celles/Giac.jl)** (v0.11.0), now [registered in the General registry](https://github.com/JuliaRegistries/General/pull/152230) and installable with `Pkg.add("Giac")`.

Giac.jl provides a Julia interface to the [Giac](https://www-fourier.univ-grenoble-alpes.fr/~parisse/giac.html) computer algebra system, giving you access to **2200+ CAS commands** directly from Julia.

[![Documentation](https://global.discourse-cdn.com/julialang/original/3X/d/2/d24952c9535cffbd2ad05c83f74f5f375df18d50.svg)](https://s-celles.github.io/Giac.jl/stable)

## 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

```julia
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

```julia
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:

```julia
# 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:

```julia
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

```julia
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:

```julia
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 on `GiacExpr`
- **Infinity support** : use Julia’s `Inf` and `-Inf` in limits and improper integrals
- **Variable substitution** : `substitute(expr, Dict(x => 2))` (Symbolics.jl-compatible)
- **Tables.jl compatibility** : convert `GiacMatrix` and 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 3` creates `a11, a12, ..., a33`

## Documentation

Full documentation is available at **[s-celles.github.io/Giac.jl](https://s-celles.github.io/Giac.jl/stable)**, 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](https://github.com/HaraldHofstaetter/Giac.jl) and [Bernard Parisse himself](https://github.com/parisseb/Giac.jl). 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](https://github.com/s-celles/Giac.jl)
- Documentation: [s-celles.github.io/Giac.jl](https://s-celles.github.io/Giac.jl/stable)
- Giac homepage: [www-fourier.univ-grenoble-alpes.fr/~parisse/giac.html](https://www-fourier.univ-grenoble-alpes.fr/~parisse/giac.html)

Edit: now 0.11.1 after [New version: Giac v0.11.1 by JuliaRegistrator · Pull Request #152695 · JuliaRegistries/General · GitHub](https://github.com/JuliaRegistries/General/pull/152695) being merged

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [April 24, 2026, 9:15pm UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/2 "2026-04-24T21:15:45Z")

</div>

Congratz on the release! This looks really well implemented, and the API showcased in the examples looks as natural and Julian as I could have wished for. Man, I wish I has this available during my time as a student 🙈

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 24, 2026, 10:42pm UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/3 "2026-04-24T22:42:31Z")

</div>

> [@scelles](#):
>
> `B = GiacMatrix([[a, b], [c, d]])`

Is there a reason you can’t do `GiacMatrix([a b; c d])`, passing a 2d array to the constructor instead of a vector-of-vectors?

---

<div class="post-metadata">

**Author:** ![lilachint](https://avatars.discourse-cdn.com/v4/letter/l/ee7513/32.png) [@lilachint](https://discourse.julialang.org/u/lilachint)\
**Post date:** [April 25, 2026, 2:23am UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/4 "2026-04-25T02:23:27Z")

</div>

> <https://github.com/s-celles/Giac.jl/blob/314d3bf5c3223c99449c25877e5cdf1878d0c8c4/src/Giac.jl#L291>

It seems that 2D arrays are also compatible. GIAC seems to use row-major indexing (originally implemented in C++), and Julia is using column-major indexing. I guess some sort of wrapper is used, not too sure though.

---

<div class="post-metadata">

**Author:** ![draftman9](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/draftman9/32/38128_2.png) [@draftman9](https://discourse.julialang.org/u/draftman9)\
**Post date:** [April 27, 2026, 12:30am UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/5 "2026-04-27T00:30:08Z")

</div>

I used Mathematica, Maple, sympy in Python and SymPy.jl in Julia. I wonder what the differences are between them. BTW, it’s my first time to hear about Giac.

---

<div class="post-metadata">

**Author:** ![tduretz](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@tduretz](https://discourse.julialang.org/u/tduretz)\
**Post date:** [April 27, 2026, 10:47am UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/6 "2026-04-27T10:47:21Z")

</div>

Looks like a promising package!  
Are there functions to convert `GiacExpr` into julia functions (a bit like `lambdify()` in sympy) and functions to directly generate julia code (like `julia_code()` in sympy)?

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [April 27, 2026, 11:56am UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/7 "2026-04-27T11:56:09Z")

</div>

@TheLateKronos @tduretz thanks for the kind words

@stevengj @lilachint  
Yes you can do also

```julia-auto
julia> using Giac
[ Info: GIAC wrapper library loaded from ...

julia> @giac_var a b c d
(a, b, c, d)

julia> M = GiacMatrix([a b; c d])
2×2 GiacMatrix:
a b
c d

julia> using LinearAlgebra

julia> det(M)
GiacExpr: a*d-b*c

```

@tduretz You can do

```julia
julia> @giac_var x
(x,)

julia> giac_expr = x^2 - 1
GiacExpr: x^2-1

julia> f(_x) = to_julia(substitute(giac_expr , x => _x))
f (generic function with 1 method)

julia> f(0)
-1

julia> f(1)
0

julia> f(-1)
0

```

See [Giac.jl/examples/04\_plotting.jl at main · s-celles/Giac.jl · GitHub](https://github.com/s-celles/Giac.jl/blob/main/examples/04_plotting.jl)

See also [unwrap\_const? · Issue #3 · s-celles/Giac.jl · GitHub](https://github.com/s-celles/Giac.jl/issues/3) about `evalf` usage

```julia-auto
julia> giac_expr = sin(x)
GiacExpr: sin(x)

julia> f(_x) = to_julia(substitute(giac_expr, x => _x))
f (generic function with 1 method)

julia> f(2)
GiacExpr: sin(2)

julia> f(2.0)
0.909297426826

julia> f(_x) = to_julia(Giac.Commands.evalf(substitute(giac_expr, x => _x)))
f (generic function with 1 method)

julia> f(2)
0.909297426826

```

You can also export to Symbolics.jl

```julia
julia> giac_expr = x^2 - 1
GiacExpr: x^2-1

julia> using Symbolics

julia> to_symbolics(giac_expr)
-1 + x^2

julia> typeof(to_symbolics(giac_expr))
Num

```

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [April 27, 2026, 12:17pm UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/8 "2026-04-27T12:17:20Z")

</div>

@draftman9 maybe price and license?

I haven’t found much public (and up to date) benchmarks of computer algebra systems… except this from Nasser M. Abbasi [https://www.12000.org/my\_notes/CAS\_integration\_tests/index.htm](https://www.12000.org/my_notes/CAS_integration_tests/index.htm)  
but it focus narrowly on integration… so that’s not a broad-coverage benchmark for CAS.

CAS benchmarks could answer precisely to your question.

For my use case I wanted free and open source software and didn’t want to rely on Python deps.

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [May 3, 2026, 7:02am UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/9 "2026-05-03T07:02:37Z")

</div>

@tduretz `build_function` landed yesterday

```julia-auto
using Giac
@giac_var x y
expr = sin(x^2 + y^2)

# Giac backend (default) — always available
f = build_function(expr, x, y)
f(1.0, 2.0)

# Symbolics backend — native Julia, autodiff-compatible
using Symbolics
f_fast = build_function(expr, x, y; backend = :symbolics)
f_fast(1.0, 2.0)

```

More info can be found at [Add `lambdify` or `build_function` for converting `GiacExpr` into native Julia callables · Issue #17 · s-celles/Giac.jl · GitHub](https://github.com/s-celles/Giac.jl/issues/17#issuecomment-4365608577)

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [August 12, 2026, 9:52am UTC](https://discourse.julialang.org/t/ann-giac-jl-julia-interface-to-the-giac-computer-algebra-system/136681/10 "2026-08-12T09:52:23Z")

</div>

A small Giac.jl update since my last post in May.

[Giac.jl](https://github.com/s-celles/Giac.jl) is now at **v0.14.3** , and quite a few things have landed since then:

- **MCP support** : Giac can now be exposed as an optional MCP server through `ModelContextProtocol.jl`, with `giac_eval` for calculations and `giac_search` for discovering Giac commands. This makes it possible for MCP-compatible LLM clients to use Giac as an actual CAS instead of trying to do symbolic algebra themselves.

- **Faster command invocation** : `invoke_cmd` now has a direct `Gen` fast path when arguments can be represented directly by Giac, avoiding the `Gen -> string -> parse -> Gen` round trip.

- **Better `TermInterface.jl` support** : the extension now implements the complete expression traversal interface, including `head` and `children`, making `GiacExpr` easier to consume from packages using the common symbolic term interface.

- **Better rendering and conversions** : LaTeX and MathML rendering no longer accidentally re-evaluate expressions before displaying them, and `to_julia` for Giac strings now returns the actual string contents rather than the quoted Giac literal.

- **Documentation for humans and machines** : the documentation now automatically generates `llms.txt` and `llms-full.txt`, alongside updated examples and notebooks.

There have also been a number of less visible but important maintenance improvements: CompatHelper, minimum-compatibility CI testing, Dependabot for GitHub Actions, native Apple Silicon CI, and several portability and ABI fixes.

The package is gradually becoming less just a wrapper around Giac and more a bridge between Giac and the wider Julia ecosystem: Symbolics, TermInterface, MathJSON, MCP, etc.

For those who enjoy reading in the language of Molière, there is also a French presentation given to the **Café Julia / Groupe Calcul CNRS** :

> **[Giac.jl](https://s-celles.github.io/Giac.jl_cafe_julia_grp_calcul_cnrs/)**

It also gives a glimpse behind the scenes at how **Giac.jl** , the Julia interface, has been developed using AI-assisted, spec-driven development (SDD), including my slightly questionable “cooking recipe” for working with AI on a software project. Yes, sorry about that. 😄

Just to avoid any misunderstanding: Giac itself, the C++ computer algebra system developed, was built **the hard way** , with many years of very human work (not mine).

And on a slightly different note, I am currently in **Mainz for JuliaCon 2026**. My Giac.jl presentation was not recorded, so you have fortunately been spared my terrible English. 😄

The slides, however, cannot escape the Internet:

> **[Giac.jl](https://s-celles.github.io/Giac.jl_juliacon2026/)**

Edit:

- Giac.jl documentation [Home · Giac.jl](https://juliagiac.github.io/Giac.jl/dev/)
- GiacSlate.jl documentation [Home · GiacSlate.jl](https://juliagiac.github.io/GiacSlate.jl/dev/)
