Coloring symbols in equations

43 views
Skip to first unread message

Eduardo Cavazos

unread,
Jan 5, 2026, 8:50:51 PMĀ (2 days ago)Ā Jan 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 AMĀ (2 days ago)Ā Jan 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 PMĀ (13 hours ago)Ā Jan 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 PMĀ (12 hours ago)Ā Jan 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.
Reply all
Reply to author
Forward
0 new messages