5

I regularly use calc-eval in the *scratch* buffer to work out some quick calculations. I know that I can use some simple functions inside the calculation string, e.g. log. However I am not certain whether I can use the solver in the same way.

Is it possible to write a calc-eval expression that solves for, say, a particular variable?

6

Yes, for example:

(calc-eval "solve([x+y=3, x-y=1], [x,y])")

evaluates to:

"[x = 2, y = 1]"

You might find it more comfortable to use a calc-mode buffer than running calc-eval in the scratch buffer, though.

2

Check out section 11.6 of the Calc manual, which is about solving equations. I just use calc-mode rather than calling calc-eval by hand, but it seems like you'd be able to use the functions it describes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.