cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

SOLVED
ptc-5341320
Newbie

This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

Hey folks, I am posting this because I am really having trouble seeing where the problem is within this worksheet. Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

See attached.

BTW, there is nothing wrong with using the Align Regions facilitiy in Mathcad!

View solution in original post

15 REPLIES 15

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

a2.png

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

See attached.

BTW, there is nothing wrong with using the Align Regions facilitiy in Mathcad!

View solution in original post

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

So my problem was that I needed to have the mass fractions as x.2a instead of a.2 (and so on for the others) in the find block?

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

You had used those fractions x.2a etc. in the equations of your solve block. Those variables were not used as solve for variables and they had no value, were undefined. So Mathcad could not evaluate those equations in the solve provess and throws the error.

There are two other ways to make it work:

1) change x.2a etc. to a.2 in the equations of the solve block

2) assign guess values to x.2a, too, and solve for all 19 variables. Not recommended but should work.

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

Hello to anyone reading this, first post here. I'm not really a user of Mathcad, but since my current employer has it installed, I've been giving it a look of late. A few days ago I was playing with the worksheet enclosed in this thread, when Mathcad crashed and I lost all the edits made by then (but tech discussion should better take place in another section, so I'll cut short to what's related to the problem itself).

For a problem of this kind I would prefer to see the solution in a form similar to as shown below (with text output and equations not much more complicated than necessary to solve the system):

M1 = F * (1 – x1g / x6g) / ((1 – x3g / x6g) * x7a / x3a – 1)

M3 = M1 * x7a / x3a

M6 = M1 + F – M3

x3s = x1s * F / M3

x3w = 1 – x3a – x3g – x3s

M5 = S – M1

x2w = x5w * M5 / S

x2a = 1 – x2w

M4 = M5 + M6

x4a = x5a * M5 / M4

x4g = x6g * M6 / M4

x4w = 1 – x4a – x4g

Now (the question to PTC support staff and/or experienced users), do I get it right that this is something Mathcad can't do? I mean, when I try sym solution, I'm getting half a page of pretty heavy equations instead of neat formulae as shown above and I don't see how to get it in text. Am I missing some clues?

And one more thing (to the topic starter): is this a textbook problem, and if so, can you say what you were given (what did you have to work from)? Math is ok, but chemistry (considering L/L extraction terms from your worksheet) doesn't seem to make sense.

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

If I buy a software to solve a syszem of equations symbolically and the result would be that one solved for variable is referenced on the RHS of the "solution" of another as is the case in your proagated "solution" multiple times, I'd like my money back!

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

Mathcad won't do "text output." I'm not sure why you want to.

Look at the attached file, understand what Mathcad can do, and try your hand.

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

It looks to me that with "text output" he means a symbolic solution. But the example he gave is not a solution at all.

@Andy: The example you gave is like the following:

You have the equations

29.10.png

to solve for x1 and x2. Mathcads symbolics giv you the solutions

29.10.png

You consider this as too complicated and are sad because you expected something simple as

29.10.png

But this would not make much sense as it is not a solution to the system of two equations given!

Mathcad could do these transformations, too, if you apply "solve" to every equation individually but it won't help solving the system.

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

"Mathcad won't do "text output." I'm not sure why you want to."

Well, if I were to use Mathcad for work, I'd prefer to copy resulting equations to my sources, rather than retype them from screen! Thanks for the brochure, I'll take a look.

"If I buy a software to solve a syszem of equations symbolically and the result would be that one solved for variable is referenced on the RHS of the "solution" of another as is the case in your proagated "solution" multiple times, I'd like my money back!"

I'm afraid I don't follow you.

Did you check what Mathcad yields as a solution of this system? Are your results different to mine (see attached screenshot)?

"It looks to me that with "text output" he means a symbolic solution. But the example he gave is not a solution at all."

Sorry, I don't understand the point of your attack.

I gather you didn't take the effort to analyze the system yourself, but did you at least care to check the results against the solution Mathcad yields? I could have made a typo or two somewhere, but other than that the solution should be correct.

