▼
Posts: 899
Threads: 193
Joined: Jan 2005
I know the sine of pi in radians should be zero. However,
41CX 4.100 E10
20S 2.067 E13
30S 0.000 E00
I undererstand it has something to do with rounding, but the 30 does not calculate pi to infinity, does it round the answer instead?
What about other models?
▼
Posts: 172
Threads: 13
Joined: Jul 2005
On the HP28C and HP48GX, sin(pi) results in zero (exactly).
▼
Posts: 1,041
Threads: 15
Joined: Jan 2005
Yes, on the RPL calculators, replacing 'SIN(pi)' by 0 is one of the many builtin simplifications, as long as pi is symbolic. Of course, evaluating SIN(3.14159265359) quite correctly returns a nonzero result. To get the 0, clear both flag 2 (Constant > symb) and flag 3 (Function > symb).
Regards, James
Posts: 182
Threads: 17
Joined: Oct 2005
11C: same answer as 41CX
32SII: same as 20S
29C: same as 20S
21: same as 30S (answer is correct: 0)
Yhis last bit surprises me, because it fails to compute 2^30 correctly and almost all its successors are right on that point.
Edited: 27 Aug 2004, 12:45 p.m. after one or more responses were posted
▼
Posts: 1
Threads: 0
Joined: Jan 1970
HP 97 same as the 41 and 11C 4.100 E10
Posts: 8
Threads: 0
Joined: Jan 1970
In the manual for the 15C, it is explained that the value returned by using the PI key on the calculator is good to 10 significant digits. Thus the value returned for sin(PI) is the same as for the 41CX since it is the sin of a 10 digit approximation to PI rather than PI itself. Some calculators carry more than 10 digits in their calculations and thus will produce sin(PI) = 0 when they round to 10 digits. For example, the TI83 produces sin(PI)=0 because it carries internal calculations to 14 digits. If one calculates sin(PI) on the TI83 with the same 10 digit approximation used on the 15C, then the same result as the 15C is generated.
Posts: 406
Threads: 47
Joined: Jul 2005
Of all the different calcs that I have only the 25C and the 31E give exactly zero.
tm
Posts: 331
Threads: 47
Joined: Oct 2005
Here are my results:
HP45 sin(pi)= 0.000000000
HP11C, HP41CV, HP41CX, V41 sin(pi)= 4.10E10
HP20S, 21S, 22S, 32SII, 42S, 71B sin(pi)= 2.06761537357E13
HP30S sin(pi)= 0
Casio fx450 sin(pi)= 0
Commodore SR4912 sin(pi)= 0
Posts: 280
Threads: 38
Joined: Jan 1970
Casio FX880P : 0
Sharp PC1261 : 0
TI59 : 0
HP31E : 4,1000 10
Elektronika MK52 : 0
▼
Posts: 88
Threads: 8
Joined: Jul 2007
How about approaching this as a mathematical problem?
sin (pidelta) = sin (delta)
If delta is small and in radians then
sin (delta) = delta, to a very good approximation.
Now, no calculator can store pi completely
accurately, there is always a difference "delta"
between pi to the number of digits that the
calculator uses and the true value.
So, any calculator that does not round, or
treat pi as a symbolic value, should give the
answer sin (pi) = delta, where delta is this
rounding error.
Those calculators that do give zero are doing one
of the following:
Treating "pi" as a symbolic value, and
recognizing that sin (pi) is exactly zero,
_not_ calculating sin (pi). That is what
HP's RPL calculators do in symbolic mode.
Obtaining a nonzero value, but then
displaying zero because of the display
mode chosen (I am sure that is what gave
zero for people who reported it on models
such as the HP31E or the HP20S).
Rounding a small value to exactly zero. Some
calculators do this "unthinkingly", which is
Bad News, since many other calculations give
small but nonzero values. That is why HP
calculators do not round. Other calcs have
code built in to recognize that certain types
of calculation can reasonably be rounded, for
example if an integer is followed by a string
of zeros, and then a very small value. Casio
and TI routinely do this sort of thing. The
HP30S works to very high precision (almost
30 digits, it has been reported) and is more
justified than most in rounding extremely small
results to zero.
There is one other possibility  that in the
formulae I gave above delta is zero to the precision
of the calculator. If you evaluate pi to enough
significant digits, this will eventually happen.
Just wait for calculators that work to, oh, a million
or more significant figures... ;)
Hope this helps!
Wlodek
▼
Posts: 412
Threads: 40
Joined: Mar 2006
Actually, all Saturnbased machines know the pi value with double precision, and it's easy to get the extra pi digits thanks to the nonrounding behavior:
SIN(3.1415926535) gives 8.97932384626e11, which are the next pi digits: pi=3.1415926535897932384626...
JF
▼
Posts: 1,792
Threads: 62
Joined: Jan 2005
JF Garnier posted,
Quote:
Actually, all Saturnbased machines know the pi value with double precision, and it's easy to get the extra pi digits thanks to the nonrounding behavior:
SIN(3.1415926535) gives 8.97932384626e11, which are the next pi digits: pi=3.1415926535897932384626...
Ya lost me, there. I cannot obtain this result on any Pioneer, or RPLbased (28/48/49) calc that I have.
I get 2.0676157357 x 10^(13) when taking sine of the 12digit approximation of pi on these calc's.
When I convert 'pi' to a number on the RPL models and start "chipping away" the digits (Frac part, 10x, etc...), I stil find that only 12 digits of accuracy are present.
▼
Posts: 412
Threads: 40
Joined: Mar 2006
Try SIN(3.1415926535), not SIN(3.14159265359) ...
JF
▼
Posts: 1,792
Threads: 62
Joined: Jan 2005
JF 
Mea culpa! OK, now I'm getting your results on the Saturnbased machines I mentioned in my last post. I had failed to follow your instructions exactly.
In fact, it can be taken one digit further:
sin (3.14159265358) = 9.79323846264 E12
= 0.00000000000979323846264
However, I believe that your mild "contradiction" of Wlodek:
Quote:
Actually, all Saturnbased machines know the pi value with double precision...
is not strictly correct. This exercise proves only that the Saturnbased HP calculators' algorithm for sine can be used to calculate 12 additional significant digits of pi. It does not prove that the machines "know" the value of pi to 24 significant digits.
As Wlodek stated,
Quote:
sin (pidelta) = sin (delta)
If delta is small and in radians then
sin (delta) = delta, to a very good approximation.
So, when the first N correct digits of pi are entered in "radians" mode, the sine function will yield the next 12 missing digits accurately (for 7 <= N <= 12, as it turns out). That is, the machines will crunch out the Taylor series (or whatever method it uses) accurately to 12 sigificant digits. Since there is no range overlap between the input and the output for this problem, up to the 24th significant digit can be obtained.
This indicates, to me, a wellwritten algorithm that minimizes roundoff error.
The algorithm could be:
sin (x) = x  x^{3}/3! + x^{5}/5!  x^{7}/7! + ...
= a_{0}  a_{1} + a_{2}  a_{3} + ...
with
a_{0} = x
a_{1} = a_{0} * (x/2)*(x/3)
a_{2} = a_{1} * (x/4)*(x/5)
a_{3} = a_{2} * (x/6)*(x/7)
...
Good problem!
 KS
