Odinfall
Odinfall

Reputation: 11

Solve Equations from Equations Mathematica

Well, I need a way to solve equations by another var got from other equation in Mathematica 8. Example:

a + b = 2c
c + 2 = d
d = 2b

It will chose the best equation for the given values and solve the rest. With some given values, like a = 1 and c = 3, it solves the system, getting the values for the respective variable. *Will use this for physics' formulas.

Upvotes: 1

Views: 1312

Answers (1)

Philip
Philip

Reputation: 11

Use the Solve or Reduce functions. The syntax is

Solve[{LIST OF EQUATIONS}, {Variables to solve for}]

So in this case:

Solve[{a + b == 2 c, c + 2 == d, d == 2 b}, {a, b, c, d}]
(*->
{{a -> -4 + (3 d)/2, b -> d/2, c -> -2 + d}}
*)

There are 4 variables and only 3 equations, so there are infinite solutions.
They lie on the 4-d line (-4 + (3 n)/2, n/2, n-2, n).

Upvotes: 1

Related Questions