Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: Mathcad v14 trig functions calculate incorrect...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2014
12:42 PM

12-11-2014
12:42 PM

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?

Labels:

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2014
01:12 PM

12-11-2014
01:12 PM

Re: Mathcad v14 trig functions calculate incorrectly

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2014
01:33 PM

12-11-2014
01:33 PM

Re: Mathcad v14 trig functions calculate incorrectly

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2014
01:37 PM

12-11-2014
01:37 PM

Re: Mathcad v14 trig functions calculate incorrectly

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2014
01:18 PM

12-11-2014
01:18 PM

Re: Mathcad v14 trig functions calculate incorrectly

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.