# Thread: Solve system in Mathematica in terms of parameters

1. ## Solve system in Mathematica in terms of parameters

Hello all,

I am new to mathematica... I have a system of several equations (with as many endogenous variables) and several other parameters. I want to solve this system for each endogenous variable in terms of these parameters. Where do I even start doing this? Whenever I hit solve it just rewrites the same equation and will only do something if I assign numerical values to these parameters. Any help, no matter how little, would be greatly appreciated,

Nick

2. Can you please post the equations you're trying to solve?

Thanks for your response. Unfortunately, the thing I am working with is a complete mess (12 equations, all of which are horrendously ugly... which is why I am hoping mathematica can give me an analytical solution... but as I said I don't know much about it). But as a simple example, lets just say its supply and demand where Q=a+bP and Q=c-dP and I want to solve for P and Q in terms of a,b,c,d.

4. Then your command would be as follows:

Solve[{Q==a+b P,Q==c-d P},{P,Q}]

The result I get is as follows:

$\left\{\left\{P\to-\dfrac{a-c}{b+d},Q\to-\dfrac{-b c-a d}{b+d}\right\}\right\}.$

A few important comments: Mathematica understands implied multiplication. However, if you have two letters right next to each other, with no space, it'll likely interpret that as one variable. That is, AB = the variable with name "AB", but A B equals the variable A times the variable B.

Second, make absolutely sure that you use the double-equals symbol, NOT the single equals symbol: "=". The latter is an assignment operation, and not appropriate for this setting.

Thirdly, don't use reserved variable names like N, D, and so on. Simple way to avoid that: use multiple letters for a variable name (see note above).

Finally, Mathematica is pretty good at solving systems of equations of the size you're talking about. However, if the system is nonlinear in any of the variables for which you wish to solve, Mathematica might or might not be able to solve. If it's linear, Mathematica can usually handle it just fine.

Make sense?

6. One more question if thats okay... how might I define my equations as some name to make this simpler..... That is, let A be Q=a+bP and B be Q=c-dP then I can just write solve Solve[{A, B},{P,Q}]. I think that might make it all a bit more manageable no? Thanks again,

Nick

7. Interesting idea. I've never thought of doing that before. But I just tried the following and it worked:

A=(x==7 y+3)
Solve[A,y]

Result:

$\left\{\left\{y\to\dfrac{1}{7}(-3+x)\right\}\right\}.$

Note the careful use of single and double equals signs.