Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Equation Substitute?

Status
Not open for further replies.

infinityvortex

Automotive
Aug 27, 2008
6
If we had the following in a mathcad worksheet:

~~~
A(x):= 3x+5

B(y):= 4y-3

C(z):=z+1

D(x,y):=45+A(x)+B(y)+C(3)

~~~

Is it possible to use a substitute command on D(x,y) that easily (or automatically) returns all the equations that D(x,y) is referring to and populates them into D such as this:

D(x,y):= 45+ (3x+5) + (4y -3) +4

Breaking it down until only defined variables remain in the equation?




Hello! I'm the new guy.
 
Replies continue below

Recommended for you

No. But you can do it for each function using the symbolic menu. Copy the thing you want to substitute (eg highlight 3x+5, control C, then go to the D equation and highlight A(x). Then got ot the symbolic menu and press substitue for variable.

All the above off the top of my head, I don't have mathcad here.

Cheers

Greg Locock

SIG:please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
I use both Mathcad and wxMaxima because both have different advantages. What I like about wxMaxima is that the output can be text which I can cut and paste into java or c programs.

A(x):=3*x+5;
B(y):=4*y-3;
C(z):=z+1;
D(x,y):=45+A(x)+B(y)+C(3);
ratsimp(D(x,y));

(%o3) A(x):=3*x+5
(%o4) B(y):=4*y-3
(%o5) C(z):=z+1
(%o6) D(x,y):=45+A(x)+B(y)+C(3)
(%o7) 4*y+3*x+51

%o7 shows the simplification
Try wxMaxima, it is free.
 
In M14, you can tack on the symbolic evaluation <ctrl>+. on the end of the last definition, and it'll display the simplified symbolic equation.

TTFN

FAQ731-376
 
Thanks guys..

Greg, the substitute function works if you have only one level deep equations, like my example above..

What if the A(x) equation was
A(x):= G(x)+5

And so on.. with equations that refer to equations that refer to other equations (poor choice of words, sorry).

If the equation tree is multiple levels deep, then the substitute function will work if I do a substitution for each equation on each level.

PNachtwey, Thanks,
That seems more interesting.. wxMaxima.. I'll definitely look into it (If I can get use it without much work)

IRstuff, I guess manually doing that backwards through each level of the equations might work..

I was thinking if there was a one-step way.. I guess I'm too lazy.

Thanks guys!





Hello! I'm the new guy.
 
The Simplify will do something similar, though not the same.
For your method, eventually if the equations are 'complicated' the result will be a too tricky to read, so you'd need to simplify anyway.
That is the problem with trying to use symbolics to show all the steps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor