HP Forums
(35S) Accurate Trig Functions Corrected - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (35S) Accurate Trig Functions Corrected (/thread-4258.html)



(35S) Accurate Trig Functions Corrected - Gerald H - 06-29-2015 03:33 PM

All of the copies of Hosoda's improved trig functions I have found err in missing out lines H005 & H006 - I have at last decided to supply the lack.

Code:

SIN
H001 LBL H
H002 XEQ J015
H003 χ<>y
H004 XEQ I006
H005 FS? 3
H006 +/-
H007 XEQ J004
H008 RTN

COS
I001 LBL I
I002 XEQ J015
I003 XEQ I006
I004 XEQ J004
I005 RTN

TAN TO COS
I006 i1
I007 ×
I008 +
I009 LASTχ
I010 χ<>y
I011 ÷
I012 ABS
I013 FS? 3
I014 +/-
I015 FS? 4
I016 +/-
I017 RTN

TAN
J001 LBL J
J002 XEQ J015
J003 ÷

RESTORE REGS
J004 3
J005 STO I
J006 CLχ
J007 RCL(I)
J008 DSE I
J009 GTO J007
J010 R↑
J011 χ<>(I)
J012 ABS
J013 χ<>(I)
J014 RTN

SAVE REGS
J015 RPN
J016 STO J
J017 CLχ
J018 4
J019 STO I
J020 STO(I)
J021 DSE I
J022 R↑
J023 STO(I)
J024 DSE I
J025 GTO J022 
J026 RCL J
J027 STO(I)

RANGE REDUCTION
J028 CF 1
J029 SF 2
J030 CF 3
J031 CF 4
J032 χ<0?
J033 SF 1
J034 ABS
J035 ENTER
J036 ENTER
J037 π
J038 STO I
J039 RMDR
J040 χ<>y
J041 LASTχ
J042 INT÷
J043 STO J
J044 2
J045 RMDR
J046 χ≠0?
J047 SF 4
J048 R↓
J049 0.25
J050 RCL× I
J051 χ<y?
J052 CF 2
J053 CLχ
J054 0.5
J055 RCL× I
J056 x≤y?
J057 SF 3
J058 CLχ
J059 0.75
J060 RCL× I
J061 χ<>y
J062 χ<y?
J063 GTO J068
J064 SF 2
J065 RCL- I
J066 ISG J
J067 2007 09/06
J068 FS? 2
J069 GTO J078
J070 ENTER
J071 +
J072 RCL- I
J073 0.5
J074 ×
J075 LASTχ
J076 STO+ J
J077 CLχ
J078 2.06761537357E-13
J079 RCL× J
J080 +

TAN APPROXIMATION
J081 STO J
J082 χ²
J083 ENTER
J084 ENTER
J085 ENTER
J086 7.7158e-2
J087 ×
J088 11
J089 -
J090 ÷
J091 9
J092 +
J093 ÷
J094 7
J095 -
J096 ÷
J097 5
J098 +
J099 ÷
J100 3
J101 -
J102 ÷
J103 1
J104 +
J105 RCL J
J106 χ<>y
J107 FS? 2
J108 GTO J111
J109 +/-
J110 χ<>y
J111 FS? 1
J112 +/-
J113 RTN



RE: HP 35S: Accurate Trig Functions Corrected - Marcio - 07-24-2015 02:46 AM

Dear Gerald,

Have you ever used Hosoda's to solve an equation inside a program?

I do hope I am missing something because it seems to me that the 35s's solver enters an infinite loop when I try to solve equations as simple as \(y=sin(p)\).

This is the program I am using, assuming \(y=1\):

F001 LBL F
F002 RCL P
F003 XEQ H001;
F004 1
F005 -
F006 RTN

FN = F

Solve for P.

The 35s, 50g and Prime will get at least 4 digits correct for this specific example, the final digits will vary based on the start guess provided.

\(p=89.9999....\)

Thanks.

Marcio


RE: HP 35S: Accurate Trig Functions Corrected - Gerald H - 07-24-2015 05:34 AM

This is a question about the Solver, Marcio, so please start a new thread, best place is general forum.


RE: HP 35S: Accurate Trig Functions Corrected - Gerald H - 07-24-2015 05:35 AM

Here's a link to Hosoda's original article:

http://www.finetune.co.jp/~lyuka/technote/trig/tan-hp35s.html


RE: HP 35S: Accurate Trig Functions Corrected - Marcio - 07-24-2015 10:07 AM

(07-24-2015 05:34 AM)Gerald H Wrote:  This is a question about the Solver, Marcio, so please start a new thread, best place is general forum.

I suspect Hosoda's gets affected by bug 20:
Code:
 BUG 20: Solve infinite loops for some program based functions. Assign FN=D and SOLVE the following for X. 
The solve doesn't finish. This seems to be related to using a loop in the function being solved.

D001 LBL D
D002 10
D003 STO N
D004 DSE N
D005 GTO D004
D006 RCL X
D007 COS
D008 RTN

but I have not had the time to check if the workaround will actually work in this case. I will open a new thread as soon as I am back from work.

Thanks.


RE: HP 35S: Accurate Trig Functions Corrected - lyuka - 08-02-2015 05:04 PM

(06-29-2015 03:33 PM)Gerald H Wrote:  All of the copies of Hosoda's improved trig functions I have found err in missing out lines H005 & H006 - I have at last decided to supply the lack.

Code:

H005 FS? 3
H006 +/-

Thanks Gerald. I corrected the missing two lines of the code on my websites now.


RE: HP 35S: Accurate Trig Functions Corrected - Gerald H - 08-02-2015 05:58 PM

Pleased to see the corrected programme.

Nice work.