×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

MathCAd Error

MathCAd Error

MathCAd Error

(OP)
Hi Folks,

Please help me with the issues I have encountered using MathCAd 15. I'm using a Script with program on it but the result box shows differently. Please see snap for reference. I dont know which part is wrong. Thanks.

When I redefined one of the values using the same magnitude, the result box become correct.
Replies continue below

Recommended for you

RE: MathCAd Error

Both are technically wrong, as written.

> In both boxes, you are comparing fractions using Mathcad's internal floating point representation, so the difference of two fractions is not equivalent to resultant fraction, when expressed in floating point. The usual approach is to compare against some sort of ε, which is the largest possible valid floating point difference, rather than zero
> Your second box has the two input values reversed

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

RE: MathCAd Error

(OP)
sorry. I'm not into programming. Can you please explain further. It will help me a lot. Thanks.

RE: MathCAd Error

You should be able to do at least the math; this is pretty much high school stuff

Instead of

If Inputs(0).Value > Inputs(1).Value Then

you would have

If Inputs(0).Value - Inputs(1).Value > epsilon Then

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

RE: MathCAd Error

(OP)
Oh I see. Thanks.

I'm thinking if there is any option or program that can possibly round the given value into closest number that may used to satisfy the "equal part" of the program.

There is no problem in greater or less than part, its just the equal portion.

Thanks.

bigsmile

RE: MathCAd Error

Round both numbers to the desired number of places then.

RE: MathCAd Error

That's essentially equivalent to comparing the difference to epsilon, but there's still a risk of rounding the wrong direction and it removes the precision that the floating point values have.

Best practice is to use full precision and compare against a known static value. I think you are missing the point. The use of the epsilon is specifically for comparing "equal" values that might not have exactly identical floating point representation. This is hardly a new problem; it's been around since computer programs starting using floating point numbers.

If you must, you can leave the numbers as fractions using Mathcad's symbolic engine

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close