Coloring symbols in equations

88 views
Skip to first unread message

Eduardo Cavazos

unread,
Jan 5, 2026, 8:50:51 PMJan 5
to sympy
Hello 🙋‍♂️

I've been experimenting with using colors for symbols in equations:

Untitled.png

First I display the list of equations.
`values` is a dict of symbols and their numerical values.
`want` is the symbol I want to solve for.

`display_equations_`:
shows the `values` symbols in green
shows the `want` symbol in red

I then solve the system of equations for the wanted symbol.

The result is displayed:
red on the left
only greens on the right

Question:
Is there already a library out there for this?
Just wanted to review similar projects if there are any.

Thank you!
Ed

gu...@uwosh.edu

unread,
Jan 6, 2026, 10:03:13 AMJan 6
to sympy
Ed,

The coloring is sort of cool. Am I correct that the intention to help people visualize what is known and what is being solved for?

If you are interested in using Sympy for algebraic manipulations I suggest you look at my package Algebra_with_Sympy because the plain vanilla Eq class you are using can collapse to True or False unexpectedly. Algebra_with_Sympy implements an additional equation class that will not collapse. Along with many convenience tools for doing step wise algebra in IPython environments (including Jupyter notebooks, with typeset expressions). There is no color coding tools in Algebra_with_Sympy, but if you are interested in collaborating, I think it would not be a difficult addition.

Regards,
Jonathan

Chris Smith

unread,
Jan 7, 2026, 2:23:33 PMJan 7
to sympy
I agree with the value of colorization. I was just experimenting with coloring passwords with different colors for lower case, uppercase, and digits/punctuation after realizing that I kind of use tone in mental recitation to indicate uppercase. In the same spirit it might be interesting to have colors for variables of interest, other variables, and constants.

/c

gu...@uwosh.edu

unread,
Jan 7, 2026, 2:49:48 PMJan 7
to sympy
However this is pursued some thought should be given to the choices of colors to meet W3C accessibility standards. For example red and green are used to differentiate symbols in the screenshot. This is a bad choice as a significant fraction of the population is red/green color blind.

Eduardo Cavazos

unread,
Jan 8, 2026, 12:19:43 PMJan 8
to sympy
> The coloring is sort of cool.

Thanks for checking it out! 🤝


> Am I correct that the intention to help people visualize what is known and what is being solved for?

Yup 👍

I found myself scanning equations to find certain symbols and the colors help me to distinguish them easily.

Ed

Eduardo Cavazos

unread,
Jan 8, 2026, 12:22:04 PMJan 8
to sympy
>  If you are interested in using Sympy for algebraic manipulations I suggest you look at my package Algebra_with_Sympy

Wow, I had not seen this library yet.
Thank you for sharing it here! 👍

Ed

On Tuesday, January 6, 2026 at 7:03:13 AM UTC-8 gu...@uwosh.edu wrote:

Eduardo Cavazos

unread,
Jan 8, 2026, 12:38:33 PMJan 8
to sympy
>  However this is pursued some thought should be given to the choices of colors to meet W3C accessibility standards.

Yes, this is an important consideration. 👍

Ed
Reply all
Reply to author
Forward
0 new messages