0
$\begingroup$

I want to create random variables for a way more complex program to read.

Some example code is:

a:random(20);
b:random(100);
[c]:solve(a = 2 * x + b, [x]);
tex(a);
tex(b);
tex(c);

however, the last line prints x=5 instead of 5.

is it somehow possible to get the value of the solutin in maxima?

$\endgroup$

1 Answer 1

2
$\begingroup$

The explanation is that solve returns a list of equations such as x = 5, not just values such as 5.

Of course the values are the right-hand sides of the equations. So you can do e.g.:

[c] : map(rhs,solve(a = 2 * x + b, [x]));
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .