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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Error Operator Help - If/Then statements

ccollongues
2-Explorer

Error Operator Help - If/Then statements

Hello,

I seem to be having an issue regarding if/then statements in regards to Mathcad not recognizing my the initial "if" statement due to an error in my "else if" statement.

When x does not equal 0, I get an answer.

1.JPG

However, when x does equal 0, I get "can't divide by zero" error, and the program does not recognize that the first statement is true an should report the respective value.

2.JPG

Is there anyway to get around the zero in the denominator error? I know it's probably an easy fix, but I can't figure it out. Anyone have any ideas?

Thanks,

C

ACCEPTED SOLUTION

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

Here's one way to go.

Define a function to do the work and call it vectorized

View solution in original post

5 REPLIES 5
LucMeekes
23-Emerald III
(To:ccollongues)

X is NOT zero in either of the two cases. X is an array. Filled with 2 elements of 2 metres (first case) or 0 metres ( second case) .

0 is NOT EQUAL to any array.

Success!

Luc

Werner_E
25-Diamond I
(To:ccollongues)

Here's one way to go.

Define a function to do the work and call it vectorized

Use better not the operator if but the function if.

The function if works in Mathcad Express too!

This did not work for my application, but good to know. Thanks for the help!

Well, this works, but there are interesting consequences:

Announcements

Top Tags