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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Given/Find "this variable is undefined"

wperezsena
1-Visitor

Given/Find "this variable is undefined"

hello everyone

i have this problem guys. ive been trying to solve an equation system for a thermodynamic problem using the given/find commands and when i try FIND i received this error " this variable is undifined". i really dotn know whats wrong with my equation system. if anayone could help me out and explain whats the problem in my MCsheet. i would apreciate it.

the file is attached.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:wperezsena)

There are at least two problems in your sheet.

The most prominent one is a simple typo you can quickly find using "Trace error" as Alan had shown:

1.png

The system still will not solve after you delete that extra n and recalculate the sheet with ctrl-F9.

The error message as of the undefined variable is the only error message a solve block will throw, no matter what the real error is. Thas quite silly and irritating. If you now trace the error, Mathcad is telling you that it does not find a solution and suggests changing tolerance settings or changing the guess different guess values.

Now Alan's an my solution differ. Alan has deleted the front factor 4 in the equation above the one with the typo (why?) and the system solved.

I changed the guess value of n.T from 5 to 10 and Mathcad solved the system. Changing the guess n.T to 1 also does the trick.

Your system seems to be quite sensible as to the guess values.

Its also interesting to look which algorithms are chosen to get a solution. You can see and change the algorithm used when you right click on "Find". Three algorithms for nonlinear systems are offered and if "Autoselect" is checked, Mathcad tries its best to chose a suitable one.

In Alan's sheet only Levenberg-Marquardt does the job and the other two will fail.

With T.n=1 only Quasi Newton works, the other will fail

With T.n=10 Levenberg-Marquardt fails, the other two work.

View solution in original post

4 REPLIES 4

Right-click and select Trace to follow the error back to the source. Even then it's not always obvious what is wrong!

However, it's fixed in the attached.

Alan

Werner_E
25-Diamond I
(To:wperezsena)

There are at least two problems in your sheet.

The most prominent one is a simple typo you can quickly find using "Trace error" as Alan had shown:

1.png

The system still will not solve after you delete that extra n and recalculate the sheet with ctrl-F9.

The error message as of the undefined variable is the only error message a solve block will throw, no matter what the real error is. Thas quite silly and irritating. If you now trace the error, Mathcad is telling you that it does not find a solution and suggests changing tolerance settings or changing the guess different guess values.

Now Alan's an my solution differ. Alan has deleted the front factor 4 in the equation above the one with the typo (why?) and the system solved.

I changed the guess value of n.T from 5 to 10 and Mathcad solved the system. Changing the guess n.T to 1 also does the trick.

Your system seems to be quite sensible as to the guess values.

Its also interesting to look which algorithms are chosen to get a solution. You can see and change the algorithm used when you right click on "Find". Three algorithms for nonlinear systems are offered and if "Autoselect" is checked, Mathcad tries its best to chose a suitable one.

In Alan's sheet only Levenberg-Marquardt does the job and the other two will fail.

With T.n=1 only Quasi Newton works, the other will fail

With T.n=10 Levenberg-Marquardt fails, the other two work.

hey guys thanks a million. you both are right. gotta admit im kinda new using mathcad to solve themodynamics problems, i usually use a couple of special excelsheets to solve them, but in this case excel didnt give me a solution. and werner great work on that. the solution found is correct, and thanks for explain it.

but now i got another doubt,i want to use the values of the solution of the problem to find the concentration of the system.

i tried it, but MC use my guess values to calculate it not the ones found.. i have formulate it on the sheet. so if you could check it out it would be great.

Werner_E
25-Diamond I
(To:wperezsena)

You have assigned the results of the solve block to the vector "solucion" and not to the variables used for the calculation. So they still are assigned the guess values.

You either have to assign a vector consisting of the variable names in use with the values of solucion or directly use that vector of single varibles in the Find statement.

See attached.

Announcements

Top Tags