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

Translate the entire conversation x

function to calculate the torque values

SFares
14-Alexandrite

function to calculate the torque values

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.

 

SFares_0-1760994023009.png

Regards,

Sam

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:SFares)

I guess what you had in mind was something like this:

Werner_E_0-1761003111138.png

Could also be written as

Werner_E_1-1761003159231.png

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

Werner_E_2-1761003347840.png

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.

Werner_E_3-1761003484924.png

Prime 10 sheet attached

 

 

View solution in original post

4 REPLIES 4
LucMeekes
23-Emerald IV
(To:SFares)

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

SFares
14-Alexandrite
(To:LucMeekes)

Thanks you Luc!

 

Sam

Werner_E
25-Diamond I
(To:SFares)

I guess what you had in mind was something like this:

Werner_E_0-1761003111138.png

Could also be written as

Werner_E_1-1761003159231.png

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

Werner_E_2-1761003347840.png

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.

Werner_E_3-1761003484924.png

Prime 10 sheet attached

 

 

SFares
14-Alexandrite
(To:Werner_E)

Thank you so much, Werner!

 

Sam

Announcements

Top Tags