Message Boards Message Boards

4 Replies
1 Total Likes
View groups...
Share this post:

Can Wolfram Language be used to simplify two algebra expressions by Elements rather than numbers?

Posted 1 month ago

If I have two equations:

a + b = c

a = d * e

Is there a way to return every equation for all five Elements a, b, c, d and e?

There should be ten equations returned, for example for the element b there are two possible equations by rearranging a + b = c for one equation and substituting a = d * e for the other:

b = c – a

b = c – d * e

I've tried Solve and FullSimplify without success.

POSTED BY: Snowy Owl
4 Replies
Posted 1 month ago
ToString[InputForm[Reduce[eqn, #] & /@ vars]]

would be one way to get the result in a form closer to what could be incorporated into C++

POSTED BY: Bill Nelson

Try e.g.:

eqn = {a + b == c, a == d*e};
vars = {a, b, c, d, e};
Reduce[eqn, #] & /@ vars

N.b.: '=' is an assignment; for defining an equation you need '=='.

POSTED BY: Henrik Schachner
Posted 1 month ago

Thank you, that's very helpful.

What I'm trying to do is capture the result as parameters in a C++ program. Which is my next step :)

POSTED BY: Snowy Owl

CForm could help you with the conversion.

POSTED BY: Gustavo Delfino
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract