Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi all,
Can anyone suggest how to overcome the issue in the attached image.
Currently using Mathcad Prime 10.
Kind regards,
Iain
Solved! Go to Solution.
@IA_12699372 wrote:
Thank you, I don't have a copy of the Mathcad original sheet. Asking for a colleague.
So he has to say what the outcome should be in which case and he may be able to provide a worksheet to play with.
He may also ask here himself which could make it easier for him and us. After all taking part in this forum is free anyway.
As I already wrote I see two ways to go. Either trap the error using "try..on error" or avoid the division by zero by adding an additional "if". In both cases we would have to know what the result should be and if we have to distinguish between 'nominator is zero as well" and "nominator is different from zero" or not.
EDIT: Here are two implementations. Both distinguish between 'nominator equals zero' or not in case of denominator is zero. If this is not necessary you may just replace the last "if" by the desired return text.
The second looks much smaller because I used the "if" function instead of the "if" program statement. Of course we could use either "if" in both versions.
As you can see I prefer using functions as its more versatile and also makes it easier to demonstrate the various situations.
You may use "try ... on error ..." to catch the division by zero.
Or you may use an additional "if" statement and ask if the denominator is zero.
In any case you will have to decide what the return value should be.
What is should be in case of (0 kN) / (0 kN) as in your picture and what it should be in case of, lets say, (10 kN)/(0 kN).
In case you still have difficulties implementing either the "try ... on error" or he additional "if" I would suggest that you clearly state which outcomes you expect in which case and that you attach your worksheet so we can show how to do it.
Thank you, I don't have a copy of the Mathcad original sheet. Asking for a colleague.
@IA_12699372 wrote:
Thank you, I don't have a copy of the Mathcad original sheet. Asking for a colleague.
So he has to say what the outcome should be in which case and he may be able to provide a worksheet to play with.
He may also ask here himself which could make it easier for him and us. After all taking part in this forum is free anyway.
As I already wrote I see two ways to go. Either trap the error using "try..on error" or avoid the division by zero by adding an additional "if". In both cases we would have to know what the result should be and if we have to distinguish between 'nominator is zero as well" and "nominator is different from zero" or not.
EDIT: Here are two implementations. Both distinguish between 'nominator equals zero' or not in case of denominator is zero. If this is not necessary you may just replace the last "if" by the desired return text.
The second looks much smaller because I used the "if" function instead of the "if" program statement. Of course we could use either "if" in both versions.
As you can see I prefer using functions as its more versatile and also makes it easier to demonstrate the various situations.
Thank you, that programming "try..on error" worked in this case. Do apologise for not having the original copy in the first place.
Had not seen that you managed to attach the sheet when I wrote my answer above and added the screenshot of my attempt. Had not attached my worksheet as I did in in P11.
Here is a third variant without additional "if" and without "try..on error".
It less flexible as it returns "OK" in case of 0/0 and "adjust" in case of "infinity".
