I'm trying to write down some notes of my work. The way Maxima would simplify my work is that once I write bunch of equations and I want to change the definition of a variable, I do it and re-evaluate the entire file.
Here is an example of what I'm trying to accomplish:
Question 1: I have a system of equations and all I want from Maxima is just variables replacement.
eq1: x=a+b+c
eq2: y=d+e+f
eq3: x+y=0
How do I get Maxima to output
eq3: a+b+c+d+e+f = 0
So in the future if I want x to be a+b-c, I just change it and re-evaluate
Question 2: Similar to before but a bit more complex
eq1: x=a+b+c
eq2: y=d+e+f
eq3: x=y
eq4: a+s+e=0
How do I get Maxima to output
eq3 a+b+c=d+e+f
How do I get Maxima to solve eq1 for a and solve eq2 for e and output
eq4: x-b-c+s+y-d-f = 0
Thank you in advance for your help, Guido
I think subst
and solve
can handle the operations you want here.
(%i1) eq1: x=a+b+c;
(%o1) x = c + b + a
(%i2) eq2: y=d+e+f;
(%o2) y = f + e + d
(%i3) eq3: x+y=0;
(%o3) y + x = 0
(%i4) subst ([eq1, eq2], eq3);
(%o4) f + e + d + c + b + a = 0
OK, now here's your second example. Note that solve
returns a list of equations.
(%i5) eq3: x=y;
(%o5) x = y
(%i6) eq4: a+s+e=0;
(%o6) s + e + a = 0
(%i7) subst ([eq1, eq2], eq3);
(%o7) c + b + a = f + e + d
(%i8) solve (eq1, a);
(%o8) [a = x - c - b]
(%i9) solve (eq2, e);
(%o9) [e = y - f - d]
(%i10) append (%o8, %o9);
(%o10) [a = x - c - b, e = y - f - d]
(%i11) subst (%o10, eq4);
(%o11) y + x + s - f - d - c - b = 0
Maxima's solve
function is not too powerful; there are many kinds of equations it cannot solve. But it can solve linear equations.