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!

can mathcad programming be used for simultaneous equations? 2

Status
Not open for further replies.

chemicallymark

Chemical
Jun 11, 2004
2
Hi there

I was wondering if mathcad programming can be used for solving simultaneous equations?

I have "a box" that needs three simultaneous equations (non linear, algebraic) to be solved.

I should end up with two answers, A and B.

I then need to recycle answer B and feed it into the simultaneous equations again to get a new answer for A and B. This needs to continue until A and B remain constant.

Basically an iteration over "the box" with a recycle stream.

Can this be done in mathcad? perhaps with the use of excel?

I know it can be done in Matlab for example but i would like to use Mathcad...

Any ideas?
Thanks
Mark

 
Replies continue below

Recommended for you

Yes I think that can be done in a couple of ways at least. If you look for Solve blocks in the help that will give you one approach.

It would probably be easiest to use the for next programming loop if you have an up to date version, failing that devious minds have solved that sort of problem by using one vector to store both variables at each iteration.

i:0;iterationsneeded*2
j:2;iterationsneeded

V[i:0
V[0:Afirstguess
V[1:Bfirstguess
V[j:some horrible equation using something like if(j=odd,workoutB using V[(j-1) and V[(j-2),workoutA)

Excel would be easier than this method.




Cheers

Greg Locock
 
Wow thats complicated I use TK and all I have to do is enter the equations and give it a guess.
 
You don't need programming to solve simultaneous equations in Mathcad. Greg was simply answering the mail; since you wanted something that iterated in a program.

In Mathcad, the straightforward solution uses the Given-Find or Given-Minimize block to define the simultaneous equations and then you input guess values and Mathcad produces a result. These are described in the help and user manuals as well as tons of examples are available in the Mathcad library site or the Mathcad user forums


TTFN
 
Why do you want it in a program loop?


The Solve block produces the solution to the constraints given. If you want to apply that to a bunch of differing constraints, then you simply assign the Find() to a function with variables for input.

You can then run range variables into the inputs and the function will output the corresponding results, again, no programming is required.

TTFN
 
I left off that halfway down the article is the description of assigning a function to the Find(), which then allows you to run multiple iterations of the Solve block.

TTFN
 
There are some good examples of solving things like this in a download from the mathcad website (I got it from the Mathcad 11 user area - requires registration).


Bung
Life is non-linear...
 
Chemicallymark
You asked what's TK

TK Solver is the original Equation Solver it's is used by a lot of Chemical Engineers. I believe the Dupont Standards For Chemical Process and Equipment are done in TK.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor