Are there programming languages which handle equations?

3 points by tornadofart ↗ HN
Take for example the equation

U = R * I

In many languages, I have to re-implement this equation according to which values are known and which are not. Something like this pseudocode:

var u = r * i;

...

var r = u / i;

...

var i = u / r;

Are there systems that allow me to only program the equation and compute the missing values depending on what is known? At least for simple algebra with real numbers?

8 comments

[ 30.8 ms ] story [ 83.7 ms ] thread
Metafont (and derivatives like Metapost) do that.
Matlab and GNU Octave can do symbolic equation solving:

https://docs.octave.org/v8.2.0/Solvers.html

https://www.youtube.com/watch?v=ZSsuuyISr6Y&t=1s

Matlab is a nice, but expensive commercial product.

GNU Octave is free software (libre and gratis):

https://octave.org/download

"symbolic equation solving" was the term that helped me refine my search. Thanks!
Scilab is free, reliable and very similar to Matlab. I believe an arm of the French Government is responsible for it.

I use an old hp48gx calculator which can convert a program into an algebraic expression. The calculator can be downloaded free. Search for emu48

Not in other comments, so commercial Mathematica can do it. Theorem proving languages such as coq or agda can as well, especially if you're doing really heavy math.

Probably pretty soon we could have the machines (LLMs) convert our prompts into code or solve it directly, depending on exactly what needs to be solved.