topic Divide by Zero - If/Try Loop in PTC Mathcad
https://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562975#M181514
<P>Gents,</P>
<P> </P>
<P>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. </P>
<P>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). </P>
<P> </P>
<P>Please note, this attached sheet is simplified to show what I need to do, original one is 15 pages so far. </P>
<P> </P>
<P>So I'm trying to make some kind of loop which shall state if there is no valid result from above step, return 1. </P>
<P> </P>
<P>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)..</P>
<P> </P>
<P>Thank you in advance. </P>
<P> </P>
<P> </P>
<P> </P>
<P> </P>Thu, 26 Jul 2018 12:34:44 GMTAdoS2018-07-26T12:34:44ZDivide by Zero - If/Try Loop
https://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562975#M181514
<P>Gents,</P>
<P> </P>
<P>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. </P>
<P>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). </P>
<P> </P>
<P>Please note, this attached sheet is simplified to show what I need to do, original one is 15 pages so far. </P>
<P> </P>
<P>So I'm trying to make some kind of loop which shall state if there is no valid result from above step, return 1. </P>
<P> </P>
<P>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)..</P>
<P> </P>
<P>Thank you in advance. </P>
<P> </P>
<P> </P>
<P> </P>
<P> </P>Thu, 26 Jul 2018 12:34:44 GMThttps://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562975#M181514AdoS2018-07-26T12:34:44ZRe: Divide by Zero - If/Try Loop
https://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562982#M181515
<P>I would not call it a software limitation.</P>
<P> </P>
<P>You are asking for a solution of the equation 0*T=3</P>
<P>What answer did you expect for T?</P>
<P> </P>
<P>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.</P>
<P>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.</P>
<P><IMG src="https://community.ptc.com/t5/image/serverpage/image-id/9036i7C18B6DCEEC360CA/image-size/original?v=1.0&px=-1" border="0" alt="B.jpg" title="B.jpg" width="312" height="193" /></P>Thu, 26 Jul 2018 13:05:43 GMThttps://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562982#M181515Werner_E2018-07-26T13:05:43ZRe: Divide by Zero - If/Try Loop
https://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562986#M181516
<P>Yes, I wrote it a bit strange.. </P>
<P>Let me try one more time..</P>
<P> </P>
<P><IMG src="https://community.ptc.com/t5/image/serverpage/image-id/9035iF33BA37E57A1402E/image-size/original?v=1.0&px=-1" border="0" alt="Capture1.JPG" title="Capture1.JPG" /></P>
<P> </P>
<P>if answer for T2 is not real number, return 1. </P>Thu, 26 Jul 2018 12:58:29 GMThttps://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562986#M181516AdoS2018-07-26T12:58:29ZRe: Divide by Zero - If/Try Loop
https://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562989#M181517
<P>Then I wrote again 0*T=something <span class="lia-unicode-emoji" title=":slightly_smiling_face:">ðŸ™‚</span> there you understand my confusion, mathematically not possible I understand it, but I just thought a person can find way out if </P>Thu, 26 Jul 2018 13:04:53 GMThttps://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562989#M181517AdoS2018-07-26T13:04:53ZRe: Divide by Zero - If/Try Loop
https://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562990#M181518
<P>I realized what your main question is and just edited my answer above.</P>
<P>Guess that there is no perfect satisfactory solution as long as we cannot check if a variable already exists.</P>
<P>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.</P>Thu, 26 Jul 2018 13:08:34 GMThttps://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562990#M181518Werner_E2018-07-26T13:08:34ZRe: Divide by Zero - If/Try Loop
https://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562992#M181519
<P>Thank you sir, brilliant as always</P>
<P> </P>
<P>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. </P>Thu, 26 Jul 2018 13:14:23 GMThttps://community.ptc.com/t5/PTC-Mathcad/Divide-by-Zero-If-Try-Loop/m-p/562992#M181519AdoS2018-07-26T13:14:23Z