cosine of 270-deg not quite zero

cosine of 270-deg not quite zero - Messages

#1 Posted: 4/27/2021 12:17:31 PM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

2021-04-27 11_13_57-SMath Studio - [Abspasta Concepts v1.0.sm_].png

Any thoughts?
#2 Posted: 4/27/2021 2:59:56 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Any thoughts ?


It has nothing to do with Smath that displays Win Trig.

#3 Posted: 4/27/2021 7:11:35 PM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

Wrote


It has nothing to do with Smath that displays Win Trig.



Not sure I follow...

Let me be more exact in my request.

Why is cos(270-deg) not equal to zero?

What can I do to make cos(270-deg) equal to zero?

I'll be honest, I'm a bit surprised this even an issue. Seems very basic.
#4 Posted: 4/27/2021 7:42:39 PM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

sine of 360 is also not quite zero...
#5 Posted: 4/27/2021 7:50:52 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote


I'll be honest, I'm a bit surprised this even an issue. Seems very basic.



Don't worry, other math programs may surprise you too. SMath, like many other programs, has two forms of calculation: numeric (=) and symbolic (Ctrl + dot). However, the SMath symbolic kernel is not well as others may be, but at least it almost always gives very good results. In this case, it does not give 0, but it does give a symbolic result equivalent to 0.

Clipboard00.jpg

The same can be obtained in Matlab, in this case, using the sym command, which, by the way, changed its syntax very recently.

Clipboard01.jpg

Also WolframAlpha has two answers for the same question, although in the end he opts only to show the exact value.

Clipboard02.jpg

That is, the three programs coincide in giving something very close to 0, but not when the numerical answer is requested, and 0 or some expression equivalent to 0 when they are evaluated symbolically.

Anyway, if you check the code of the symbolic calculation programs you may be disappointed: to evaluate these types of formulas, they actually simply have a table of results where they can find the exact values ​​for a reduced input set. That is to say, in fact, until recently, almost no one applied very elaborate rules to solve those formulas.

Best regards.
Alvaro.
1 users liked this post
Andrey Ivashov 4/28/2021 1:49:00 AM
#6 Posted: 4/27/2021 8:13:22 PM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

Yeah, did some more reading and I guess since pi is only carried out to 16 decimal places (floating), the conversion from radians to degrees (pi/180) is limited by the 16 decimal place value of pi.

What isn’t super clear is why it only happens with 270 degrees for cosine and 360 degrees for sine. Pi/180 is used to convert all input to angles.

Maybe at some point in my studies I learned why 270 degrees and 360 degrees are special, but I don’t remember now.
#7 Posted: 4/28/2021 4:20:57 AM
Denis Nikitin

Denis Nikitin

2 likes in 12 posts.

Group: User

2021.04.28-10.27.58.png
#8 Posted: 4/28/2021 4:52:33 AM
Denis Nikitin

Denis Nikitin

2 likes in 12 posts.

Group: User

2021.04.28-10.50.58.png
#9 Posted: 4/28/2021 8:35:14 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Yeah, did some more reading and I guess since pi is only carried out to 16 decimal places (floating), the conversion from radians to degrees (pi/180) is limited by the 16 decimal place value of pi.

What isn’t super clear is why it only happens with 270 degrees for cosine and 360 degrees for sine. Pi/180 is used to convert all input to angles.

Maybe at some point in my studies I learned why 270 degrees and 360 degrees are special, but I don’t remember now.


Pi and more numbers are stored in computing machinery 40 decimals.
Not a single function exist in maths. They are approximated from the
4 basic arithmetic operations [+, -, *, /].
They are all normalized rational fraction P(n)/1+Q(n) on short range.
then like scaled. The coded native range is globally 21 floating point.
Error propagation brings down to around 18 floating point, by convention
15 digits are considered true to meet typical Abramowitz & Stegun.
Smath, Wolfram Alpha, Mathcad/PTC ... and else don't abide to the
convention of rounding smaller than 15 D to zero.
Mathcad 8, 2000, 2001i, 11 do round cos(270) = 0
In short, Smath does not calculate cos(270), trig and more exp, ln
are built-in in Windows. Smath and those more display the floating
point register, since when they broke the 15 D convention ?
Read more: Luke, Cody Junior, Hart et al.
round(cos((270),15)=0
Not built-in Windows from Smath menu ... Bessel, Airy ...
Have a good day ... Jean

#10 Posted: 4/28/2021 9:54:49 AM
Denis Nikitin

Denis Nikitin

2 likes in 12 posts.

Group: User

2021.04.28-15.53.49.png
#11 Posted: 4/28/2021 11:55:57 AM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

This seems to be a good solution since only 270-deg with cosine and 360-deg with sine seem to be an issue.

2021-04-28 10_51_51.png
#12 Posted: 4/28/2021 1:30:04 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

This seems to be a good solution since only
270-deg with cosine and 360-deg with sine seem to be an issue.


Add reality ... cos(270deg).PNG
Doing that is bug vs PTC Mathcad, Wolfram Alpha ...
The question is: why and since when CAS don't define result < 10^-15 = 0
  • New Posts New Posts
  • No New Posts No New Posts