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

This variable is undefined error when using Given/Find function, why?

KemiaoJia
1-Visitor

This variable is undefined error when using Given/Find function, why?

Hi Everyone,

I have been using mathcad for some time but it is not until recently i started trying the Given / Find functions.

However, every time i try it, it gives me "This variable is undefined" error right after i enter the Find(...) command and hit the "=" button.

I even tried to follow the quick sheet in the tutorial/help document and it is still happening.

Could someone help me out?

Greatly apprecitated!

Alex J

ACCEPTED SOLUTION

Accepted Solutions

Slightly corrected.

Vyacheslav.

View solution in original post

22 REPLIES 22
RichardJ
19-Tanzanite
(To:KemiaoJia)

Unfortunately solve blocks give that error message no matter what the problem actually is. You need to post the worksheet, because without looking at it there is no way to know what is wrong.

Thanks a lot for the reply.

Please find the worksheet attached.

Appreciated!

Alex J

Slightly corrected.

Vyacheslav.

Thanks a lot for all your help!

Have a great day.

Alex J

What did you do exactly to have the Find funciton work?

Werner_E
25-Diamond I
(To:mmontalv)


@mmontalv wrote:

What did you do exactly to have the Find funciton work?


Look at the end of the solve block 😉

The result of the solve block is a 2-element vector, where the first has the dimension length but the second is dimensionless. Mathcad 15 does not allow different dimensions in on vector.

So the solve block fails (with the meaningless error message) because the and read "Find(ny,xi)=". Evaluation is not possible as a vector with different dimensions cannot be displayed.

The cure is to assign the outcome of the Find command to a vector with two variables as elements.

These two can then evaluated, each one separate.

 

rag
12-Amethyst
12-Amethyst
(To:KemiaoJia)

The Problem has nothing to do with the given/find-block but is because Mathcad does not allow different units for the components of a vector or matrix. To be correct you can have different units in a vector (so there is a solution to your problem) , but you are not allowed to assign the vector to a variable or to evalute it (which is exactly what you are trying to do). The error message is misleading in given/find as was already pointed out by Richard but the real problem is, that ny has the unit meter whilst zeta is unitless.

The best way to deal with the situation was already shown by Vyacheslav Tarasov - assigning the result of "find" to an appropriate vector and you can use your variables ny and zeta in following calculations with proper units.

Another way, if you really only want the result being display immedeately afte the "find", is to get rid of the unit meter by using "find(ny/m, zeta)="

Regards

WR

KemiaoJia
1-Visitor
(To:rag)

Thank you very much!

Really appreciated.

Alex J

RichardJ
19-Tanzanite
(To:KemiaoJia)

I will add one other comment. In general, putting scratch calculations over to the right works very well. I do it all the time. You have to be very careful with solve blocks though. Remember that a Mathcad sheet executes top left to bottom right, and the page boundaries do not affect that. Your test case solve block on the right effectively overlaps with the one on the left, which means it will not work. One solve block should never overlap with another. If you select everything and simply drag it down the page it will work..

Thank you!

Have a nice day!

I have a similar problem. When trying to solve an equation involving something I have defined earlier I always get the message "this variable is undefined". But if I then just insert the size I have defined as numbers instead it works fine ... and it happens every time I try something similar. I don't know what to do, and i already tried reinstalling several times..

RichardJ
19-Tanzanite
(To:ptc-2122803)

You get an error in this worksheet? It works fine for me.

Hello Richard,

I am new to MathCad and this forum.

I am getting the same error as Nicolaj.

What could be the problem?

How do I attach a zip file to the post? - I edited my own post and attached a file with my problem and with Nicolaj's problem copied in the fiel

It would be great if you could help and much appreciated.

Cheers!

Werner_E
25-Diamond I
(To:ptc-6801613)

Welcome to the forum, Cristian!

Nikolaj attached his question to a thread which already was half a year old at the time he posted. It looks like he had no great interest in his question himself as he never came back to that discussion.

And now you attach your post even two years later! Even if the problems look similar it would have been a far better idea to open a new discussion/question.

Furthermore it may be helpful if you state which version (and maintainance release) of Mathcad you are using as it may has to do with a bug which already was fixed in newer version.

As Richard with Nikolaj's sheet I do not experience any errors when I open yours.

I attach a pdf showing what I see in your sheet when I open it in Mathcad 15 M030.

Hello Richard,

Thank you for the quick answer.

I am using Mathcad 15.0 (15.0.0.436 [006041742])

In the attached pdf can you see the two errors that I am getting.

It is a little bit strange as it seems to evaluate the equations simbolically.

Thanks for the help!

Werner_E
25-Diamond I
(To:ptc-6801613)

Thank you for the quick answer.

I am using Mathcad 15.0 (15.0.0.436 [006041742])

Not sure which maintainance release this is but I guess its one of the earlier ones, maybe even the first one [F000]. Any chance you can update to a newer release?

In the attached pdf can you see the two errors that I am getting.

It is a little bit strange as it seems to evaluate the equations simbolically.

Why do you think thats strange? After all you are using the symbolic solve command and not a numeric solve block, so Mathacd solves the equation (the expression is automatically assume =0) symbolically (the only way to get you both solutions with one calculation. You also have to be aware that Mathcads symbolics does not know anything about units, so units are not simplified or cancelled until you evaluate numerically (using the normal =).

Only difference between what I see and your pdf are the units in the symbolic result which may be due to the fact that we use different default units.

I just looked at the release notes and noticed two bug fixes in MC15 M010 which may relate to your problem:

  • 1412775 Fixes a problem with symbolic calculation of a single line definition and evaluation combined with units
  • 1893304, 2056070 Addresses a problem with a combination of an inline evaluation containing units and a symbolic evaluation that is followed by numerical evaluation

So I guess the problem can be solved if you update to a newer release.

I attach a sheet which uses a numeric solve block to get the solution - this should work in your version, too. Also showed some other ways, using the root function and true symbolic solve.

Hello Werner,

You were right, your solution wroks in my version too.

I willl study it more and use it until I will uppdate to a newer version.

Thank you for your help, it is much appreciated.

Have a nice weekend (what's left of it anyway)!

Hello again Richard,

As a side note, the nice thing about it is that the solutions I see in your pdf are the ones that I expected , which means I am on the right path.

Cheers!

Werner_E
25-Diamond I
(To:ptc-6801613)

Cristian Fenichi wrote:

Hello again Richard,

As a side note, the nice thing about it is that the solutions I see in your pdf are the ones that I expected , which means I am on the right path.

Cheers!

OK, you get the very same results using a numeric solve block. See my replay above.

And hello again Werner,

I got carried away and named you Richard .

I appologize for that.

Werner_E
25-Diamond I
(To:ptc-6801613)

Cristian Fenichi wrote:

And hello again Werner,

I got carried away and named you Richard .

I appologize for that.

Don't worry, no problem.

Try this file.

Announcements

Top Tags