Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Given/Find "this variable is undefined"

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-15-2014
03:15 AM

11-15-2014
03:15 AM

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.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-15-2014
05:35 AM

11-15-2014
05:35 AM

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:

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.

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-15-2014
03:46 AM

11-15-2014
03:46 AM

Re: Given/Find "this variable is undefined"

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-15-2014
05:35 AM

11-15-2014
05:35 AM

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:

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-15-2014
12:15 PM

11-15-2014
12:15 PM

Re: Given/Find "this variable is undefined"

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-15-2014
01:50 PM

11-15-2014
01:50 PM

Re: Given/Find "this variable is undefined"

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.

Top Tags