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

## Divide by Zero - If/Try Loop

SOLVED  5-Regular Member

## Divide by Zero - If/Try Loop

Gents,

Hope all of you are good. I have one more question, and as always this kind of stuff get complex only when I do it.

Under procedure I get some values in zero, which then needs to be divided. However in my case it would simply mean that this portion of the result shall not influence and it needs to get out of the equation (simply wave effect is not applicable after certain depth).

Please note, this attached sheet is simplified to show what I need to do, original one is 15 pages so far.

So I'm trying to make some kind of loop which shall state if there is no valid result from above step, return 1.

Looked throe the manual and this forum, but can't find nothing, It looks like I runned into software limitation (due to fact that is not logical what I want to do)..

1 ACCEPTED SOLUTION

Accepted Solutions  24-Ruby IV

I would not call it a software limitation.

You are asking for a solution of the equation 0*T=3

What answer did you expect for T?

Here is a way to check if the calculation got a result. Unfortunately to be able to use the try and catch you have to use a numeric method to solve the equation. I have chosen the root command in the version where you have to provide limits for the solution. This is the drawback of this method as it would mean that you have to know two values, one to the left and one to the right of the expected solution.

Another option would be to use a solve block which is turned into a function of some of the critical vatriables and call that function instead of root. Drawback is that its more elaborate, benefit is that you just have to provide one sensible guess value. Its a long standing wish to implement a way to be able to determine if a variable already exists. 5 REPLIES 5  24-Ruby IV

I would not call it a software limitation.

You are asking for a solution of the equation 0*T=3

What answer did you expect for T?

Here is a way to check if the calculation got a result. Unfortunately to be able to use the try and catch you have to use a numeric method to solve the equation. I have chosen the root command in the version where you have to provide limits for the solution. This is the drawback of this method as it would mean that you have to know two values, one to the left and one to the right of the expected solution.

Another option would be to use a solve block which is turned into a function of some of the critical vatriables and call that function instead of root. Drawback is that its more elaborate, benefit is that you just have to provide one sensible guess value. Its a long standing wish to implement a way to be able to determine if a variable already exists.   5-Regular Member
(To:Werner_E)

Yes, I wrote it a bit strange..

Let me try one more time.. if answer for T2 is not real number, return 1.  5-Regular Member

Then I wrote again 0*T=something 🙂 there you understand my confusion, mathematically not possible I understand it, but I just thought a person can find way out if  24-Ruby IV

I realized what your main question is and just edited my answer above.

Guess that there is no perfect satisfactory solution as long as we cannot check if a variable already exists.

Best option may be to rather check for the critical variables which may cause the solve to fail if thats possible in your original worksheet.  5-Regular Member
(To:Werner_E)

Thank you sir, brilliant as always

I can use this as a start point to update sheet, this divide by zero kills half of the sheet, but at least now I can find my way out. Announcements
Check out the latest