# \[ANN\] Symbolics.jl: A Modern Computer Algebra System for a Modern Language

**URL:** <https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251>\
**Category:** Package Announcements\
**Created:** [March 1, 2021, 2:59pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251 "2021-03-01T14:59:40Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [March 8, 2021, 8:19pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/83 "2021-03-08T20:19:12Z")

</div>

this is a bug in the default value (it should be true)

---

<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:** [March 8, 2021, 8:43pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/84 "2021-03-08T20:43:47Z")

</div>

I updated my packages, and I still get the same result (i.e., `polynorm` defaults to `false`). According to `Pkg.status()`, I have v. 0.1.4 of `Symbolics` under Julia 1.4.2.

- Perhaps `Symbolics` must be updated to take advantage of the update in `SymbolicUtils`?
- Or perhaps I must install a newer version of Julia than v. 1.4.2? (I’m kind of holding back for Julia 1.6…)

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [March 8, 2021, 8:48pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/85 "2021-03-08T20:48:08Z")

</div>

I think what @JeffreySarnoff is pointing out is that the docstring doesn’t match the code: [SymbolicUtils.jl/api.jl at bde73d18ac36c62e8ba0f8db1316a6b7a1984df2 · JuliaSymbolics/SymbolicUtils.jl · GitHub](https://github.com/JuliaSymbolics/SymbolicUtils.jl/blob/bde73d18ac36c62e8ba0f8db1316a6b7a1984df2/src/api.jl#L7-L15)

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [March 8, 2021, 8:48pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/86 "2021-03-08T20:48:24Z")

</div>

yes (thanks)

---

<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:** [March 8, 2021, 9:18pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/87 "2021-03-08T21:18:58Z")

</div>

OK – but there was also a temporary message (now edited out) that the code had been updated. That is what my response relates to.

---

<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:** [March 8, 2021, 10:37pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/88 "2021-03-08T22:37:51Z")

</div>

Looks like that needs a quick PR

---

<div class="post-metadata">

**Author:** ![rfateman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfateman/32/22507_2.png) [@rfateman](https://discourse.julialang.org/u/rfateman)\
**Post date:** [March 9, 2021, 1:20am UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/89 "2021-03-09T01:20:51Z")

</div>

It’s interesting that Maxima’s already “available” from Julia in some sense. Maybe the projects that you have in mind to build on top of Symbolics.jl could be specified in Maxima (or built in Maxima!). This would inform you of situations where (a) Maxima or something similar does just fine, or (b) You need to go beyond what Maxima can do already.

The Sage environment may require a virtual machine on windows, but Maxima does not. If all you need in Maxima, there’s a certain disencentive to getting it via Sage.

If symbolic indefinite integration is of special interest (not that it is likely to be directly used in applications …) there are other implementations of the Risch “algorithm”, most notably the one in Axiom/Fricas. There’s also Rubi, (the announcement of Rubi in Julia  
was what caught my eye, recently, and why I’m here.)

. The python version seems to have stalled, but I have not followed it recently. I think the time needed to load and parse thousands of Rubi rules was excessive. I don’t know if this has been addressed.

(The corresponding setup for Rubi in Lisp would be to translate Rubi rules to Lisp. Loading Lisp is pretty fast, but for some Lisp it is also possible to convert it into FASL files which load even faster.  
Or it could be made part of a binary coredump.)  
[fateman@gmail.com](mailto:fateman@gmail.com)

---

<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:** [March 9, 2021, 2:49am UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/90 "2021-03-09T02:49:19Z")

</div>

> [@rfateman](#):
>
> It’s interesting that Maxima’s already “available” from Julia in some sense. Maybe the projects that you have in mind to build on top of Symbolics.jl could be specified in Maxima (or built in Maxima!). This would inform you of situations where (a) Maxima or something similar does just fine, or (b) You need to go beyond what Maxima can do already.

These projects can’t be specified directly in Maxima or built in Maxima. That would break abstract interpretation of Julia code, which is one of the core features we need for some of the ModelingToolkit features. That said, there’s nothing that stops Symbolics.jl from making it easy to call a few algorithms from Maxima like we do from AbstractAlgebra.jl/Nemo.jl.

> [@rfateman](#):
>
> If symbolic indefinite integration is of special interest (not that it is likely to be directly used in applications …) there are other implementations of the Risch “algorithm”, most notably the one in Axiom/Fricas

Maxima would be easier to get to given it’s already wrapped. What would be the reasons to additionally wrap Axiom/Fricas, i.e. what do they do better than Maxima?

> [@rfateman](#):
>
> The python version seems to have stalled, but I have not followed it recently. I think the time needed to load and parse thousands of Rubi rules was excessive. I don’t know if this has been addressed.

Yeah, SymPy Rubi is apparently really good, outperforming Maxima (not in compute speed but in “integrals it can solve”) after adding it:

> <https://github.com/sympy/sympy/issues/12233#issuecomment-463700534>
>
> A great GSoC project would be to make more progress in implementing the Rubi int…egrator into SymPy.
> 
> http://www.apmaths.uwo.ca/~arich/
> 
> Our current status is: https://github.com/sympy/sympy/issues/7749, that PR implements the if/then/else decision tree. However, we should probably go back and:
> 
> 1) Implement some of the Rubi 4.9 pattern matching rules in SymPy for some subset of integrals, say, trig functions (this involves improving our pattern matching probably)
> 
> After that, another project is:
> 
> 2) Implement a compiler for these pattern matching rules -\> if/then/else decision tree
> 
> I got a permission from Albert Rich to share his TODO list for Rubi. The above two projects 1) and 2) seem like a good thing to do, given the TODO list, but we can modify it of course.
> 
> NOTE: see below for more applications of a rule based system. This framework would be useful beyond just integration, though integration algorithms are the most developed, so we should start there.
> 
> \---
> 
> Rubi website projects:
> 1. Update the Rubi, Mathematica and Maple test results and statistics displayed on the Rubi website.
> 2. Update the repository of pattern matching rules on the Rubi website.
> 3. Extend the cascading menu system to more finely select rules based on an integrand's form.
> 4. Produce a histogram of rule applications categorized by integrand type, derivation type, etc.
> 5. Register an appropriate domain name for Rubi and link it to the UWO site.
> 
> Rubi 4 enhancement projects:
> 1. Generate a comprehensive set of test suite problems for integrand types not sufficiently tested.
> 2. Find and fix the deficiencies in Rubi that will inevitably turn up when the enlarged test suite is run.
> 3. Define rules for integrating elliptic and pseudo-elliptic integrals.
> 4. Define rules for integrating expressions of the form
> (g cos(e+f x))^p (a+b sin(e+f x))^m (c+d sin(e+f x))^n (A+B sin(e+f x)+C sin(e+f x)^2).
> 
> Rubi 5 development projects:
> 1. A program that compiles Rubi 4.9's pattern matching rules into an if-then-else decision tree.
> 2. A decision tree interpreter that allows Rubi 5 to single-step through an integration using information implicitly stored in the decision tree.
> 3. A program that displays the branching structure of the Rubi 5 decision tree as a simple directed graph.
> 4. A program that animates the resulting decision tree graph by zooming and panning, ala Google Maps.
> 5. An animation showing the descent through the decision tree graph to select a rule (much like a pinball game).
> 
> Rubi 6 development projects:
> 1. An integrator that derives integration rules on the fly rather than having them hard-coded.
> 
> Rule-based system development projects:
> 1. A rule-based definite integrator.
> 2. A rule-based equation and inequality solver.
> 3. A rule-based mathematical expression simplifier.
> 4. A rule-based symbolic limit finder.
> 5. A rule-based differential (ordinary and/or partial) equation solver.
> 6. A rule-based matrix algebra system.
> 
> Academic papers:
> 1. The rule-based integration techniques Rubi uses to produce optimal antiderivatives, and when to apply them.
> 2. Flushing out a decision tree leads to the discovery of new formulas, symmetries and simplifications.
> 3. Rule-based decision trees are mathematical objects subject to theoretical study (e.g. completeness, consistency, symmetry, uniqueness, etc.).
> 4. The applicability of the rule-based paradigm to other areas of mathematics and science.
> 
> \[RUBI rules\](https://raw.githubusercontent.com/Upabjojr/RUBI\_integration\_rules/master/RUBI\_DownValues\_FullForm.txt) in an easily parseable format (maybe using \[this tool\](https://gist.github.com/Upabjojr/bc07c49262944f9c1eb0)).

But it’s still in a PR because Python is too slow. Definitely a case for Julia to step in.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 9, 2021, 5:58am UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/91 "2021-03-09T05:58:25Z")

</div>

I created a (nearly empty) package Rubi.jl: [GitHub - ufechner7/Rubi.jl: Symbolic, rule based integration in Julia](https://github.com/ufechner7/Rubi.jl)

If you want to contribute, please add your ideas to: [Discussions · ufechner7/Rubi.jl · GitHub](https://github.com/ufechner7/Rubi.jl/discussions)

---

<div class="post-metadata">

**Author:** ![certik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/certik/32/2651_2.png) [@certik](https://discourse.julialang.org/u/certik)\
**Post date:** [March 9, 2021, 12:25pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/92 "2021-03-09T12:25:34Z")

</div>

I am the original author of [SymPy](https://sympy.org) and [SymEngine](https://github.com/symengine/symengine). Python is indeed too slow, so it is hard for SymPy to compete in terms of speed, but it is still very useful to a lot of people and there is a large community around it. The SymEngine project is written in C++ and it is _very_ fast (a few years ago it has been generally faster than any other computer algebra system that we tried, including Mathematica, Maple, GiNaC, Sage, SymPy, Maxima, etc.). @ChrisRackauckas have you run some benchmarks against SymEngine?

Furthermore, our vision with SymEngine is to be the “engine” that can be used in higher level languages such as Python, Ruby or Julia (it has wrappers to all those and more). That way we can all collaborate on a common codebase that can be natively used in all our languages of choice.

I noticed you wrote:

> But as we expanded beyond “build Jacobian and simplify”, SymEngine wasn’t enough. It was missing too many features.

Indeed, SymEngine is missing features compared to SymPy. We were hoping you would be interested in working with us to contribute them, especially since you were already using it. 🙂 Because if you do, then not just Julia, but every language including Python and SymPy would benefit.

It is easier for the Julia community to contribute if the code is written in Julia, just like it is easier for the Python community to contribute to SymPy since the code is in Python. That is true and growing the developer community is important.

But I believe it is important to write libraries that can be used from any language. C++ is one of the options for such a common language. Last time I tried Julia’s ahead-of-time compilation to static executables was not yet as easy as with C++ or Fortran:

> [@How to statically compile to a binary](https://discourse.julialang.org/t/how-to-statically-compile-to-a-binary/23825):
>
> The front page [https://julialang.org](https://julialang.org) says at the “General Purpose” tab that you can “[statically compile](https://github.com/JuliaLang/PackageCompiler.jl) your code”. So I have installed PackageCompiler as I described [here](https://discourse.julialang.org/t/how-to-install-packagecompiler/23824). I am able to create a dynamic binary as follows: julia ~/.julia/packages/PackageCompiler/oT98U/juliac.jl -vae --compile=all hello.jl when you examine it: $ ldd builddir/hello linux-vdso.so.1 (0x00007ffc27946000) hello.so =\> /home/certik/repos/julia\_comp/builddir/hello.so (0x0000151ddd2c7000) libjulia.so.1 =\> /home/cer…

---

<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:** [March 9, 2021, 1:22pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/93 "2021-03-09T13:22:08Z")

</div>

Hi @certik! Of course I know who you are 😆, though I know you and @isuruf are probably sad to read about this.

> [@certik](#):
>
> I am the original author of [SymPy](https://sympy.org) and [SymEngine](https://github.com/symengine/symengine). Python is indeed too slow, so it is hard for SymPy to compete in terms of speed, but it is still very useful to a lot of people and there is a large community around it. The SymEngine project is written in C++ and it is _very_ fast (a few years ago it has been generally faster than any other computer algebra system that we tried, including Mathematica, Maple, GiNaC, Sage, SymPy, Maxima, etc.). @ChrisRackauckas have you run some benchmarks against SymEngine?

SymEngine is pretty fast. The release doesn’t mention performance qualms with SymEngine, only SymPy. The only performance qualms I have with SymEngine is the fact that specialized tools like FLINT can beat it in their specific regimes and we want to specialize the calls for that, but that’s relatively minor. It’s more features and the interaction with Julia’s expressions that came into play here.

> [@certik](#):
>
> Indeed, SymEngine is missing features compared to SymPy. We were hoping you would be interested in working with us to contribute them, especially since you were already using it. 🙂 Because if you do, then not just Julia, but every language including Python and SymPy would benefit.
> 
> It is easier for the Julia community to contribute if the code is written in Julia, just like it is easier for the Python community to contribute to SymPy since the code is in Python. That is true and growing the developer community is important.

We did contribute to the SymEngine community for years (community more than code), and it was the preferred symbolic underbelly of SciML through ParameterizedFunctions.jl for that a very long time. But there were some issues. One is that we just kept growing, and as our projects kept growing they needed more customization. Our symbols need arbitrary metadata to store information about types, `flow`ness, units, etc. for doing context pushing in ModelingToolkit (I’m sure adding a boolean `flow` to the symbol type in SymEngine’s C++ core would be a non-starter, but this kind of thing was crucial for us). I don’t know other CAS’s which allow arbitrary customization of carried metadata from Julia (which would also be an issue with Axiom, Maxima, etc.). We also need array symbolics, i.e. not arrays of symbolic variables but variables which represent arrays and act with non-commutative rules. So SymEngine is still probably a better CAS right now, but it isn’t a better CAS for ModelingToolkit.jl, which has been a big driver to this project.

I agree we could in theory contribute back to a C++ core, but the time cost of doing that in a lot of cases is rather high. It was easy to prototype some fixes in ModelingToolkit and then plan to add them back to SymEngine, but quickly we learned that no one ever got the energy. That’s to be expected though: there really isn’t a feature benefit to our projects to spend that time. So over time there was a drift until MTK essentially had a CAS, in which case @shashi stepped in and wrote a similar-in-style rewriting system with similar specializations, as a launching pad to start playing around with new ideas in the area. We integrated tools from AbstractAlgebra.jl (i.e. parts of the Nemo CAS), created a metadata system, parallelized the internal operations with task-based parallelism, created a very extravagant extension to `lambdify` known as `build_function`, and… it would take a huge amount of time to do some of this in C++!

But maybe what we learn can be helpful for SymEngine! I think there will be some healthy cross-pollination between the projects. I think a joint dev conference day where we just share ideas we found useful could be fun.

> [@certik](#):
>
> But I believe it is important to write libraries that can be used from any language. C++ is one of the options for such a common language. Last time I tried Julia’s ahead-of-time compilation to static executables was not yet as easy as with C++ or Fortran:

Right now our focus is just on making the experience for Julia users as good as possible. I agree that multi-language usage is a noble intention, but it’s not a priority for us. We instead need something that does not compromise to act seamlessly with Julia, and there were [always a few little hiccups](https://github.com/symengine/symengine/issues/1462) that were hard to solve by something that wasn’t made to exactly match Julia’s semantics. You’ll see why this “exactly match Julia” such a big deal for us with ModelingToolkit.jl when its paper comes out in 2 days (note the paper is not about CAS’s at all, but it’s built on Symbolics.jl and some important features).

---

<div class="post-metadata">

**Author:** ![certik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/certik/32/2651_2.png) [@certik](https://discourse.julialang.org/u/certik)\
**Post date:** [March 9, 2021, 1:51pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/94 "2021-03-09T13:51:28Z")

</div>

Thanks for the reply @ChrisRackauckas. Just couple points:

- I am not sad, I am happy for you and for Julia in general. As are most people that I know in the Python community. I am happy our work on SymEngine was an inspiration for you.

- Yes, let’s collaborate on the ideas, brainstorm, etc.

- SymEngine can use Flint as well as other specialized libraries and it has code that can convert from the general expression into the specialized one (typically a polynomial of some kind).

- The [issue](https://github.com/symengine/symengine/issues/1462) you pointed out is I think relatively easy to fix, I outlined how to fix it there, but I was hoping somebody who actually uses the Julia wrappers would help. You reported the issue, but never commented further. I personally didn’t have time to fix every issue for every language, that would not scale well. My goal was to get that particular language community to take care of the wrappers. It actually works moderately well overall. As you said, this particular issue even if I fixed it would not change your overall direction.

> [@ChrisRackauckas](#):
>
> I agree that multi-language usage is a noble intention, but it’s not a priority for us.

I think this sums it up. 🙂 Python is now one of the most used languages, but not everybody uses Python, so I was always motivated to create libraries that can truly be used by anyone (and to quite a large extent we succeeded with SymEngine, as it is or was used by quite a few people in Julia, although as you explained, ultimately you decided to write a library in Julia itself for many reasons). I think even if Julia becomes more popular than Python, there will still be people who will use other languages.

However, it could be argued that it is the job of the Julia compiler and language itself to allow it to be used from other languages more easily, not of Symbolics.jl. Then Julia could become the “common language”.

---

<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:** [March 9, 2021, 2:05pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/95 "2021-03-09T14:05:09Z")

</div>

> [@certik](#):
>
> - SymEngine can use Flint as well as other specialized libraries and it has code that can convert from the general expression into the specialized one (typically a polynomial of some kind).

Yeah we’re investigating adding a `Poly` type to the group which dispatches over to AbstractAlgebra.jl. Maybe it’s similar in spirit? We’ll let you know how that all goes.

> [@certik](#):
>
> I think this sums it up. 🙂 Python is now one of the most used languages, but not everybody uses Python, so I was always motivated to create libraries that can truly be used by anyone (and to quite a large extent we succeeded with SymEngine, as it is or was used by quite a few people in Julia, although as you explained, ultimately you decided to write a library in Julia itself for many reasons). I think even if Julia becomes more popular than Python, there will still be people who will use other languages.

Take it as a major compliment that you kept our attention for almost 4 years. We’re the power-iest of power users, so we always kind of knew that sooner or later we’d outgrow something that’s wrapped. Hell, the only reason Julia works for us is because we keep a direct line to Julialang/julia and the people who work on the compiler. We’ve been asking and funding all sorts of new features in Julia itself, like the new abstract interpreter, changed parsing of `+` and `*`, changes to allowed unicode, etc. I have an ongoing monthly reminder to bug @jeff.bezanson about adding support for types of the form `X{T} <: T` where `T` is non-concrete (a feature we want for controlling symbolic dispatching with metadata 😉). We want the weird stuff, and so the fact that we were satisfied by SymEngine for so long means it’s pretty good. But as we make Symbolics.jl more customized towards Julia (and customize Julia to support it), it will keep getting harder and harder to support everything cross-language with a simple syntax, and it’s hard for us to justify the time there because that’s not our priority.

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [March 9, 2021, 3:18pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/96 "2021-03-09T15:18:18Z")

</div>

_from one of the current **yacas** developers_

Hi,

Let me start from a simple explanation - I’ve joined the project when it was already very advanced, and it wasn’t me who actually did majority of work. Nevertheless, having done some work on yacas, and having used yacas in my other projects, I came to some conclusions.

First of all, the language is quite fragile, and could use redesign. There are a couple of issues, but I would consider the scope of symbols to be the worst offender, especially when macros are involved. Also, the pattern matching machinery is not flexible enough.

Another big issue stems from the fact that in the beginning yacas grown very quickly. Thanks to this there is a lot of interesting functionality. But it came at a significant cost - yacas badly lacks good implementation of core mathematical concepts. As a result the more specialized functionality either has some workarounds for the missing bits, or is not general enough. By the core mathematical concepts I mean sets, assumptions and basic algebraic structures.

To conclude - if I were starting yet another computer algebra system now, I’d put much more effort into designing the language (including better pattern matching) and into providing reasonable set of core mathematical concepts before implementing the applicative functionality. And again, with the applicative functionality I’d go slower, making sure to provide at least the right interface before building anything on top.

This is just from the top off my head. I hope that you’ll find this useful. Let me know if you want to know any more details.

Cheers,  
Grzesiek

---

<div class="post-metadata">

**Author:** ![antoine-levitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoine-levitt/32/4008_2.png) [@antoine-levitt](https://discourse.julialang.org/u/antoine-levitt)\
**Post date:** [March 9, 2021, 3:20pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/97 "2021-03-09T15:20:45Z")

</div>

> [@certik](#):
>
> However, it could be argued that it is the job of the Julia compiler and language itself to allow it to be used from other languages more easily, not of Symbolics.jl. Then Julia could become the “common language”.

This is already possible (see pyjulia and the julia doc for C) and looks reasonably easy, although I don’t have any direct experience with it.

---

<div class="post-metadata">

**Author:** ![rfateman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfateman/32/22507_2.png) [@rfateman](https://discourse.julialang.org/u/rfateman)\
**Post date:** [March 9, 2021, 4:23pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/98 "2021-03-09T16:23:03Z")

</div>

…(trying, responding as email…) (editing. Apparently my email system fills in characters like apostrophe and tab ? from some weird font. Sorry)

> These projects can’t be specified directly in Maxima or built in  
> Maxima. That would break abstract interpretation of Julia code, which  
> is one of the core features we need for some of the ModelingToolkit  
> features.

I do not understand this.  
Anything at all can be expressed in functional notation with tags like this  
The\_Integer\_Result ( The\_Integer\_Plus (The\_Integer(4), The\_Integer(5)))

or the tags can be implicit in the names as

declare([x,y], integer)  
x+y

I don’t know how this Julia requirement of abstract interpretation  
corresponds to Maxima, but perhaps this:

external syntax: x+y  
internal representation (which might count as some kind of  
intermediate code, but here is just Lisp)…  
((mplus) $x $y) … or if simplified ((mplus simp) $x $y)

> That said, there’s nothing that stops Symbolics.jl from making it  
> easy to call a few algorithms from Maxima like we do from  
> AbstractAlgebra.jl/Nemo.jl.

In order to do so you presumably need to have functionality, in Maxima  
or in Julia or both…

Convert\_from\_Julia\_to\_Maxima (arbitrary\_expression\_in\_Julia)  
Convert\_from\_Maxima\_to\_Julia(arbitrary\_expression\_in\_Maxima )

The arbitrary Maxima expression might extend beyond simple algebraic  
expressions to equations, differential forms,  
matrices, function definitions, series, strings, files, …  
If there is something that Maxima can represent and Julia cannot, that  
is suggestive of an area  
to check out. Is this a deliberate omission?

If there is something that Julia can represent, but Maxima cannot now  
(or with some handiwork) ever, represent,  
that would be interesting to see.

> ```
> rfateman:
> 
> If symbolic indefinite integration is of special interest (not
> that it is likely to be directly used in applications) there
> are other implementations of the Risch algorithm, most
> notably the one in Axiom/Fricas
> 
> ```
> 
> Maxima would be easier to get to given it’s already wrapped. What  
> would be the reasons to additionally wrap Axiom/Fricas, i.e. what do  
> they do better than Maxima?

There are claims that the Risch algorithm in Axiom is superior.Â The  
Axiom world view (categories, types, etc.) may be more supportive of the  
Julia world view than other CAS like Maxima, Mathematica, maybe Maple,  
ReduceÂ (there was a “mode-Reduce” for a while)

> ```
> rfateman:
> 
> The python version seems to have stalled, but I have not followed
> it recently. I think the time needed to load and parse thousands
> of Rubi rules was excessive. I don't know if this has been
> addressed.
> 
> ```
> 
> Yeah, SymPy Rubi is apparently really good, outperforming Maxima (not  
> in compute speed but in integrals it can solve) after adding it:
> 
> [Rubi integrator · Issue #12233 · sympy/sympy · GitHub](https://github.com/sympy/sympy/issues/12233#issuecomment-463700534)  
> [https://github.com/sympy/sympy/issues/12233#issuecomment-463700534](https://github.com/sympy/sympy/issues/12233#issuecomment-463700534)
> 
> But it’s still in a PR because Python is too slow. Definitely a case  
> for Julia to step in.

I think it is pretty clear that Rubi could be stuffed into Maxima if  
there were a sufficiently motivated individual  
[to pick up where I left off, or start from scratch.] My concern for  
the implementations of Rubi  
on top of X is that when X is Mathematica, Rubi can rely on various  
features – but those features might be missing  
from other systems. If the other system doesn’t have (say) sufficient  
simplification programs, thenRubi might not really work so well. Note that the decision problem “Is this expression equivalent to 0” is provably unsolvable for a large enough class of expressions, so there is a range of capabilities that might exist in any given system.  
This result due to Daniel Richardson, has the consequence that the problem “does this integration problem have a solution in terms of elementary functions” is recursively unsolvable…)

And as I’ve mentioned, symbolic INdefinite integration is not a big  
seller. Look at published tables. A very small portion covers indefinite integrals.

Definite integration could be entirely numerical – that is solved by quadrature programs, but  
with non-numeric parameters  
it becomes interesting symbolically. To do that relying on the  
fundamental theorem of calculus  
is not a great idea, since the interesting tasks require contour  
integration. Paul Wang’s MIT  
thesis worried about that. There are subsequent developments that  
could be influential, using  
clever special functions, but FTOC is not enough. You might not even  
be able to tell if FTOC works unless you can satisfactorily analyze the behavior of an arbitrary  
expression of several complex variables on a path  
of integration.

Another approach to definite integration, sort of Rubi-like, is to take  
all the information in (say) the DLMF , digital  
library of mathematical functions, and store/retrieve it automatically.  
A pointer to an incomplete version of this – my old TILU project.

I assume there are packages (say for ODE solving) that benefit from the  
Julia environment, but understanding the dependency would be useful, if  
the intent is to become “more symbolic” in the future.

---

<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:** [March 10, 2021, 2:16pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/99 "2021-03-10T14:16:34Z")

</div>

> [@rfateman](#):
>
> The\_Integer\_Result ( The\_Integer\_Plus (The\_Integer(4), The\_Integer(5)))
> 
> or the tags can be implicit in the names as
> 
> declare([x,y], integer)  
> x+y
> 
> I don’t know how this Julia requirement of abstract interpretation  
> corresponds to Maxima

> [@rfateman](#):
>
> I assume there are packages (say for ODE solving) that benefit from the  
> Julia environment, but understanding the dependency would be useful, if  
> the intent is to become “more symbolic” in the future.

These two are related, this is the big point. The ModelingToolkit.jl paper is out now and explains some of those details:

> **[Generalizing Automatic Differentiation to Automatic Sparsity, Uncertainty,...](https://www.stochasticlifestyle.com/generalizing-automatic-differentiation-to-automatic-sparsity-uncertainty-stability-and-parallelism/)**
>
> Automatic differentiation is a “compiler trick” whereby a code that calculates f(x) is transformed into a code that calculates f'(x). This trick and its two forms, forward and reverse mode automatic differentiation, have become the pervasive backbone...

> **[ModelingToolkit: A Composable Graph Transformation System For Equation-Based...](https://arxiv.org/abs/2103.05244)**
>
> Getting good performance out of numerical equation solvers requires that the user has provided stable and efficient functions representing their model. However, users should not be trusted to write good code. In this manuscript we describe...

To me, the main purpose of such a CAS is to support such computations within abstract interpretation, mixing with the language and libraries like ChainRules.jl. That’s where it comes from, and it would be hard for something not embedded within the host language to interop seamlessly in some of these applications. Of course, we can still call out to some other libraries here and there, but this is why it is important that the graph building is really Julia-based.

> [@rfateman](#):
>
> The arbitrary Maxima expression might extend beyond simple algebraic  
> expressions to equations, differential forms,  
> matrices, function definitions, series, strings, files, …  
> If there is something that Maxima can represent and Julia cannot, that  
> is suggestive of an area  
> to check out. Is this a deliberate omission?

No, conversions would be fine. We do it with AbstractAlgebra already, we could do it with others where it makes sense. Sounds like using the Axiom Risch is one of those places where it could. Not a default so that the dependencies are low, but an extension `axiom_risch(ex)` that converts, integrates, and converts back would be interesting to have around.

---

<div class="post-metadata">

**Author:** ![bilderbuchi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bilderbuchi/32/13562_2.png) [@bilderbuchi](https://discourse.julialang.org/u/bilderbuchi)\
**Post date:** [March 10, 2021, 4:15pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/100 "2021-03-10T16:15:29Z")

</div>

That’s quite the interesting paper!  
(I was a bit surprised though that there is no link to the MTK repository/website, and that the code that was used to compute the results of the paper is not referenced/made available)

Seeing as you seem to be positioning MTK (among other things) as a Modelica competitor: One of the strong attractions of using Modelica (for a simple user/modeler) is the availability of a comprehensive and vetted [Standard Library](https://github.com/modelica/ModelicaStandardLibrary) of compatible/standardised components/building blocks. Do you have plans to create something similar for MTK usage? Or maybe some kind of framework to let the community assemble/create a collection of specialised sub-libraries?

Also, how familiar are you with MetaModelica, which also seems to me an effort towards unifying the modelling and the solution/computation domains in one language, like you do with Julia and MTK here. See [this recent paper](https://ep.liu.se/en/conference-article.aspx?series=ecp&issue=157&Article_No=30) on it that also compares to Julia.

---

<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:** [March 10, 2021, 4:31pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/101 "2021-03-10T16:31:15Z")

</div>

I think I’ve seen some mention of a tool (? function named `dymola`?) which can read Modelica code and convert it to ModelingToolkit code.

An important element in several Modelica tools is a flow sheeting tool (somehow similar to Simulink) which makes it possible to drag and drop model units from a palette/library onto a canvas, and then connect the units graphically. I don’t know if there are plans for something like that in ModelingToolkit, though.

---

<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:** [March 10, 2021, 4:37pm UTC](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251/102 "2021-03-10T16:37:43Z")

</div>

> [@bilderbuchi](#):
>
> Seeing as you seem to be positioning MTK (among other things) as a Modelica competitor: One of the strong attractions of using Modelica (for a simple user/modeler) is the availability of a comprehensive and vetted [Standard Library](https://github.com/modelica/ModelicaStandardLibrary) of compatible/standardised components/building blocks. Do you have plans to create something similar for MTK usage? Or maybe some kind of framework to let the community assemble/create a collection of specialised sub-libraries?

We’re building out a standard library right now. There’s going to be a few announcements on that in a few months. There’s just far too much to write about 😆.

> [@bilderbuchi](#):
>
> (I was a bit surprised though that there is no link to the MTK repository/website, and that the code that was used to compute the results of the paper is not referenced/made available)

They are tutorials in the documentation.

[https://mtk.sciml.ai/dev/mtkitize\_tutorials/modelingtoolkitize\_index\_reduction/](https://mtk.sciml.ai/dev/mtkitize_tutorials/modelingtoolkitize_index_reduction/)

[https://mtk.sciml.ai/dev/tutorials/tearing\_parallelism/](https://mtk.sciml.ai/dev/tutorials/tearing_parallelism/)

> [@bilderbuchi](#):
>
> Also, how familiar are you with MetaModelica, which also seems to me an effort towards unifying the modelling and the solution/computation domains in one language, like you do with Julia and MTK here. See [this recent paper](https://ep.liu.se/en/conference-article.aspx?series=ecp&issue=157&Article_No=30) on it that also compares to Julia.

I think that’s a lot more work than just embedding it into Julia and getting Julia’s semantics for free! Plus you lose the whole community: the community of a programming language is very large in comparison to modeling tools. This is also way MTK has Symbolics.jl underneath it: why implement derivatives and simplify and all of that specifically for a modeling language? If you abstract that out to be over a CAS, you can then support a larger project, but grow a larger community around it. Overall you end up getting a lot more “user coverage” finding what works and what doesn’t.

[Previous page](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251.md?page=4)

[Next page](https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251.md?page=6)
