Monday, October 27, 2014

More Fun with HP 12C (sine, cosine, error function approximations)


Fun with HP 12C Part II


Sine Approximation

Source:  Ted’s Math World, Calculator Magic #4

 
Retrieved 2014-10-13

sin x ≈ (((x^2/72 – 1)*x^2/42 + 1)*x^/20 – 1)*x^2/6 + 1)*x

 Registers:  R0 = x in radians, R1 = sin x

 
STEP
KEY
CODE
STEP
KEY
CODE
01
STO 0
44, 0
21
0
0
02
2
2
22
÷
10
03
y^x
21
23
*
20
04
ENTER
36
24
1
1
05
ENTER
36
25
-
30
06
ENTER
36
26
X<>Y
34
07
7
7
27
6
6
08
2
2
28
÷
10
09
÷
10
29
*
20
10
1
1
30
1
1
11
-
30
31
+
40
12
X<>Y
34
32
RCL 0
45, 0
13
4
4
33
*
20
14
2
2
34
STO 1
44, 1
15
÷
10
35
GTO 00
43, 33, 00
16
*
20
 
 
 
17
1
1
 
 
 
18
+
40
 
 
 
19
X<>Y
34
 
 
 
20
2
2
 
 
 

 
Examples:

sin 0.25 ≈ 0.2474

sin -1.82 ≈ -0.9691

Cosine Approximation

Source:  Ted’s Math World, Calculator Magic #4


Retrieved 2014-10-13

cos x ≈ (((x^2/56 – 1)*x^2/30 + 1)*x^2/12 – 1)*x^2/2 + 1

Registers:  R0 = x in radians, R1 = cos x
 
STEP
KEY
CODE
STEP
KEY
CODE
1
STO 0
44, 0
17
1
1
2
2
2
18
+
40
3
Y^X
21
19
X<>Y
34
4
ENTER
36
20
1
1
5
ENTER
36
21
2
2
6
ENTER
36
22
÷
10
7
5
5
23
*
20
8
6
6
24
1
1
9
÷
10
25
-
30
10
1
1
26
X<>Y
34
11
-
30
27
2
2
12
X<>y
34
28
÷
10
13
3
3
29
*
20
14
0
0
30
1
1
15
÷
10
31
+
40
16
*
20
32
STO 1
44, 1
 
 
 
33
GTO 00
43,33,0
 
 
 
 
 
 

 
cos 0.33 ≈ 0.23847605343

cos -0.58 ≈ 0.83646264991

 
Rough Approximation for erf(x)

If x ≤ 1, accuracy is at least 3 digits.  Method:  3/8 Integration Rule

Source:  Ball, John A.   “Algorithms for RPN Calculators” John Wiley & Sons:  1978.

STEP
KEY
CODE
STEP
KEY
CODE
1
STO 0
44, 0
26
CHS
16
2
3
3
27
e^x
43, 22
3
÷
10
28
+
40
4
2
2
29
8
8
5
Y^X
21
30
÷
10
6
CHS
16
31
3
3
7
e^x
43, 22
32
*
20
8
ENTER
36
33
RCL 0
45, 0
9
RCL 0
45, 0
34
*
20
10
2
2
35
3
3
11
*
20
36
÷
10
12
3
3
37
1
1
13
÷
10
38
.
48
14
2
2
39
1
1
15
Y^X
21
40
2
2
16
CHS
16
41
8
8
17
e^x
43, 22
42
3
3
18
+
30
43
7
7
19
3
3
44
9
9
20
*
20
45
7
7
21
1
1
46
*
20
22
+
40
47
GTO 00
43,33,00
23
RCL 0
45, 0
 
 
 
24
2
2
 
 
 
25
Y^X
21
 
 
 

 

Examples:

x = .15;  Result ≈ 0.1680

x = .50;  Result ≈ 0.5205

x = 1.25; Result ≈ 0.9220  (actual ≈ 0.9229)
 
 
This blog is property of Edward Shore, 2014.