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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to ignore if the expression is divided by zero

ldante
11-Garnet

How to ignore if the expression is divided by zero

Capture.PNG

I have this formula  but some time the expression is divided by zero . How to disregard this warning ?

 

 

 

 

ACCEPTED SOLUTION

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

You CANNOT ignore the division by zero situation because mathematically it makes no sense to divide by zero.

Essentially you should catch this exception before it occurs. So next to checking if the ratio of Co and Cc is between -1 and 1, you should include a test that Co and Cc should not be equal.

Be sure to provide proper answer(s) for you program in case the exception(s) occur.

 LM_20170920_Divisionby0.png

 

But maybe it's simpler to do just:

LM_20170920_Divisionby0_1.png

Change the second 'less than' into a 'less then or equal'.

 

 

Success!
Luc

View solution in original post

5 REPLIES 5

Use please the try operator (on error in Mathcad 15)

Try.png

LucMeekes
23-Emerald III
(To:ldante)

You CANNOT ignore the division by zero situation because mathematically it makes no sense to divide by zero.

Essentially you should catch this exception before it occurs. So next to checking if the ratio of Co and Cc is between -1 and 1, you should include a test that Co and Cc should not be equal.

Be sure to provide proper answer(s) for you program in case the exception(s) occur.

 LM_20170920_Divisionby0.png

 

But maybe it's simpler to do just:

LM_20170920_Divisionby0_1.png

Change the second 'less than' into a 'less then or equal'.

 

 

Success!
Luc

Capture1.PNG

This  one works ......

Thank you

 

Actually I am expecting  this result . It happened only when I include  + 1 as I marked in yellow color

 

Capture.PNG

 

LucMeekes
23-Emerald III
(To:ldante)

Ah, but 1 - Co/Cc + 1 = 2 - Co/Cc.

Then you don't have a problem when Co=Cc, but only when Co=2*Cc.

 

Luc

Announcements

Top Tags