Edited: 31 Aug 2004, 1:22 a.m.
Posts: 50
Threads: 4
Joined: Jan 1970
On the HP 9s, the sine of a number x such that 3.1415926535 <= x <= 3.1415926536 is zero in Radian mode. IMHO this is
not fudging, but a way of using (defining) an irrational number by implementing one of its most important properties, namely: that its sine must be zero.
And the same goes for the 9g and the 30S, with different intervals, though.
Jordi
▼
Posts: 50
Threads: 4
Joined: Jan 1970
FWIW, here are the intervals around pi for which the sine function returns zero on the HP 30S:
[3.141592653589793237976281, 3.141592653589793238945133]
and on the HP 9g:
[3.14159265358979323798, 3.14159265358979323894]
Jordi
Posts: 4,027
Threads: 172
Joined: Aug 2005
Hello Wlodek, guys;
just one single question, "bitte". I remember, when studying Calculus (long time ago), that: sin(delta) = delta but I cannot help remembering the math considerations/approaches and to what extent sin(delta) = delta I mean, how small should delta be so it is true. If sin(delta) = delta is true, then sin(delta) becomes a straight line and it cannot be asymptotic. Is it a math consideration or a numerical approach, what is, in fact, closer to computers?
Just a doubt of mine.
Cheers.
Luiz (Brazil)
▼
Posts: 97
Threads: 25
Joined: Jan 1970
Dear Luiz,
I hope I understood your question correctly.
The Taylorserie is:
f(a+delta)=f(a)+ (n=0)
f'(a)*delta/1!+ (n=1)
f''(a)*(delta)^2/2!+ (n=2)
f'''(a)*(delta)^3/3!+... (n=3, ...)
Then we approximate f(x)=SIN(x), at a=0:

f(x)= SIN(x) and f(a)= 0
f'(x)= COS(x) and f'(a)= 1
f''(x)= SIN(x) and f''(a)= 0
f'''(x)= COS(x) and f'''(a)= 1

f''''(x)=SIN(x), and so on...
So, f(a+delta)==SIN(a+delta)==SIN(delta)=delta(delta)^3/6+...
And we want to use this serie with n=1:
SIN(delta)=delta+Rn(delta), where Rn(delta) is the residual:
Rn(delta)=(deltaa)^(n+1)/(n+1)!*f[n+1](ksi), where f[n+1](ksi)
is the (n+1)'th derivative of f(x) at ksi, where a<=ksi<=delta
Use it, and find the maxima of Rn(delta): (n=1)
Rn(delta)=(delta)^2/2!*f''(ksi), if we want to maximize it, we must
to use f''(ksi)=1:
so, let eps is the "precision of calculator": 1+eps<>1, we get:
###########################################
# #
# eps>=delta^2/2 > delta<=SQRT(2*eps) #
# #
###########################################
On HP32SII: eps=5E12, we get delta<=3.16E6, and with simple
trying I get delta=3.11E6
Best wishes:
Csaba
Edited: 28 Aug 2004, 5:22 p.m.
▼
Posts: 4,027
Threads: 172
Joined: Aug 2005
Hi, guys;
I saw your post, Tizedes, and the TaylorSeries considerations brought some memories back... Thanks! Also, Dave's remark about the limits is precise: (sin(X))/X tends to be a straight line as X gets closer to zero.
So, both numerical and analytical ways lead to a common situation.
Thanks! This is the kind of thread that worth reading head to tail.
Luiz (Brazil)
Edited: 28 Aug 2004, 6:18 p.m.
Posts: 776
Threads: 25
Joined: Jun 2007
Note, also, that
lim [sin(x)/x] = 1 as x> 0
In other words, it IS linear the closer you get to zero.
▼
Posts: 97
Threads: 25
Joined: Jan 1970
.
Edited: 28 Aug 2004, 7:07 p.m.
Posts: 887
Threads: 9
Joined: Jul 2007
To really understand what's going on, sometimes it's better to scrap all the mathematical proofs and just draw, in this case a right triangle with a very slim angle. You'll also see that as the angle approaches zero, the tangent will be the same as the sine. The equations are much more meaningful after we understand what they're representing.
▼
Posts: 901
Threads: 113
Joined: Jun 2007
I recall that in my old precalculus courses such as advanced algebra and trigonometry where the concept of limits and Taylor series had hardly been introduced there was a drawing of a sector defined by a radius R at an acute angle theta from the x axis, the length R along the x axis, and the arc of length R times theta. Then a vertical line was drawn from the intersection of the radius with the arc downward to the x axis (length is R sin theta) and another vertical line was drawn from the point (R,0) upward to connect with the extension of the radius (length is R tan theta). In this diagram the arc length is "squeezed" between the R sin theta segment and the R tan theta segment as the angle is decreased, showing that as the angle approaches zero the sin theta and the tan theta approach the angle theta.
It's a lot easier to draw that than to write it, but I haven't learned how to post drawings.
Posts: 901
Threads: 113
Joined: Jun 2007
You state "Rounding a small value to exactly zero. Some calculators do this "unthinkingly", which is Bad News, since many other calculations give small but nonzero values. That is why HP calculators do not round. Other calcs have code built in to recognize that certain types of calculation can reasonably be rounded, for example if an integer is followed by a string of zeros, and then a very small value. Casio and TI routinely do this sort of thing."
I am fairly familiar with the TI product line but not familiar with that. I know that the HP product carried guard digits and rounded results to ten digits. I also know that the TI product line routinely carried more digits in its results than were available in the display and rounded to the display. The internal results were typically truncated not rounded. TI switched to rounded internal results somewhere in the 1980's with the introduction of the TI68 and TI95.
Can you give me some specific examples of the rounding that you describe?
▼
Posts: 50
Threads: 4
Joined: Jan 1970
Palmer O. Hanson, Jr wrote:
Quote: Can you give me some specific examples of the rounding that you describe?
He might be referring to this posting by John H. Meyers (also in Datafile V15N6p30).
Jordi
Posts: 901
Threads: 113
Joined: Jun 2007
More on funny arithmetic
On an HP41 in radian mode:
sin (pi) =  4.1E10
sin (pi) = + 4.1E10
sin (pi/4)  cos (pi/4) = 2.0E10
On an HP41 in degree mode:
sin (180) = 0
sin (180) = 0
sin (45)  cos (45) = 0
On a TI59 in radian mode
sin (pi) = 0
sin (pi) = 0
sin (pi/4)  cos (pi/4) = 7.0E13
On a TI59 in degree mode:
sin (180) = 0
sin (180) = 0
sin (45)  cos (45) = 7.0E13
On a TI59:
(pi x e)  (e x pi) = pi x 1 INV lnx  1 INV lnx x pi = 2.8E11, but
pi / 1 INV lnx 1/x  1 INV lnx x pi 1/x = 1.0E12
It's enough to make one want to go back to one's slide rule where one KNEW that three digit accuracy was about the best one could do.
▼
Posts: 887
Threads: 9
Joined: Jul 2007
> It's enough to make one want to go back to one's slide
rule where one KNEW that three digit accuracy was about the best one could do.
The 34 digits of the slide rule were usually adequate for real applications too. Trying to guess at the width of the hairline impressed upon us how insignificant further digits really were. Without that reference, people now use a calculator with 10 digits or more, and are not satisfied that accuracy does not always match the extreme precision. Short of positioning a satelite, I can't think of anything that has any use for that many digits.
Posts: 536
Threads: 56
Joined: Jul 2005
as you know, when you press pi on your hp then sin, most models return a nonzero answer. the manuals rather smugly point out that the answer returned is exactly the right answer for the pi approximation used by the machine. you know this.
but,
here is my swift kick in the pants for hp: how about getting the right answer for large arguments. for example, the 48gx gives sin(1e50) = 0.08683927... which is *completely* wrong, the correct answer being, 0.7.8967249342931008271028953...
so there.
▼
Posts: 899
Threads: 193
Joined: Jan 2005
sin is an offense to God, not HP, sine is something different
Posts: 776
Threads: 25
Joined: Jun 2007
Hugh,
re: "the 48gx gives sin(1e50) = 0.08683927... which is
*completely* wrong, the correct answer being, 0.7.8967249342931008271028953..."
Unless you are doing arithmetic to 50 digits, the poor calculator can't do this correctly. Without checking any actual algorithms, I strongly suspect that any calculator has to basically do MOD arithmetic to determine how many complete turns it has to subtract from x, and then determine the sine of the leftover. If the number of (implied) digits exceeds the calculator's number of sig figs, then the answer will be wrong. Your 1e50 means the calculator has to do 50 digit math to get the correct modulo remainder.
▼
Posts: 172
Threads: 13
Joined: Jul 2005
It does bring up an issue with some implementations of trig. functions. Not all of them do a good job at range reduction. I ran across a mention of this problem while reading a book on computational astronomy (J. Meeus). The book uses the sine of 360000030 degrees as an example. The correct answer is 0.5.
▼
Posts: 43
Threads: 10
Joined: Jan 1970
The HP42S does give sin(360000030)=0.5 !
Posts: 536
Threads: 56
Joined: Jul 2005
not true. i had this problem already myself. you need a pi lookup table and you extract the appropriate 10 digit part (for 10 digit results). ok, you need to store the digits, but you dont need 50 digit math.
Posts: 260
Threads: 40
Joined: Jan 1970
I get 8.68392788E2 for the HP20S. My TIs 89T and 36X both return ERROR.