"andy mokanov, this problem is one my teacher made, and i cant speak for the chemistry as far as the proportion of glycerine to salt or water to alcohol etc. This is the first chemical-engineering-specific class for us, so we are ChE newbs and i think the point was to just get us moving with material balances and very generally talk about processes like distillation etc."

OK, that explains it. Thanks for clarifying.

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

I tried to make my point clearer with the example in my second reply (and obviously failed).

If you have a system lets say in just three variables A, B and C, then anything which would want to be called a solution of this system would consist of three equations beginning with A=.., B=... and C... respective. The point ist, that on the right hand side of these equations anything would be allowed, but NOT A, B or C!

In the "solution" you propagate the first variable given is M1 and while you haven*t simplified/expanded your expression it seems to me that you agree with Mathcad at this point. But your next line is M3=... and it uses M1 on the righthand side. So this may not called a solution of the system of equations. While writing out the expressions the way you did may be comfortable for you and if no equation references a variable which is calculated below it, you get your solutions by substituting the result of one line into the next ones. But thats not called a solution of the system. If you do this procedure symbolically you sure would arrive at the expressions Mathcad gave you as solution.

Let me add at this point that Mathcads symbolics is rather weak in many respects and cannot compare to Mathematica or Maple. So using symbolics in Mathcad you will quickly come up against the limits, but as it seems to me not in case of this system of equations.

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

"So this may not called a solution of the system of equations."

At this point I'm afraid I have to suggest that you need to review the theory, starting with basic definitions. Since my school days, solution of a SoE was defined along the lines of

(1) such values of unknowns that meet all equations (make them true/valid);

(2) finding of (1).

"While writing out the expressions the way you did may be comfortable for you"

It has nothing to do with personal comfort. One thing that counts is having fast code, another is ease of debugging and checking your math. If you don't realize these values at all, then perhaps you simply lack experience other people have.

"So using symbolics in Mathcad you will quickly come up against the limits, but as it seems to me not in case of this system of equations."

I was, and still am, curious whether Mathcad could provide a solution not as heavy as it does. And if not perfectly short, then at least something not too far from the one shown in my post.

Therefore, I would strongly suggest that in case you consider yourself to be in position to make a constructive contribution here, then your next post in this topic should address the way it can be done -- that would surely be of value for people using this software.

And, please, no more ridiculous comments bordering with insults. If you question the correctness of my solution, all you should do is point out the typos. Thank you.

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

Am sorry that you take as an insult if a point you to an error.

I will try to explain one last time:

SoE: {x+y=5; x-y=1} Solution is {x=3; y=2}

You suggested something like {x=3; y=x-1} which is not to be considered a solution, but rather another way to write that SoE which may be more convenient as you immedeatly get the solution for y by simple substitution.

As you write about "fast code" it looks to me that you do not want Mathcad to completely solve a SoE but rather want it to bring it in a form so you can solve the SoE in a selfwritten program in some program language.

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

Werner is correct that if M1 is one of the variables that you are solving for it should ntot appear on the RHS of any equation in the solution set. Sorry if you don't like that, but it's the standard convention, and so it's what you get from the Mathcad symbolics. It's almost certainly what you will get from any other symbolic solver too. I have no idea why you would view an observation of that point as an insult.

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

Guys,

if I happen to be the first to tell you that, then don't take my word for it. Instead, please ask a math professor, consult a book on the subject (or check Wikipedia for lack of any), but for chissake, stop spreading the nonsense that a sequence of operations that delivers values satisfying a SoE "is not a solution"! If that's what Mathcad manual says, then print it out and burn it.

Development of SoE solution methods which minimize required computation time is an area of its own; there could well be theses and monographs dedicated to research of one particular method or a specific kind of SoE. But what do I know, eh? Maybe that's the effect Mathcad has on people using it...

Re: This problem has 12 variables and I do have 12 equations, but I still get the "variable undefined" message

andy mokanov, this problem is one my teacher made, and i cant speak for the chemistry as far as the proportion of glycerine to salt or water to alcohol etc. This is the first chemical-engineering-specific class for us, so we are ChE newbs and i think the point was to just get us moving with material balances and very generally talk about processes like distillation etc.

Announcements