Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello All,
In the attached Mathcad-P10, I am creating a function to calculate the torque values at different x values. It is giving me an error for some values. I appreciate any assistance.
Regards,
Sam
Solved! Go to Solution.
I guess what you had in mind was something like this:
Could also be written as
Note that "return" terminates further program execution so no "else" or "else if" is needed.
I replaced your text string "NA" by NaN (Not-a-Number) with appropriate unit to be able to make a plot
Generally its not a good idea to ask for equality of two float values but its better to rather ask if they are approximately equal within a certain tolerance.
Prime 10 sheet attached
Your function only provides values for when x is larger than 0.8 m (and less than or equal to 1.4 m).
The errors are given for x=0.8 m (which is NOT larger than 0.8 m0, same as for x=0.4 m.
You must define an outcome for ALL possible values of x, so you need an else with the first if, which then should include the cases where x=0.8 m and x < 0.8 m.
Success!
Luc
Thanks you Luc!
Sam
I guess what you had in mind was something like this:
Could also be written as
Note that "return" terminates further program execution so no "else" or "else if" is needed.
I replaced your text string "NA" by NaN (Not-a-Number) with appropriate unit to be able to make a plot
Generally its not a good idea to ask for equality of two float values but its better to rather ask if they are approximately equal within a certain tolerance.
Prime 10 sheet attached
Thank you so much, Werner!
Sam
