How are multi-part equations best handled? For example, take the torsion equation:

torsion equation

We could express part of this equation like this:

torque := stress * moment / radius;

but then we could not re-define "torque" to mean something different in terms of G because it is already defined.

Ideally, we would like to represent the whole expression somehow and then solve for the term wanted depending on the situation. Is there any way to do this?

  • 1
    $\begingroup$ what do you want to do with such relation? Is something like a == b == c what you are looking for (note the double = signs, which represent Equal as opposed to Set or SetDelayed)? $\endgroup$ – glS Oct 17 '16 at 13:14
  • $\begingroup$ @glS You tell me. The equation shown is right out of a physics textbook. The question is how to manage this relation in Mathematica efficiently assuming that we want to compute different parts of it at different times. For example, at one time, we might want to compute torque in terms of stress, at other times torque in terms of twist angle, at other times we might want to compute stress in terms in twist angle. What is the most flexible way to compute ANY of the terms wanted in terms of any of the others. $\endgroup$ – Tyler Durden Oct 17 '16 at 13:32
  • $\begingroup$ @glS What I am trying to avoid here is having multiple equations. For example, there are 7 different terms here and 3 different subexpressions. So, you could write this as 16 different separate equations. I do NOT want to write 16 different separate equations all with different variable names. I want to use a single equation and manipulate to determine the value wanted. $\endgroup$ – Tyler Durden Oct 17 '16 at 13:35

One way to approach this is to define a compound equation such as:

eqn = a/b == c/d || a/b == e/f || c/d == e/f

Now you can solve for any of the variables in terms of the others, for instance:

Solve[eqn, c]


Solve[eqn, d]

You can plug in values directly:

Solve[eqn /. {b -> 2, c -> 1, d -> 3}, a]
|improve this answer|||||
  • $\begingroup$ That seems like an excellent approach; I will give it a try. $\endgroup$ – Tyler Durden Oct 17 '16 at 15:18
  • 2
    $\begingroup$ Generating all pairs from equation "sides": Or @@ Equal @@@ Subsets[{a/b, c/d, e/f}, {2}]. $\endgroup$ – BoLe Oct 17 '16 at 18:09

You can represent the whole equation just as it is in the textbook

eqn = tork/moment == smax/radius == modulus θ/length;

Then, you can specify which to variables to eliminate and which to solve for

Assuming[{moment > 0, radius > 0, length > 0}, {
   Solve[Eliminate[eqn, radius], length],
   Solve[Eliminate[eqn, length], tork],
   Solve[Eliminate[eqn, tork], θ]
   }] // Flatten

To get expressions like this

$\left\{\text{length}\to \frac{\theta \text{ modulus } \text{moment}}{\text{tork}},\text{tork}\to \frac{\text{ moment } \text{smax}}{\text{radius}},\theta \to \frac{\text{length} \text{ smax }}{\text{modulus} \text{ radius}}\right\}$

|improve this answer|||||

How about defining all "sides", and then picking two.

{s1, s2, s3} = {torque/moment, stress/radius, bigG/bigL};

Solve[s2 == s3, radius]

This way you do not have to specify all ${n} \choose {2}$ equation pairs; bill s' solution, although neat, doesn't allow solving c in terms of e & co. for example.

|improve this answer|||||
  • $\begingroup$ That is elegant. I thought I could make bill's solution work by doing this: eqn = a/b == c/d || a/b == e/f || c/d == e/f $\endgroup$ – Tyler Durden Oct 17 '16 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.