Monday, May 20, 2019

Intensity/Illumination, Days Since Jan. 1, Derivatives: HP 20S and 21S

Intensity/Illumination, Days Since Jan. 1, Derivatives: HP 20S and 21S

Table of contents

1.  Intensity and Illumination
2.  Days Since January 1
3.  Numerical Derivative

Disclaimer: I believe the key codes for the programs in this blog entry are the all the same even though the HP 20S and HP 21S have slightly different codes.  Format:   Step  Key: Key Code.  I took turns programming the HP 20S and HP 21S.

1.  Intensity and Illumination

The follow equation relates the luminous intensity (measured in candelas, cd) and illuminance (measured in lux) of a light source.  The equation assumes the light source radiates a spherical matter.

E = I / R^2

E = illuminance
I = luminous intensity
R = radius of the sphere's light (meters)

LBL A:  Solve for E
LBL B:  Solve for I
LBL C:  Solve for R

Registers:
R0 = E
R1 = I
R2 = R

Store the following values in the register and execute the appropriate label.

Program:

01  LBL A:  61,41,A
02 RCL 1:  22, 1
03 ÷:  45
04 RCL 2:  22, 2
05 x^2:  51, 11
06 =: 74
07 STO 0:  21, 0
08 R/S:  26
09 LBL B:  61,41,B
10  RCL 0: 22,0
11  *:  55
12  RCL 2: 22,2
13  x^2:  51,11
14  =:  74
15  STO 1: 21, 1
16  R/S:  26
17  LBL C: 61,41,C
18  RCL 1: 22,1
19 ÷: 45
20 RCL 0: 22,0
21  =:  74
22 √:  11
23 STO 2: 21, 2
24 R/S:  26

Example 1:
R1 = I = 400, R2 = R = 2.
Solve for E,  XEQ A returns 100

Example 2:
R0 = E = 180, R2 = R = 3
Solve for I, XEQ B returns 1620

Example 3:
R1 = I =420, R0 = E = 195
Solve for R, XEQ C returns 1.467598771

2.  Days Since January 1

Calculate the number of days since January 1.  For more information, please see:  http://edspi31415.blogspot.com/2019/03/ti-84-plus-and-hp-41c-number-of-days.html

Input:
R1:  day
R2: month
R3: 0 if we are working in a non-leap year, 1 if we are working in a leap year

Output:
R4:  number of days since January 1

Program:

01 LBL A: 61,41,A
02 RCL 1:  22,1
03 STO 4: 21, 4
04 3:  3
05 5:  5
06 STO - 4:  21,65,4
07 RCL 2: 22,2
08  INPUT:  31
09  2:  2
10  x ≤ y?:  61,42
11  GTO 2:  51,41,2
12  RCL 2: 22,2
13  *:  55
14  3:  3
15  0:  0
16  . : 73
17 6:  6
18  +:  75
19  1:  1
20  .  : 73
21  6:  6
22  =:  74
23  IP:  51, 45
24  STO + 4:  21,75,4
25  RCL 3:  22,3
26  STO + 4:  21,75,4
27  RCL 4: 22,4
28  RTN:  61, 26
29  LBL 2:  61,41,2
30  RCL 2:  22,2
31   *:  55
32  3:  3
33  0:  0
34  .  : 73
35  6:  6
36  +:  75
37  3:  3
38  6:  6
39  8:  8
40:  .  : 73
41  8:  8
42 =: 74
43  IP:  51,45
44  STO + 4:  21,75,4
45  3:  3
46  6:  6
47  5:  5
48  STO - 4:  21,65,4
49  RCL 4:  22,4
50  RTN:  61,26

Example 1:
1/1/2019 - 5/7/2019  (non-leap year)
R1:  7,  R2:  5,  R3:  0
Result:  R4 = 126

Example 2:
1/1/2020 - 11/14/2020  (leap year)
R1:  14,  R2:  11, R3:  1
Result:  R4 = 318

3.  Numerical Derivative

f'(x0) ≈ ( f(x0 + h) - f(x0 - h) ) / ( 2*h )

x = point
h = small change of x, example h = 0.0001

LBL A:  Main Progam
LBL F:  f(X), where R0 acts as X

Input variables:
R1 = h
R2 = point x0

Used variables:
R0 = x   (use R0 for f(x), LBL F)

Calculated Variables:
R3 = f'(x)

Radians mode will be set.

Program:

01  LBL A:  61,41A
02  RAD:  61,24
03  RCL 2:  22,2
04  +:  75
05  RCL 1:  22, 1
06  =:  74
07  STO 0:  21,0
08 XEQ F:  41,F
09  STO 3:  21, 3
10  RCL 2: 22,2
11 -:  65
12 RCL 1: 22,1
13 =:  74
14 STO 0: 21,0
15 XEQ F:  41,F
16 STO - 3:  21,65,3
17 2:  2
18 STO ÷ 3:  21,45,3
19  RCL 1:  22,1
20 STO ÷ 3: 21,45,3
21  RCL 3:  22,3
22 R/S:  26
23 LBL F:  61,41,F
...
xx  RTN:  61,26  (end f(X) with RTN)

Example:  e^x * sin x

LBL F
RCL 0
e^x
*
RCL 0
SIN 

RTN

R1 = 0.0001
R2 = x0 = 0.03
Result:  1.060899867

R1 = 0.0001
R2 = x0 = 1.47
Result:  4.7648049


Note:  I am going on vacation this week and I have jury duty in June. So far, I have blog entries scheduled to be posted throughout June 22.  I plan to have a weekly post every Saturday in June.  - E

Eddie

All original content copyright, © 2011-2019.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

  Casio fx-7000G vs Casio fx-CG 50: A Comparison of Generating Statistical Graphs Today’s blog entry is a comparison of how a hist...