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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Mathcad v14 trig functions calculate incorrectly

ptc-1428060
1-Newbie

Mathcad v14 trig functions calculate incorrectly

Does anybody know if this error has been corrected in subsequent versions? Mathcad v14 does not calculate sin(180 deg) or cos(90 deg) as 0. There is a value out to ~16 decimal places, which would not normally be an issue, but I have a 0/0 division calculation that returns an error because of this. Using radians rather than degrees does not change the value calculated. I have created a kludge workaround, but I shouldn't have to. Is there a program fix for this? And does PTC know?

4 REPLIES 4

I wouldn't call this an error. Mathcad is a numeric number cruncher and the results are within its numeric accuracy.

If you need something better you might consider using the symbolic evaluation. The screenshot below was made in the current release of Mathcad 15 and I guess it would be similar in Prime, too. I am just too lazy to fire up that uncomfortable slow horse.

1.png

StuartBruff
23-Emerald II
(To:Werner_E)

And just for comparison with another mainstream maths application, here are the Matlab 2014a results for the same calculation:

Trial>> sin(pi)

ans =

1.224646799147353e-16

Trial>> cos(pi/2)

ans =

6.123233995736766e-17

Trial>> sin(3*pi)

ans =

3.673940397442059e-16

Trial>> cos(101*pi/2)

ans =

4.408109496293883e-15

Trial>>

Very similar and for the same reason - standard fixed-width floating point roundoff.

Stuart

And, for forms sake, here's Excel's take on it ...

1.2251484549086E-16
6.1257422745431E-17
3.6754453647259E-16
4.4106428578883E-15

So, unfortunately, you'll find this behaviour is common to many, industry-standard numeric applications.

Stuart

RichardJ
19-Tanzanite
(To:ptc-1428060)

Roundoff error is the nature of numeric processing. This has come up before, more than once. See here:

http://communities.ptc.com/message/70317#70317

http://communities.ptc.com/message/258037#258037

Maybe the worksheet I posted in the second thread would be a solution for you.

Top Tags