Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I'm relatively new to Mathcad but I enjoy the program very much and I need some help. I would like to program the following section
but I have no idea where to begin.
Your help will be appreciated.
Regards,
Solved! Go to Solution.
The error message probably goes a little further: "Check that the label is set correctly".
This part is important. Prime automatically labels your identifiers as 'variable', 'unit', 'function', 'constant' etc.
Or it sets the label as '-', which means automatic.
Labels of identifiers must be the same for the items that you think must be the same.
Now that fact that Prime automatically labels identifiers means that it also may automatically go wrong. And that happens more often then you might think. It happened here.
Check the labels of all parameters to the function with those used in the definition.
Success!
Luc
Like this?
Or do you like this better:
Prime file attached.
Success!
Luc
Hi LucMeekes
Thank you very much. I've pasted in your attached file but I get a "This value is undefined" error for the Ad value which is strange because it is defined??
Again thank you for your help.
Luc provided a function and you cannot numerically evaluate a function definition. So you would have to delete the equal sign at the end and use it as a function:
Or you turn the function into the definition of a simple variable:
The error message probably goes a little further: "Check that the label is set correctly".
This part is important. Prime automatically labels your identifiers as 'variable', 'unit', 'function', 'constant' etc.
Or it sets the label as '-', which means automatic.
Labels of identifiers must be the same for the items that you think must be the same.
Now that fact that Prime automatically labels identifiers means that it also may automatically go wrong. And that happens more often then you might think. It happened here.
Check the labels of all parameters to the function with those used in the definition.
Success!
Luc
Primes auto-label feature often is the cause for many problems, but it's not the culprit in this case.
One other thing:
You added an evaluation (the = ) at the end of the definition. While that is allowed, it causes problems more than you desire.
Remove the evaluation and call the function, with the parameters on a separate line. Then all is well.
Success!
Luc
The definition of y.pna you provide is missing to clearly define which value should be used if both A.d and A.u are greater or equal A/2! Should it be the second or the third expression?
You did not say if you are using real Mathcad (version 15 or below) or rather just Prime. I assume you are using Prime and here is one of various ways to achieve what you are asking for (I simplified the variables, values and return values):
It makes it much easier to test this program with different input values if you change it to a function in a and b:
And here are a few other ways to achieve the same (note the difference in y(6,7), the case which is not clearly defined by your expression):
In case you are do use Mathcad (15 or below), "else" has to be replaced by "otherwise" and the display it a bit different (more compact):
Hi LucMeekes and Werner_E
WOW!👍 Thank you guys, as a first-time user of the community I'm completely blown away by your responses.
The solutions are clear and easy to follow, my Mathcad knowledge has grown a lot😁.
Thank you again!!!!