Subject: solving simple systems of equations manually
From: dlakelan
Date: Thu, 29 Mar 2012 13:31:50 -0700
On 03/29/2012 11:16 AM, Tamas Papp wrote:
> On Thu, 29 Mar 2012 10:40:57 -0700, dlakelan wrote:
>
>> On 03/29/2012 06:51 AM, Tamas Papp wrote:
>>> Hi,
>>>
>>> This is a newbie question, I am still learning Maxima. I know a bit of
>>> CL.
>>>
>>> I have the following system:
>>>
>>> /* equations */
>>> eq1: r*U = b+lambda_u*(W0-U);
>>> eq2: r*W0 = w0 + lambda_e*(W1-W0) + sigma*(U-W0); eq3: r*W1 = p +
>>> sigma*(U-W1);
>>> eq4: W0-U=beta*(W1-U);
>>>
>>> The unknowns are W0, W1, U, and w0. I am interested in the expression
>>
>> You've got W0 listed twice? what did you mean here?
>
> Note the difference in case.
aha, I thought that was a typo, as I didn't notice the lowercase version
in the equations. This is presumably from notation that is standard
within your problem, but might not be the best notation for computer
algebra.
You are trying to find how the expression
(w0-b)/(w1-w0)
looks in terms of your other unknowns, but you're trying to do it "by
hand" yet doing it "by hand" does not automatically generalize to the
REAL problem you're trying to solve (you mention this is a toy to find
out how to tackle a more complex problem).
so perhaps I can give some helpful general advice:
subst is for substituting things syntactically, ratsubst does a more
mathematical substitution which is what you're trying to do with your
other functions, I think.
the "format" package can be useful for writing things in terms of
polynomials of certain variables, it's a pretty heavy duty package so it
can do a lot and may be overkill.
ratsimp(a,b,c) will write a as a (ratio of) polynomials in b whose
coefficients are polynomials in c.
ratexpand(a) will write a as a sum of terms in a useful way.
The way I would tackle your problem would be to create a new equation,
and then use solve.
eq1: r*U = b+lambda_u*(W0-U);
eq2: r*W0 = w0 + lambda_e*(W1-W0) + sigma*(U-W0);
eq3: r*W1 = p + sigma*(U-W1);
eq4: W0-U=beta*(W1-U);
eq5: Myexpr = (w0-b)/(W1-w0);
solve([eq1,eq2,eq3,eq4,eq5],[W0,w0,W1,U,Myexpr]);
this is straightforward but evidently doesn't meet your needs, but I
don't know really what your needs are. Presumably you'd like to see some
intermediate results, but which ones you want to see are not clear. You
could, of course, always create other equations for intermediate
results, such as mydenom=W1-w0 and include those in the things you want
to solve for.