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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Programming Newbie need some help

Hendrico84
2-Guest

Programming Newbie need some help

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

Mathcad question.png

but I have no idea where to begin.

 

Your help will be appreciated.

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:Hendrico84)

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

View solution in original post

8 REPLIES 8
LucMeekes
23-Emerald III
(To:Hendrico84)

Like this?

LucMeekes_0-1627639643404.png

Or do you like this better:

LucMeekes_1-1627640140267.png

 

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:

Werner_E_0-1627642295854.png

Or you turn the function into the definition of a simple variable:

Werner_E_1-1627642357703.png

 

LucMeekes
23-Emerald III
(To:Hendrico84)

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.

LucMeekes
23-Emerald III
(To:LucMeekes)

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):

Werner_E_1-1627639878236.png

It makes it much easier to test this program with different input values if you change it to a function in a and b:

Werner_E_2-1627639968539.png

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):

Werner_E_3-1627640077129.png

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):

Werner_E_0-1627640998285.png

 

 

 

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!!!!

Top Tags