Post Reply 
[HP 35s] Hosoda trig program giving incorrect answers to certain angles
08-05-2015, 02:36 PM (This post was last modified: 08-05-2015 04:30 PM by Marcio.)
Post: #1
[HP 35s] Hosoda trig program giving incorrect answers to certain angles
Hello all,

After clearing all variables and registers, I noticed that Hosoda gives wrong answers to certain angles (cosine) on my 35s:
\[
\begin{matrix} & Hosoda & 35s & 34s & 50g \\ 5\frac { \pi }{ 180 } & 9.96194698092E-1 & 9.96194698092E-1 & 9.96194698092E-1 & 9.96194698092E-1 \\ 75\frac { \pi }{ 180 } & 2.58819045098E-1 & 2.58819045098E-1 & 2.58819045103E-1 & 2.58819045108E-1 \\ 89.999\frac { \pi }{ 180 } & 1.74532948958E-5 & 1.74532948891E-5 & 1.74532925187E-5 & 1.74532948957E-5 \\ 89.9999\frac { \pi }{ 180 } & 1.74532489662E-6 & 1.74532489000E-6 & 1.74532925262E-6 & 1.74532489662E-6 \end{matrix} \]

Does anybody have any idea as to what is happening? Maybe I am missing something here?

I have already double-checked all program lines and everything is exactly as before.

Very much appreciated.

Marcio

CORRECTION: Hosoda trig program is working as expected, it was I who "forgot" about the significant loss of accuracy that occurs while converting from DEG to RAD, as pointed out by our dear friend Gerald.
Find all posts by this user
Quote this message in a reply
08-05-2015, 02:49 PM
Post: #2
RE: [HP 35s] Hosoda trig program giving incorrect answers for certain angles
(08-05-2015 02:36 PM)Marcio Wrote:  Hello all,

After clearing all variables and registers, I noticed that Hosoda gives wrong answers to certain angles (cosine) on my 35s:
\[
\begin{matrix} & Hosoda & 35s & 34s \\ 5 & 9.96194698092E-1 & 9.96194698092E-1 & 9.96194698092E-1 \\ 75 & 2.58819045098E-1 & 2.58819045103E-1 & 2.58819045103E-1 \\ 89.999 & 1.74532948958E-5 & 1.74532925091E-5 & 1.74532925191E-5 \\ 89.9999 & 1.74532489662E-6 & 1.74532925000E-6 & 1.74532925199E-6 \end{matrix}\]

Does anybody have any idea as to what is happening? Maybe I am missing something here?

I have already double-checked all program lines and everything is exactly as before.

Very much appreciated.

Marcio

Could it be related to the fact that near 90° the 35s trig functions have very limited accuracy? (about four digits only)

Tom L

Tom L

I never knew my mother was such an animal lover. When the doctor told her the rabbit died, she went into shock!
Find all posts by this user
Quote this message in a reply
08-05-2015, 02:57 PM (This post was last modified: 08-05-2015 03:26 PM by Marcio.)
Post: #3
RE: [HP 35s] Hosoda trig program giving incorrect answers for certain angles
(08-05-2015 02:49 PM)toml_12953 Wrote:  Could it be related to the fact that near 90° the 35s trig functions have very limited accuracy? (about four digits only)

Tom L
Well, the 35s does have troubles getting all digits correct when the angles are very small (1E-7°) or near 90°, as in 89.9999° (four decimals, not three), but the Hosoda code, a 3rd party program, is supposed to get digits right. I myself have been working with it a lot lately and yesterday, after clearing everything, I noticed this weird behaviour. I suspect it has to do with some registers not being real numbers, and they got erased, I know, it seems crazy but it is all I can remember from yesterday. To make matters worse, while \(e^x\) is stable across the entire domain on the 35s, \(e^{ix}\) shows the same instability as observed on the trig functions calculated by the 35s on those very same angles.
Find all posts by this user
Quote this message in a reply
08-05-2015, 03:17 PM (This post was last modified: 08-05-2015 03:29 PM by Gerald H.)
Post: #4
RE: [HP 35s] Hosoda trig program giving incorrect answers for certain angles
Hosoda's programmes only work in radian measures.

For 75°, ie 75 * pi / 180, the programme returned

2.58819045108E-1

ie I did the ->RAD by hand, not using the built-in function.

Other values as you have them.
Find all posts by this user
Quote this message in a reply
08-05-2015, 03:19 PM (This post was last modified: 08-05-2015 03:23 PM by Marcio.)
Post: #5
RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles
(08-05-2015 03:17 PM)Gerald H Wrote:  Hosoda's programmes only work in radian measures.

For 75°, ie 75 * pi / 180, the programme returned

2.58819045108E-1

Other values as you have them.

Yes, I converted them to RAD before calling the routines.

EDIT: The last digit of your answer reads 8. Is it not 3?
Find all posts by this user
Quote this message in a reply
08-05-2015, 03:25 PM (This post was last modified: 08-05-2015 03:26 PM by Gerald H.)
Post: #6
RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles
I've now edited my posting to show I did not use the built-in ->RAD function.
Find all posts by this user
Quote this message in a reply
08-05-2015, 03:29 PM
Post: #7
RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles
(08-05-2015 03:25 PM)Gerald H Wrote:  I've now edited my posting to show I did not use the built-in ->RAD function.

That's alright. Smile

Regarding the incorrect answers, what do you, as an experienced user, think?

Thanks

Marcio
Find all posts by this user
Quote this message in a reply
08-05-2015, 03:31 PM (This post was last modified: 08-05-2015 03:32 PM by Gerald H.)
Post: #8
RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles
I, as a lazy user, think the conversion ->RAD produces inaccuracies & Hosoda's programmes may be inaccurate near the cusp.
Find all posts by this user
Quote this message in a reply
08-05-2015, 03:44 PM
Post: #9
RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles
89.9999 ->RAD gives 1.57079458147 on the 35S

actual value is more like 1.57079458146564...

so you can't expect so much accuracy from the result.
Find all posts by this user
Quote this message in a reply
08-05-2015, 03:47 PM (This post was last modified: 08-05-2015 03:50 PM by Marcio.)
Post: #10
RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles
My dear Gerald, with all due respect, I think you're missing the point. Please, have another look at the table at the beginning. Until recently, the Hososa code I have here gave the same answers as the 34s, which uses more digits deep inside.

Thanks

Marcio
Find all posts by this user
Quote this message in a reply
08-05-2015, 03:50 PM
Post: #11
RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles
Try inputting 1.57079458147 on the 34S & see the value returned.
Find all posts by this user
Quote this message in a reply
08-05-2015, 04:21 PM
Post: #12
RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles
& on my trusty HP 48S

89.9999° COS returns 1.74532925199E-6

& converted to radians

1.57079458147 returns1.74532489662E-6
Find all posts by this user
Quote this message in a reply
08-05-2015, 04:23 PM (This post was last modified: 08-05-2015 04:33 PM by Marcio.)
Post: #13
RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles
Yes, you're 100% correct. It was just another lapse of mine! I never thought the impact would be that big though! Thank you for pointing that out.

EDIT: I have also updated the table.
Marcio
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)