# \#symbolic-utils

**URL:** https://discourse.julialang.org/tag/symbolic-utils/785.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Associativity / Commutativity for Boolean operations in SymbolicUtils.jl](https://discourse.julialang.org/t/associativity-commutativity-for-boolean-operations-in-symbolicutils-jl/136468)

<div class="topic-metadata">

**Author:** [@logic](https://discourse.julialang.org/u/logic)\
**Replies:** 5\
**Last updated:** [March 31, 2026, 5:11pm UTC](https://discourse.julialang.org/t/associativity-commutativity-for-boolean-operations-in-symbolicutils-jl/136468 "2026-03-31T17:11:58Z")

</div>

I’m working on a Boolean Algebra Rewriter with SymbolicUtils.jl, and I’ve noticed that for some reason, associativity and commutativity are not being properly applied for Boolean operations, which makes defining rules pa…

---

## [\[ANN\] SymbolicIntegration.jl - indefinite integration with Symbolics.jl symbols](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777)

<div class="topic-metadata">

**Author:** [@CiccioPasticcio](https://discourse.julialang.org/u/CiccioPasticcio)\
**Replies:** 28\
**Last updated:** [January 5, 2026, 10:12am UTC](https://discourse.julialang.org/t/ann-symbolicintegration-jl-indefinite-integration-with-symbolics-jl-symbols/134777 "2026-01-05T10:12:25Z")

</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 us…

---

## [Simplifying trigonometric expressions in \`Symbolics\` and \`SymbolicUtils\`](https://discourse.julialang.org/t/simplifying-trigonometric-expressions-in-symbolics-and-symbolicutils/132160)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 1\
**Last updated:** [September 7, 2025, 10:33pm UTC](https://discourse.julialang.org/t/simplifying-trigonometric-expressions-in-symbolics-and-symbolicutils/132160 "2025-09-07T22:33:42Z")

</div>

Hi, I am new to Symbolics.jl and trying to verify the following trigonometric expression arising in energy system using the package: \\begin{align\*} v\_k(t) &= \\bar{V} \\cos(\\omega t + \\phi\_k) \\\\ i\_k(t) &=…

---

## [Julia Broadcasting Issue with SubArray in Complex Expressions](https://discourse.julialang.org/t/julia-broadcasting-issue-with-subarray-in-complex-expressions/127269)

<div class="topic-metadata">

**Author:** [@chooron](https://discourse.julialang.org/u/chooron)\
**Replies:** 2\
**Last updated:** [March 23, 2025, 6:35am UTC](https://discourse.julialang.org/t/julia-broadcasting-issue-with-subarray-in-complex-expressions/127269 "2025-03-23T06:35:53Z")

</div>

I’m encountering an issue with Julia broadcasting when working with SubArrays in complex nested expressions. When using @views to create SubArrays and then applying broadcasting with @. to complex expressions, I get type…

---

## [Registering functions with several arguments in Symbolics](https://discourse.julialang.org/t/registering-functions-with-several-arguments-in-symbolics/96359)

<div class="topic-metadata">

**Author:** [@PABLO\_ESTEBAN\_MONTES](https://discourse.julialang.org/u/PABLO_ESTEBAN_MONTES)\
**Replies:** 4\
**Last updated:** [February 27, 2025, 10:34pm UTC](https://discourse.julialang.org/t/registering-functions-with-several-arguments-in-symbolics/96359 "2025-02-27T22:34:13Z")

</div>

Hello I have an issue of scalability with registering functions in Julia. I need to register a function of several variables in order to be able to define derivatives of that function, so that Symbolics can stop tracing…

---

## [Invitation to participate in the International Symposium on Symbolic and Algebraic Computation](https://discourse.julialang.org/t/invitation-to-participate-in-the-international-symposium-on-symbolic-and-algebraic-computation/125930)

<div class="topic-metadata">

**Author:** [@suavesito](https://discourse.julialang.org/u/suavesito)\
**Replies:** 0\
**Last updated:** [February 15, 2025, 2:29am UTC](https://discourse.julialang.org/t/invitation-to-participate-in-the-international-symposium-on-symbolic-and-algebraic-computation/125930 "2025-02-15T02:29:22Z")

</div>

This year, the International Symposium on Symbolic and Algebraic Computation (ISSAC) will take place from July 28 to August 1, 2025 (dates and topics page) at CIMAT Guanajuato, Mexico, where I study. I wanted to invite …

---

## [Symbolics.jl - failing to simplify N-over-1 rational literals within expression](https://discourse.julialang.org/t/symbolics-jl-failing-to-simplify-n-over-1-rational-literals-within-expression/125446)

<div class="topic-metadata">

**Author:** [@jl\_enthusiast](https://discourse.julialang.org/u/jl_enthusiast)\
**Replies:** 4\
**Last updated:** [February 6, 2025, 9:28pm UTC](https://discourse.julialang.org/t/symbolics-jl-failing-to-simplify-n-over-1-rational-literals-within-expression/125446 "2025-02-06T21:28:54Z")

</div>

Hi, I am currently trying to write some custom simplification rules throughout different stages of a symbolic manipulation process. One thing I noticed is that no matter how I try, I can’t come up with a rule that canc…

---

## [Applying sin(-x)=-sin(x) with SymbolicUtils](https://discourse.julialang.org/t/applying-sin-x-sin-x-with-symbolicutils/124002)

<div class="topic-metadata">

**Author:** [@ValterDelft](https://discourse.julialang.org/u/ValterDelft)\
**Replies:** 3\
**Last updated:** [December 20, 2024, 9:27pm UTC](https://discourse.julialang.org/t/applying-sin-x-sin-x-with-symbolicutils/124002 "2024-12-20T21:27:18Z")

</div>

Hi, I am trying to simplify some trigonometric expressions using SymbolicUtils. After applying the product rules for sine and cosine terms, you can end up with negative arguments and I would like to implement the followi…

---

## [Rewrite rule to transform (a\*b\*c\*d\*...)^(-1) to (a^(-1)\*b^(-1)\*c^(-1)\*d^(-1)\*...)](https://discourse.julialang.org/t/rewrite-rule-to-transform-a-b-c-d-1-to-a-1-b-1-c-1-d-1/114569)

<div class="topic-metadata">

**Author:** [@VPBML](https://discourse.julialang.org/u/VPBML)\
**Replies:** 2\
**Last updated:** [December 13, 2024, 4:41pm UTC](https://discourse.julialang.org/t/rewrite-rule-to-transform-a-b-c-d-1-to-a-1-b-1-c-1-d-1/114569 "2024-12-13T16:41:54Z")

</div>

Hi, I wonder if we can define a rule with SymbolicUtils to rewrite (abcd…)^(-1) to (a^(-1)\*b^(-1)\*c^(-1)d^(-1)…) which would work with an arbitrary number of arguments. I would really appreciate it if you could give me …

---

## [Symbolic rewriter rules for symbolic functions](https://discourse.julialang.org/t/symbolic-rewriter-rules-for-symbolic-functions/123131)

<div class="topic-metadata">

**Author:** [@erny123](https://discourse.julialang.org/u/erny123)\
**Replies:** 2\
**Last updated:** [November 28, 2024, 8:13pm UTC](https://discourse.julialang.org/t/symbolic-rewriter-rules-for-symbolic-functions/123131 "2024-11-28T20:13:42Z")

</div>

I have something simple that there seems to be no answer anywhere. I make a symbolic function and none of the re-writing rules work on it. using SymbolicUtils using Symbolics using Latexify using Plots using LaTeXString…

---

## [Troubleshooting allocations in SymbolicUtils code](https://discourse.julialang.org/t/troubleshooting-allocations-in-symbolicutils-code/122027)

<div class="topic-metadata">

**Author:** [@ctessum](https://discourse.julialang.org/u/ctessum)\
**Replies:** 2\
**Last updated:** [November 1, 2024, 8:57am UTC](https://discourse.julialang.org/t/troubleshooting-allocations-in-symbolicutils-code/122027 "2024-11-01T08:57:34Z")

</div>

Hello! I have some a model here that is having some performance issues. I’ve included below a screenshot of a performance profile: As you can see, the majority of the time is being taken up by a macro expansion in S…

---

## [Register\_symbolic with arrays: What am I doing wrong](https://discourse.julialang.org/t/register-symbolic-with-arrays-what-am-i-doing-wrong/118655)

<div class="topic-metadata">

**Author:** [@HSnowden](https://discourse.julialang.org/u/HSnowden)\
**Replies:** 11\
**Last updated:** [September 12, 2024, 11:52am UTC](https://discourse.julialang.org/t/register-symbolic-with-arrays-what-am-i-doing-wrong/118655 "2024-09-12T11:52:06Z")

</div>

Hello, I am unable to register a symbolic function that takes an array and returns a scalar. This makes me think I need to use register\_symbolic rather than the array counterpart. However, the array that is sent is a Ve…

---

## [Struggling with defining a good factorization rule in SymbolicUtils.jl](https://discourse.julialang.org/t/struggling-with-defining-a-good-factorization-rule-in-symbolicutils-jl/111522)

<div class="topic-metadata">

**Author:** [@Alseidon](https://discourse.julialang.org/u/Alseidon)\
**Replies:** 8\
**Last updated:** [August 29, 2024, 11:07pm UTC](https://discourse.julialang.org/t/struggling-with-defining-a-good-factorization-rule-in-symbolicutils-jl/111522 "2024-08-29T23:07:03Z")

</div>

I started playing with Symbolics.jl but started needing more rewriting rules than what’s currently proposed. Taking a quick look at the rewrite docs, I don’t understand why some of the examples below don’t work. using S…

---

## [Julia Symbolics error when taking derivative of a quotient](https://discourse.julialang.org/t/julia-symbolics-error-when-taking-derivative-of-a-quotient/118007)

<div class="topic-metadata">

**Author:** [@orebas](https://discourse.julialang.org/u/orebas)\
**Replies:** 3\
**Last updated:** [August 11, 2024, 1:40am UTC](https://discourse.julialang.org/t/julia-symbolics-error-when-taking-derivative-of-a-quotient/118007 "2024-08-11T01:40:07Z")

</div>

I’m getting an error, taking derivatives of expressions with quotients, that seems to be coming from Symbolics.jl or maybe SymbolicUtils.jl. It may be related to https://github.com/JuliaSymbolics/Symbolics.jl/issues/11…

---

## [How to convert a string to a symbolic expression?](https://discourse.julialang.org/t/how-to-convert-a-string-to-a-symbolic-expression/104527)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [October 5, 2023, 8:36am UTC](https://discourse.julialang.org/t/how-to-convert-a-string-to-a-symbolic-expression/104527 "2023-10-05T08:36:45Z")

</div>

How can I convert a string to a symbolic expression? The following code fails: using Symbolics @variables R a A Γ ρ U Q Q1 Q = 0.5A\*R\*a\*Γ\*ρ\*(U^2) Q\_string::String = repr(Q) # how to convert Q\_string back into a symb…

---

## [Substitution and simplification of terms that do not appear explicitly, using \`Symbolics.jl\` (and \`SymbolicUtils.jl\`)](https://discourse.julialang.org/t/substitution-and-simplification-of-terms-that-do-not-appear-explicitly-using-symbolics-jl-and-symbolicutils-jl/96458)

<div class="topic-metadata">

**Author:** [@johannesnauta](https://discourse.julialang.org/u/johannesnauta)\
**Replies:** 6\
**Last updated:** [March 23, 2023, 5:50pm UTC](https://discourse.julialang.org/t/substitution-and-simplification-of-terms-that-do-not-appear-explicitly-using-symbolics-jl-and-symbolicutils-jl/96458 "2023-03-23T17:50:39Z")

</div>

Hi everyone. I am encountering a problem where I want to solve and simplify a specific set of equations. Even in a very simple use case I cannot get simplify(expr) to do simple substitutions if the elements to be substi…

---

## [How to get Simplified variance of a random variable?](https://discourse.julialang.org/t/how-to-get-simplified-variance-of-a-random-variable/95071)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 6\
**Last updated:** [February 28, 2023, 5:14am UTC](https://discourse.julialang.org/t/how-to-get-simplified-variance-of-a-random-variable/95071 "2023-02-28T05:14:53Z")

</div>

Hi all, I want to use Julia to get the end result like this: the Expectation of (X - \\mu)^{2} will be computed at the end to become: E(X^{2}) - \\mu^{2} but how? this is my try out: using SymPy # https://docs.symp…

---

## [How to define a simple Boolean term rewriter properly in Symbolics?](https://discourse.julialang.org/t/how-to-define-a-simple-boolean-term-rewriter-properly-in-symbolics/90749)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 1\
**Last updated:** [November 28, 2022, 7:09am UTC](https://discourse.julialang.org/t/how-to-define-a-simple-boolean-term-rewriter-properly-in-symbolics/90749 "2022-11-28T07:09:06Z")

</div>

We know that a & a = a holds for a Boolean variable a. However, this rule is missing in SymbolicUtils.jl. julia\> using SymbolicUtils julia\> r = @rule ~x & ~x =\> ~x ~x & ~x =\> ~x julia\> @syms a::Bool b::Bool (a, b) j…

---

## [Accessing arguments of a symbolic expression using SymbolicUtils.jl](https://discourse.julialang.org/t/accessing-arguments-of-a-symbolic-expression-using-symbolicutils-jl/85600)

<div class="topic-metadata">

**Author:** [@hpieper14](https://discourse.julialang.org/u/hpieper14)\
**Replies:** 3\
**Last updated:** [August 11, 2022, 1:48pm UTC](https://discourse.julialang.org/t/accessing-arguments-of-a-symbolic-expression-using-symbolicutils-jl/85600 "2022-08-11T13:48:10Z")

</div>

Hi everyone, I have a question about the arguments of a symbolic expression in the case it is constructed from array variables. Suppose I have an symbolic array and I use it to construct a symbolic expression: @paramet…

---

## [Symbolics.jl | Interfacing - building an expression tree to use custom rules](https://discourse.julialang.org/t/symbolics-jl-interfacing-building-an-expression-tree-to-use-custom-rules/85264)

<div class="topic-metadata">

**Author:** [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Replies:** 4\
**Last updated:** [August 4, 2022, 12:44am UTC](https://discourse.julialang.org/t/symbolics-jl-interfacing-building-an-expression-tree-to-use-custom-rules/85264 "2022-08-04T00:44:09Z")

</div>

Hello, I would like to use the SymbolicUtils composing rewriter Fixpoint(rw) which returns a rewriter which applies rw repeatedly until there are no changes to be made to apply a custom rule to a Symbolics.jl expres…

---

## [Simple vector algebra with Symbolics/SymbolicUtils](https://discourse.julialang.org/t/simple-vector-algebra-with-symbolics-symbolicutils/79054)

<div class="topic-metadata">

**Author:** [@nchisholm](https://discourse.julialang.org/u/nchisholm)\
**Replies:** 6\
**Last updated:** [July 11, 2022, 6:21pm UTC](https://discourse.julialang.org/t/simple-vector-algebra-with-symbolics-symbolicutils/79054 "2022-07-11T18:21:38Z")

</div>

I am trying to define a simple symbolic vector type to use with the Symbolics and/or SymbolicUtils packages. I have looked through the documentation of these packages, but I am still at a loss. I am aware that Symbolic…

---

## [Substitute powers and powers of fractions](https://discourse.julialang.org/t/substitute-powers-and-powers-of-fractions/80641)

<div class="topic-metadata">

**Author:** [@kjellqvist](https://discourse.julialang.org/u/kjellqvist)\
**Replies:** 4\
**Last updated:** [June 22, 2022, 2:36am UTC](https://discourse.julialang.org/t/substitute-powers-and-powers-of-fractions/80641 "2022-06-22T02:36:22Z")

</div>

I’m a bit stuck on substitutions, for example: @variables x y eq = (1/x)^2 substitute(eq, Dict(\[1/x =\> y\])) julia\> y^2 whereas @variables x y eq = 1/x^2 substitute(eq, Dict(\[1/x =\> y\])) julia\> 1 / (x^2) I w…

---

## [Symbolics istree returning false when there is a tree](https://discourse.julialang.org/t/symbolics-istree-returning-false-when-there-is-a-tree/82993)

<div class="topic-metadata">

**Author:** [@infiniteFun](https://discourse.julialang.org/u/infiniteFun)\
**Replies:** 4\
**Last updated:** [June 20, 2022, 1:29am UTC](https://discourse.julialang.org/t/symbolics-istree-returning-false-when-there-is-a-tree/82993 "2022-06-20T01:29:00Z")

</div>

Hello, I have the following scenario that I’m unable to understand in Symbolics. It would be great if somebody could help me with that: using ModelingToolkit @variables t x(t) D = Differential(t) eqs = \[D(x) ~ x\] eq…

---

## [Convert Symbolic expression to a function](https://discourse.julialang.org/t/convert-symbolic-expression-to-a-function/80225)

<div class="topic-metadata">

**Author:** [@Jack](https://discourse.julialang.org/u/Jack)\
**Replies:** 5\
**Last updated:** [April 29, 2022, 8:57am UTC](https://discourse.julialang.org/t/convert-symbolic-expression-to-a-function/80225 "2022-04-29T08:57:13Z")

</div>

Greetings. I am trying to convert the a very simple example of the following using SymbolicUtils @syms x f = 2\*x the f into a function that would evaluate at a concrete number of x, so ideally it’s a function that has …

---

## [How to create symbolic rewrite rules with new variables?](https://discourse.julialang.org/t/how-to-create-symbolic-rewrite-rules-with-new-variables/75511)

<div class="topic-metadata">

**Author:** [@Zer0](https://discourse.julialang.org/u/Zer0)\
**Replies:** 1\
**Last updated:** [January 31, 2022, 2:28pm UTC](https://discourse.julialang.org/t/how-to-create-symbolic-rewrite-rules-with-new-variables/75511 "2022-01-31T14:28:26Z")

</div>

Hi all, I am not sure where to put this topic, and I am still fairly new to Julia. So I put it in “New to Julia”. :sweat\_smile: I was playing around with symbolic-utils a little. I like the straight forward rule-based …

---

## [Generate function with keyword arguments from \`Symbolics\` expression](https://discourse.julialang.org/t/generate-function-with-keyword-arguments-from-symbolics-expression/74556)

<div class="topic-metadata">

**Author:** [@adomasbaliuka](https://discourse.julialang.org/u/adomasbaliuka)\
**Replies:** 3\
**Last updated:** [January 19, 2022, 1:14pm UTC](https://discourse.julialang.org/t/generate-function-with-keyword-arguments-from-symbolics-expression/74556 "2022-01-19T13:14:31Z")

</div>

In what is now clearly a fool’s errand, I’m trying to copy and type out equations from publications, render them as LaTeX and then transform them into Julia code, with as little room for accidental errors as possible. (M…

---

## [MathOptInterface and Symbolics.jl](https://discourse.julialang.org/t/mathoptinterface-and-symbolics-jl/74575)

<div class="topic-metadata">

**Author:** [@sidpatil](https://discourse.julialang.org/u/sidpatil)\
**Replies:** 1\
**Last updated:** [January 13, 2022, 7:53pm UTC](https://discourse.julialang.org/t/mathoptinterface-and-symbolics-jl/74575 "2022-01-13T19:53:20Z")

</div>

In the announcement for Symbolics.jl, JuMP is mentioned due to its independent implementation of symbolic variables and expressions. Is it feasible to refactor/rewrite MathOptInterface to use Symbolics.jl variables and …

---

## [Simplify with Symbolics.jl](https://discourse.julialang.org/t/simplify-with-symbolics-jl/73545)

<div class="topic-metadata">

**Author:** [@sungj](https://discourse.julialang.org/u/sungj)\
**Replies:** 2\
**Last updated:** [December 23, 2021, 10:32pm UTC](https://discourse.julialang.org/t/simplify-with-symbolics-jl/73545 "2021-12-23T22:32:13Z")

</div>

Hi, How can I simplify this simple expression? julia\> using Symbolics julia\> @variables x, y, z 3-element Vector{Num}: x y z julia\> simplify( cos(x)^2\*cos(y)^2\*cos(z)^2 + cos(x)^2\*sin(y)^2\*cos(z)^2 ) (cos(x)^2)\*(c…

---

## [Symbolics.jl: Simplify divisions assuming a variable is not zero](https://discourse.julialang.org/t/symbolics-jl-simplify-divisions-assuming-a-variable-is-not-zero/68406)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 2\
**Last updated:** [September 19, 2021, 12:09pm UTC](https://discourse.julialang.org/t/symbolics-jl-simplify-divisions-assuming-a-variable-is-not-zero/68406 "2021-09-19T12:09:54Z")

</div>

How can I use Symbolics.jl to simplify divisions assuming a variable is not zero? For example, I would like to get 1 from julia\> using Symbolics julia\> @variables x 1-element Vector{Num}: x julia\> simplify(x / x) # …

---

## [A Recap of the state of the Symbolics ecosystem](https://discourse.julialang.org/t/a-recap-of-the-state-of-the-symbolics-ecosystem/68022)

<div class="topic-metadata">

**Author:** [@0x0f0f0f](https://discourse.julialang.org/u/0x0f0f0f)\
**Replies:** 7\
**Last updated:** [September 17, 2021, 3:52pm UTC](https://discourse.julialang.org/t/a-recap-of-the-state-of-the-symbolics-ecosystem/68022 "2021-09-17T15:52:24Z")

</div>

The introduction of TermInterface.jl has allowed for large potential in generalization of term rewriting and symbolic analysis and manipulation features. Also, it’s been a few months we’ve been talking about the integrat…

[Next page](https://discourse.julialang.org/tag/symbolic-utils/785.md?match_all_tags=true&page=1&tags%5B%5D=symbolic-utils)
