# \[ANN\] SymbolicIntegration.jl - indefinite integration with Symbolics.jl symbols

**URL:** <https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777>\
**Category:** Package Announcements\
**Tags:** integral, symbolics, symbolic-utils\
**Created:** [December 28, 2025, 10:34pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777 "2025-12-28T22:34:38Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![CiccioPasticcio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cicciopasticcio/32/215909_2.png) [@CiccioPasticcio](https://discourse.julialang.org/u/CiccioPasticcio)\
**Post date:** [December 28, 2025, 10:34pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/1 "2025-12-28T22:34:38Z")

</div>

For a while now I have been developing SymbolicIntegration.jl, that lets you solve symbolic integrals in julia! it has for now two different methods to arrive at the antiderivative:

- Risch algorithm
- Rule based method using \>3000 rules

Example usage:

```julia-auto
julia> integrate(sqrt(4 - 12*x + 9*x^2)+sqrt(1+x),x;verbose=true)
┌-------Applied rule 0_1_0 on ∫(sqrt(1 + x) + sqrt(4 - 12x + 9(x^2)), x)
| ∫( a + b + ..., x) => ∫(a,x) + ∫(b,x) + ...
└-------with result: ∫(sqrt(4 - 12x + 9(x^2)), x) + ∫(sqrt(1 + x), x)
┌-------Applied rule 1_2_1_1_3 on ∫(sqrt(4 - 12x + 9(x^2)), x)
| ∫((a + b * x + c * x ^ 2) ^ p, x) => if 
| !(contains_var(a, b, c, p, x)) &&
| (
| b ^ 2 - 4 * a * c == 0 &&
| p !== -1 / 2
| )
| ((b + 2 * c * x) * (a + b * x + c * x ^ 2) ^ p) / (2 * c * (2 * p + 1))
└-------with result: (1//36)*((4 - 12x + 9(x^2))^(1//2))*(-12 + 18x)
┌-------Applied rule 1_1_1_1_4 on ∫(sqrt(1 + x), x)
| ∫((a + b * x) ^ m, x) => if 
| !(contains_var(a, b, m, x)) &&
| m !== -1
| (a + b * x) ^ (m + 1) / (b * (m + 1))
└-------with result: ((1 + x)^(3//2)) / (3//2)
((1 + x)^(3//2)) / (3//2) + (1//36)*((4 - 12x + 9(x^2))^(1//2))*(-12 + 18x)

```

please try it and tell me what you think, also report any bugs or functions that the package is not able to integrate opening issues on github, thanks!!!

---

<div class="post-metadata">

**Author:** ![linwaytin](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Post date:** [December 28, 2025, 11:58pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/2 "2025-12-28T23:58:26Z")

</div>

Amazing work!

---

<div class="post-metadata">

**Author:** ![langestefan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/langestefan/32/207923_2.png) [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Post date:** [December 29, 2025, 12:18am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/3 "2025-12-29T00:18:26Z")

</div>

Very cool, congrats.

> [@CiccioPasticcio](#):
>
> Rule based method using \>3000 rules

Just for my personal interest, do you have to write these rules by hand?

[Because it looks like a nightmare](https://github.com/JuliaSymbolics/SymbolicIntegration.jl/blob/main/src/methods/rule_based/rules2/3%20Logarithms/3.3%20u%20(a%2Bb%20log(c%20(d%2Be%20x)%5En))%5Ep.jl)

---

<div class="post-metadata">

**Author:** ![photor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/photor/32/14343_2.png) [@photor](https://discourse.julialang.org/u/photor)\
**Post date:** [December 29, 2025, 1:24am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/4 "2025-12-29T01:24:48Z")

</div>

good job!

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 29, 2025, 2:50am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/5 "2025-12-29T02:50:50Z")

</div>

> [@langestefan](#):
>
> Just for my personal interest, do you have to write these rules by hand?
> 
> [Because it looks like a nightmare](https://github.com/JuliaSymbolics/SymbolicIntegration.jl/blob/main/src/methods/rule_based/rules2/3%20Logarithms/3.3%20u%20(a%2Bb%20log(c%20(d%2Be%20x)%5En))%5Ep.jl)

Somebody did: it comes from [https://rulebasedintegration.org/](https://rulebasedintegration.org/)

Sadly, the maintainer of that did pass away relatively recently, so the Julia package will likely be the spiritual successor.

---

<div class="post-metadata">

**Author:** ![CiccioPasticcio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cicciopasticcio/32/215909_2.png) [@CiccioPasticcio](https://discourse.julialang.org/u/CiccioPasticcio)\
**Post date:** [December 29, 2025, 9:01am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/6 "2025-12-29T09:01:28Z")

</div>

exactly, i used the rules from the mathematica package, that contains 6700 integration rules. to convert them to julia I created a script to translate them automatically, but there was stil a lot of translation by hand, just reading mathematica code and writing julia equivalent. Right now approx 3400 rules are translated.

---

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [December 29, 2025, 11:01pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/7 "2025-12-29T23:01:35Z")

</div>

Very exciting work! Last I checked, Mathematica has a more sophisticated pattern syntax and better support for associative-commutative pattern matching. Did you have to work around this issue, or was the translation straightforward?

---

<div class="post-metadata">

**Author:** ![CiccioPasticcio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cicciopasticcio/32/215909_2.png) [@CiccioPasticcio](https://discourse.julialang.org/u/CiccioPasticcio)\
**Post date:** [December 29, 2025, 11:31pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/8 "2025-12-29T23:31:11Z")

</div>

Exactly, you got the point! The translation was definitely not straightforward, yes I extended SymbolicUtils pattern matching this summer, creating the “defslots” that allow to match a pattern with some default values, and improving the handling of commutative pattern matching. Also I improved pattern matching of powers with negative exponents, that was quite difficult and still not completely solved. [Here](https://github.com/Bumblebee00/SymbolicIntegration.jl/blob/main/GSoCfinalReport_MattiaMichelettaMerlin.md) you can read in more detail.

On top of that the old SymbolicUtils pattern matching was too slow to handle the thousands of rules I needed, so in the last weeks I rebuilt it from scratch improving ttfx from 14 min to 12 sec! I am so happy about it, [on my blog post](https://mmm3.it/symbolicintegrationupdate_en.html) you can read in more detail

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [December 30, 2025, 8:35am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/9 "2025-12-30T08:35:28Z")

</div>

I’m interesting in the possibilities of SymbolicIntegration. I have tried `using SymbolicIntegration`, and on my computer it takes a while to import all the rules. It seems like rules are imported every time I use the package. Is that correct?

---

<div class="post-metadata">

**Author:** ![CiccioPasticcio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cicciopasticcio/32/215909_2.png) [@CiccioPasticcio](https://discourse.julialang.org/u/CiccioPasticcio)\
**Post date:** [December 30, 2025, 9:22am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/10 "2025-12-30T09:22:55Z")

</div>

> [@BLI](#):
>
> it takes a while

yeah probably you tried before version 3.3.0, that i released in the last days. As i said above i have rewrittent the pattern matching system from scratch, and now it takes ~12 sec on my laptop (macbook m1 2020) to load all the rules and precompile the integrate function, while before version 3.3.0 was 14 minutes

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [December 30, 2025, 9:32am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/11 "2025-12-30T09:32:09Z")

</div>

When I was young, I watch Dr Who and one episode talks about Block Transfer Computation.

A Block Transfer Computation was a mathematical process used to create objects and affect spacetime in other ways through the power of pure mathematics. The process usually involved chanting.

Computers could not do Block Transfer Computations, as the calculations themselves would alter the nature of the computer. Though they were working on technological means to do so, the Logopolitans were destroyed before they completed it. As such, organic life forms had to do the work as morphologically unstable living organic matter could handle the stress of reality-changes caused by block transfer mathematics.

I really believe that Integration is Block Transfer Computation because computers cannot do Integration. This seems to be true when that episode of Dr Who first came out.

Then I discovered Mathematica…

---

<div class="post-metadata">

**Author:** ![CiccioPasticcio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cicciopasticcio/32/215909_2.png) [@CiccioPasticcio](https://discourse.julialang.org/u/CiccioPasticcio)\
**Post date:** [December 30, 2025, 10:16am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/12 "2025-12-30T10:16:11Z")

</div>

> [@StevenSiew](#):
>
> Then I discovered Mathematica…

And now you discovered SymbolicIntegration.jl

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [December 30, 2025, 10:34am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/13 "2025-12-30T10:34:41Z")

</div>

> [@ChrisRackauckas](#):
>
> so the Julia package will likely be the spiritual successor

Currently SymbolicIntegration.jl has the same rules as Rubi? Or it aims to incorporate more rules?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 30, 2025, 10:40am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/14 "2025-12-30T10:40:19Z")

</div>

Right now it’s aiming to incorporate them all, and it has a few other integrators as well like a Reisch method.

---

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [December 31, 2025, 7:19pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/15 "2025-12-31T19:19:16Z")

</div>

> [@CiccioPasticcio](#):
>
> [Here](https://github.com/Bumblebee00/SymbolicIntegration.jl/blob/main/GSoCfinalReport_MattiaMichelettaMerlin.md) you can read in more detail.

I see that you added awareness of commutativity beyond top level in SymbolicUtils.jl. However, the following simple factorization rule still doesn’t work with SymbolicUtils v4.10.0:

```julia-auto
julia> @syms a b c
(a, b, c)

julia> r = @rule ~a*~b + ~a*~c => ~a * (~b+~c)
~a * ~b + ~a * ~c => ~a * (~b + ~c)

julia> r(a*b + a*c)
a*(b + c)

julia> r(b*a + b*c)

julia> 

```

The last line of code returned `nothing` due to a failed match, as the expression is internally stored as `a*b + b*c` and fails to match the LHS of the factorization rule, `~a*~b + ~a*~c`. So commutativity is not fully taken into account. Is this a known issue?

---

<div class="post-metadata">

**Author:** ![CiccioPasticcio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cicciopasticcio/32/215909_2.png) [@CiccioPasticcio](https://discourse.julialang.org/u/CiccioPasticcio)\
**Post date:** [January 1, 2026, 3:12pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/16 "2026-01-01T15:12:07Z")

</div>

That’s strange, I I think should work because the @rule macro tries all possible ordering for commutative operations… I will investigate

---

<div class="post-metadata">

**Author:** ![abraunst](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraunst/32/6880_2.png) [@abraunst](https://discourse.julialang.org/u/abraunst)\
**Post date:** [January 1, 2026, 6:50pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/17 "2026-01-01T18:50:35Z")

</div>

I think that default symbols in `SymbolicUtils` are supposed to be `Number`s, which are not necessarily commutative. If you declare `@syms a::Real b::Real c::Real` it does indeed apply the rule.

---

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [January 1, 2026, 9:24pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/18 "2026-01-01T21:24:14Z")

</div>

It still fails one of the cases with your suggested change:

```julia-repl
julia> using SymbolicUtils

julia> @syms a::Real b::Real c::Real
(a, b, c)

julia> r = @rule ~a*~b + ~a*~c => ~a * (~b+~c)
~a * ~b + ~a * ~c => ~a * (~b + ~c)

julia> r(a*b + a*c)

julia> r(a*b + b*c)
(a + c)*b

```

What’s strange is that the matching succeeds in the latter case which involves nontrivial reordering with commutativity but not the former simpler case.

---

<div class="post-metadata">

**Author:** ![CiccioPasticcio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cicciopasticcio/32/215909_2.png) [@CiccioPasticcio](https://discourse.julialang.org/u/CiccioPasticcio)\
**Post date:** [January 1, 2026, 9:57pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/19 "2026-01-01T21:57:21Z")

</div>

> [@abraunst](#):
>
> `Number`s, which are not necessarily commutative

For now the rule macro doesn’t really make a difference and treats Number as commutative, so the showed example should work

---

<div class="post-metadata">

**Author:** ![CiccioPasticcio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cicciopasticcio/32/215909_2.png) [@CiccioPasticcio](https://discourse.julialang.org/u/CiccioPasticcio)\
**Post date:** [January 1, 2026, 10:03pm UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777/20 "2026-01-01T22:03:06Z")

</div>

> [@greatpet](#):
>
> the matching succeeds in the latter case which involves nontrivial reordering with commutativity but not the former simpler case.

Yes, so internally the arguments of a operation are ordered pretty much randomly, but DIFFERENT from what is showed on the repl. So the order you see is not the actual order of the arguments in memory.

Anyway I have investigated and the reason sometimes this example fails is because the macro now doesn’t actually try every permutation of arguments in every commutative operation, it stops trying when it finds a matching permutation for a sub expression… The full explanation would be quite long so I won’t go into further detail. I could fix it but I don’t have time

[Next page](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777.md?page=2)
