Friday, March 22, 2019

HP Prime: Two Port Network Transistor Configuration Conversions (h-Parameter Conversions)

HP Prime: Two Port Network Transistor Configuration Conversions (h-Parameter Conversions)

Introduction

The program TRCONV converts h-parameter matrices for the following configurations of two-port networks:

*  Common Base Transistor Configuration (CB)
*  Common Emitter Transistor Configuration (CE)
*  Common Collector Transistor Configuration (CC)

The h-parameter matrix, also known as a hybrid parameter, is a 2 x 2 matrix representation of a two port network. 



H = [ [ h11,  h12 ] , [ h21, h22 ] ] where:

[ [ V1 ], [ I2 ] ] = = [ [ h11,  h12 ] , [ h21, h22 ] ] * [ [ I1 ], [ V2 ] ]

The h-parameter matrix takes into account the short circuit condition (h11, h22) and the open circuit condition (h12, h21) in the two port network. 

The dimensions of the entries are:

h11:  input impedance, in ohms (Ω)
h12:  reverse voltage gain, dimensionless
h21:  forward current gain, dimensionless
h22:  output admittance, in seimens or mhos (1/Ω)

The resulting matrix from TRCONV is known as a y-parameter matrix. 

HP Prime Program TRCONV

EXPORT TRCONV()
BEGIN
// 2019-03-10
// HP 67
LOCAL h11,h12,h21,h22;
LOCAL y11,y12,y21,y22;
LOCAL w1,w2,w3,w4,w5;
LOCAL t,l;

l:={"CE→CB","CB→CE","CC→CB",
"CB→CC","CC→CE","CE→CC"};

INPUT(
{{h11,[[0],[3]]},
{h12,[[0],[3]]},
{h21,[[0],[3]]},
{h22,[[0],[3]]},
{t,l}},
"TRANSISTOR CONVERSION",
{"h11: ","h12: ","h21: ",
"h22: ","Type:"}
);

y11:=1/h11;
y12:=−h12/h11;
y21:=h21/h11;
y22:=(h11*h22-h12*h21)/h11;

MSGBOX([[y11,y12],[y21,y22]]);

w1:=y11+y12+y21+y22;
w2:=−(y12+y22);
w3:=−(y21+y22);
w4:=−(y11+y12);
w5:=−(y11+y21);

IF t==1 OR t==2 THEN
RETURN [[w1,w2],[w3,y11]];
END;

IF t==3 THEN
RETURN [[y22,w3],[w2,w1]];
END;

IF t==4 THEN
RETURN [[w1,w5],[w4,y11]];
END;

IF t==5 OR t==6 THEN
RETURN [[y11,w4],[w5,w1]];
END;

END;

Example:

H = [ [ 150, 0.003 ], [ 68, 0.007 ] ]

CE → CB:  [ [ 0.46562, -0.00562 ], [ -0.458973333333, 6.666666667E-3 ] ]

CC → CE: [ [ 6.666666667E-3, -6.646666667E-3 ], [ -0.46, 0.46562 ] ]



Source: 

"5. Transistors Configuration Conversion"  HP 67-97 E.E. Pac I.  Hewlett Packard.  1976

"h Parameter or Hybrid Parameter of Two Port Network" Electrical Concepts.  2019  https://electricalbaba.com/h-parameter-hybrid-parameter-two-port-network/  Retrieved March 21, 2019


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.

Thursday, March 21, 2019

DM 41L: A Song of Irrational Numbers

Tones of the first ten digits of the constants π, √2, Zeta(2), Phi (Golden Ratio constant), and e (Euclidean constant) using the Swiss Micros DM 41L


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. 

Tuesday, March 19, 2019

Algebra: Solving Simple Non-Linear Systems

Algebra: Solving Simple Non-Linear Systems




System I:  

x + y = a
x^2 + y = b

Solving for y:
x + y = a
y = a - x

Subtracting the two equations from the system:
x + y = a
- [x^2 + y] = -[ b ]

x - x^2 = a - b
x^2 - x = b - a
x^2 - x - (b - a) = 0

Solving for x:
x = ( 1 ± √(1 - 4*(b - a) ) / 2

Summary for System I:
x = ( 1 ± √(1 - 4*(b - a) ) / 2
y = a - x

If a and b are real numbers, then 1 - 4*(b - a) ≥ 0, and
1 ≥ 4*(b - a)

System II:

x + y = a
x + y^2 = b

Solving for x:
x + y = a
x  = a - y

Subtracting the two equations from the system:
x + y = a
- [ x + y^2 ] = -[ b ]

y - y^2 = a - b
y^2 - y = b - a
y^2 - y - (b - a) = 0

Solving for y:
y = ( 1 ± √(1 - 4*(b - a) )/2

Summary for System II:
x  = a - y
y = ( 1 ± √(1 - 4*(b - a) )/2

System III:

x + y = a
x^2 + y^2 = b

Solving for y:
y = a - x

Solving for x:
x^2 + (a - x)^2 = b
x^2 + a^2 - 2*a*x + x^2 = b
2*x^2 - 2*a*x + (a^2 - b) = 0

x = ( 2*a ± √(4*a^2 - 4*2*(a^2 - b) ) / 4
x = ( 2*a ± √(4*a^2 - 8*(a^2 - b) ) / 4
x = ( 2*a ± √(4*a^2 - 8*a^2 + 8*b) ) / 4
x = ( 2*a ± √(8*b - 4*a^2) ) / 4
x = ( a ± √(2*b - a^2) ) / 2

Summary for System III:
x = ( a ± √(2*b - a^2) ) / 2
y = a - x

System IV:

x^2 + y^2 = a
x * y = b

Solving for y:
y = b / x 

I'm assuming that x ≠0 and y ≠0.

x^2 + y^2 = a
x^2 + (b / x)^2 = a
x^4 + b^2 = a * x^2
x^2 - a * x^2 + b^2 = 0

Let w = x^2, then w^2 = x^4

Then:
w^2 - a*w + b^2 = 0

Then:
w = (a ± √(a^2 - 4 * b^2) )/ 2

And:
x = ± √( (a ± √(a^2 - 4 * b^2) )/ 2 )

We have four answers to the system.

Summary for System IV:
x = ± √( (a ± √(a^2 - 4 * b^2) )/ 2 )
y = b / x 

A lot of fun,

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.

Thursday, March 14, 2019

Birthday Blog: Fun Facts About Me

Fun Facts About, me, Eddie Shore, the author of Eddie's Math and Calculator Blog:





1.  I have a Bachelor's Degree in Accounting and a Master's Degree in Mathematics, both from Cal Poly Pomona.

2.  I don't have a favorite sport.

3. My favorite video games are Super Mario Maker, Super Mario Brothers, Mario Kart, Millipede, and Joust.

4. My favorite colors are sky blue, denim blue, forest green, and gold.

5. For you zodiac fans, my zodiac sign is Pisces.  Both of my parents are Geminis, and most of my closest friends are Scorpios.

6. Chocolate chip cookies are my weakness.

7. My four favorite go-to music artists are Earth, Wind & Fire, Stevie Wonder, Janet Jackson, and Sheryl Crow.

8. At home, I have two dogs and three cats. 

9.  I'm Irish and Mexican.

10.  Every morning I write what I want to accomplish for the day.  I go through a lot of Post-Its.

11. The beach is my sanctuary.

12. The mathematics section of university library is to me what Disneyland is to most people, only I don't have to pay $60 for an admission ticket. ;)  My favorite library is the Honnold Mudd Library in Claremont (Claremont Colleges).

13. I can't live without music.  Or calculators.

14. My dream car is a Ferrari. 

15. I prefer tea over coffee.

16. My turn ons are honesty, warmth, kindness, intelligence, and a love for life.

17. My turn offs are dishonesty, arrogance, racism, sexism, and ageism.

18. My bucket list grows by the day.

19. I am very close to my family. 

20. My favorite vacation spot so far is Maui.

21. My favorite number is pi (π), partly because my birthday is March 14 (the day that this blog is posted).

22. I want to go to Greece, Italy, Ireland, and New Zealand.  I'd probably wouldn't return home. 

23. My guilty pleasure is the Real Housewives of New Jersey.  #TeamMargaretJosephs

24. I'm nearsighted and prefer glasses to contacts.

25. I prefer wine over beer, but I do enjoy a good ale.  My favorite shot is Fireball.

26. My newest favorite YouTube channel is Doctor Mike. Favorite of all time is both Cinemasins and Music Video Sins.

27. My favorite calculators are the HP Prime, HP 42S, HP 12C, TI-84 Plus CE and Casio fx-991EX.

28. I am a Press Your Luck addict. Big Bucks, no whammies!

29. I have two dogs and three cats.

30. My music tastes are kind of eccentric, but I learn towards rock, alternative, and some R & B.  I do have a Spotify account. 

31.  My favorite fruits of cherries, applies, and strawberries.

32.  My favorite holiday used to be Christmas, now it's Halloween.

33.  A hobby I like but don't do enough of is art.  I'm drawn to glass art, mythological art, and fantasy art. 

34.  My favorite movie is Ghostbusters - the 1984 original one.

35.  My favorite pie is apple. 

36.  My favorite fonts are Arial, Courier, Futura, and Banschrift.

37.  I lived in Southern California all my life.

38.  Starting and writing on this blog is one of the most fun things I am very fortunate to do, and I thank you for reading and supporting this blog. 






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.




Wednesday, March 13, 2019

TI-84 Plus: Greenwich Mean Sidereal Time Estimate

TI-84 Plus:  Greenwich Mean Sidereal Time Estimate

Introduction

The program GMST calculates and estimates the Greenwich Mean Sidereal Time for any dates between January 1, 1900 and December 31, 2099.

For any date between 1900 and 2099, the date number is calculated as:

number of days since January 1 + (year - 1900) * 365 + int((1900 - year)/4) + 0.5 + hour/24

Please keep in mind, the formula in this program is from 1978 (see source).

For the hour, a 2400 hour clock format is used.  For example, 1 AM = 1, 1 PM = 13. 

This program does not take the location of the observer into account.

TI-84 Plus Program: GMST

"2019-03-08 EWS"
Disp "1900-2099"
Input "MONTH: ",M
Input "DAY: ",D
Input "YEAR: ",Y
Input "HOUR: ",H
If fPart(Y/4)=0 and Y≠1900
Then
1→L
Else
0→L
End

If M≥3
Then
int(30.6*M+1.6)+D-35+L→T
Else
int(30.6*M+368.8)+D-400→T
End

T+(Y-1900)*365+iPart((Y-1900)/4)+.5+H/4Z
Z/36525→Z
6°38'45.836"+2400.051262*Z+0°0'0.0929"*Z²→E
24*fPart(E/24)→E
Disp "GMST: ",E>DMS


Example:

Example 1: 

January 1, 1978, Midnight (Hour = 0):  6°41'9.836"

Example 2:

March 13, 2011, 7:00 PM (H = 19): 11°23'54.646"

Source:

Jones, Aubrey  Mathematical Astronomy With a Pocket Calculator  Halsted Press:  John Wiley & Sons, New York.  1978.  ISBN 0 470 26552 3

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.

Sunday, March 10, 2019

TI-84 Plus and HP 41C: Number of Days After January 1

TI-84 Plus and HP 41C:  Number of Days After January 1

Introduction

The program DATENO calculates the number of days from January 1.  The program prompts whether we are working in a leap year or not. 

With D = Day and M = Month, the days between January 1 and any other date within the calendar year is:

If M = 1 and M = 2 Then
DATE# = int(30.6 * M + 368.8) + D - 400

Otherwise,
DATE# = int(30.6 * M + 1.6) +D - 35  (non-leap year)
DATE# = int(30.6 * M + 1.6) + D - 34  (leap year)

TI-84 Plus Program: DATENO

"DAYS AFTER JANUARY 1"
"2019-03-07 EWS"
Input "MONTH: ",M
Input "DAY: ",D
Disp "0:NO, 1:YES"
Input "LEAP YEAR? ",L
If M≥3
Then
int(30.6*M+1.6)+D-35+L→T
Else
int(30.6*M+368.8)+D-400→T
End
Disp T

HP 41C/DM 41L Program:  DATENO

(^T:  beginning of an alpha string)

01 LBL^T DATENO
02 ^T MONTH
03 PROMPT
04 STO 01
05 ^T DAY?
06 PROMPT
07 STO 02
08 ^T LEAP? N=0,L=1
09 PROMPT
10 STO 03
11 RCL 01
12 3
13 X<=Y?
14 GTO 00
15 30.6
16 RCL 01
17 *
18 368.8
19 +
20 INT
21 RCL 02
22 +
23 400
24 -
25 GTO 01
26 LBL 00
27 RCL 01
28 30.6
29 *
30 1.6
31 +
32 INT
33 RCL 02
34 + 
35 35
36 - 
37 RCL 03
38 + 
39 LBL 01
40 STO 04
41 END

Examples

Days between January 1 and February 16  (M = 2, D = 16):  46

Days between January 1 and October 1 (M = 10, D = 1):
(Non-leap year):  273
(Leap year): 274

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.

Thursday, March 7, 2019

Google Celebrates Olga Ladyzhenskaya

Google Celebrates Olga Ladyzhenskaya 



Today, March 7, 2019, Google honored the Russian mathematician Olga Ladyzhenskaya.  Ladyzhenskaya was born on March 7, 1922 (passed away on January 12, 2004).  She is known for her work in partial differential equations, particularly providing a rigorous proof of the finite difference method for the Navier-Strokes equations. 

Happy Birthday Olga! And thank you for your contributions to mathematics and science.

Wikipedia articles:

Bio on Olga Ladyzhenskaya
https://en.wikipedia.org/wiki/Olga_Ladyzhenskaya

Navier-Strokes Equations
https://en.wikipedia.org/wiki/Navier%E2%80%93Stokes_equations

Finite Difference Method
https://en.wikipedia.org/wiki/Finite_difference_method

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.



Wednesday, March 6, 2019

HP 12C and HP 11C: Loan Amount Using the Annual Loan Constant

HP 12C and HP 11C:  Loan Amount Using the Annual Loan Constant

Introduction

The program calculates the theoretical loan amount using the following factors:

*  NOI:  Net Operating Income. The estimated net operating income the property is expected to earn annually.  An average is usually used.

*  DCR:  Debt Coverage Ratio.  The ratio of net operating income to annual debt service, describing a company's ability to pay its debts.  Generally, the larger the DCR, the better.  We really don't want DCR to be below 1.

*  Number of payments per year, number of years, and annual interest rate of the potential loan. 

The ALC, or the annual loan constant is calculated by:

*  Either divided the annual debt service by the loan amount (when the amount is known), or

*  Determining the periodic payment to amortize a $100 loan given number of payments and interest rate.

Set up:
Number of payments -> N
Interest Rate -> I%YR  (or periodic interest rate -> i)
-100 -> PV
0 -> FV
Solve for PMT

The ALC is expressed as a percentage. 

The theoretical loan amount is calculated by:

Loan = NOI / (DCR * ALC%)

HP 12C Program: Loan Amount Using the Annual Loan Constant

Instructions:
Store the following:
NOI in R1
DCR in R2
Number of payments per year in R3
Number of periods in [ n ]
Periodic Interest rate in [ i ]

Program:
Step;  Key;  Code
01;  1;  1
02;  0;  0
03;  0;  0
04;  CHS;  16
05;  PV;  13
06;  0;  0
07;  FV;  15
08;  PMT;  14
09;  RCL 3;  45, 3
10;  *;  20
11;  RCL 2; 45, 2
12;  x<>y;  34
13;  %;  25
14;  RCL 1; 45, 1
15;  x<>y;  34
16;  ÷;  10
17;  GTO 00;  43, 33, 00

(* HP 12C Platinum, step 17:  GTO  000; 43, 33, 000)

HP 11C Program:    Loan Amount Using the Annual Loan Constant

Instructions:
Store the following:
NOI in R1
DCR in R2
Number of payments per year in R3
Number of periods in R4
Periodic Interest rate in R5

Program:
Step; Key; Code
001;  LBL A; 42, 21, 11
002;  1;  1
003;  ENTER; 36
004;  ENTER; 36
005;  RCL 5;  45, 5
006; %;  43, 14
007;  +;  40
008;  RCL 4;  45, 4
009;  CHS;  16
010;  y^x; 14
011;  *;  30
012;  1;  1
013;  RCL 5; 45, 5
014;  %;  43, 14
015;  x<>y;  34
016;  R↓;  33
017;  ÷;  10
018;  1;  1
019;  0;  0
020;  0;  0
021;  x<>y; 34
022;  ÷;  10
023;  RCL 3; 45, 3
024;  *;  20
025;  RCL 2; 45, 2
026;  x<>y; 34
027;  %;  43, 14
028;  RCL 1; 45, 1
029;  x<>y;  34
030;  ÷; 10
031;  RTN; 43, 32

Examples

Example 1: 

NOI:  $58,000.00
DCR:  1.25
P/Y:  12
Number of Years: 30
Annual Interest Rate:  5%

Loan Amount:  $720,288.92

Example 2:

NOI:  $40,000.00
DCR:  1.35
P/Y:  12
Number of Years: 20
Annual Interest Rate:  6.8%

Loan Amount: $323,464.95

Source: 

Goldman, Mark H. and Stephen D. Messner "HP 12C Real Estate Applications Handbook"  Hewlett Packard Rev. B. March 1984

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.

HP Prime: Matrices Built from Shifted Elements

HP Prime:  Matrices Built from Shifted Elements

Introduction

The programs LSM (left-shift matrix) and RSM (right-shift matrx) create a n x n matrix based on the elements of a given list.  Each row has each of the elements rotated one element.

For LSM, each row has the elements shifted to the left one element.

For RSM, each row has the elements shifted to the right one element.

The illustration below shows how to programs work.



HP Prime Program: LSM

EXPORT LSM(L0)
BEGIN
// EWS 2019-03-02
// left shift matrix
LOCAL L1,N,M0,K;
N:=SIZE(L0);
L1:=L0;
FOR K FROM 1 TO N-1 DO
L1:=CONCAT(tail(L1),head(L1));
L0:=CONCAT(L0,L1);
END;
M0:=list2mat(L0,N);
RETURN M0;
END;

HP Prime Program:  RSM

EXPORT RSM(L0)
BEGIN
// EWS 2019-03-03
// right shift matrix
LOCAL L1,N,M0,K;
N:=SIZE(L0);
L1:=L0;
FOR K FROM 1 TO N-1 DO
L1:=REVERSE(CONCAT(
tail(REVERSE(L1)),
head(REVERSE(L1))
));
L0:=CONCAT(L0,L1);
END;
M0:=list2mat(L0,N);
RETURN M0;
END;

Note:  The program RSM creates a circulant matrix.

Example

list = {1, 7, 8, -2, 0}

LSM({1, 7, 8, -2, 0} returns:

[ [ 1, 7, 8, -2, 0 ]
  [ 7, 8, -2, 0, 1 ]
  [ 8, -2, 0, 1, 7 ]
  [ -2, 0, 1, 7, 8 ]
  [ 0, 1, 7, 8, -2 ] ]

RSM({1,7,8,-2,0}) returns:

[ [ 1, 7, 8, -2, 0 ]
  [ 0, 1, 7, 8, -2 ]
  [ -2, 0, 1, 7, 8 ]
  [ 8, -2, 0, 1, 7 ]
  [ 7, 8, -2, 0, 1 ] ]

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.

Thursday, February 28, 2019

HP 12C: ARM Term if Renewed

HP 12C:  ARM Term if Renewed

Introduction

Situation:  An ARM Mortgage has one rate adjustment.  The mortgage calls for the payment to remain the same for the entire mortgage, even after the rate adjustment.  How long will it take to pay off the mortgage?  Specifically, how long will it take after the rate is adjusted (ARM term)? 

Example 1:

Original term: 30 years ( n = 360 )
Interest rate: 6%  ( i = 6/12 )
The interest rate scheduled to increase 0.25% in 4 years.

HP 12C Procedure

Any loan amount will do for this problem.  We'll use $1 for the loan amount in this example since we're only concerned with the ARM term.

Keystrokes:

(FIX 4 is set)

1.  Find the payment of the original mortgage.

Clear Finance Registers:   [ f ] [ x<>y ] (CLEAR FIN)
1 [ PV ]
30 [ g ] (12x) [ n ]
6 [ g ] (12÷) [ i ]
[PMT]   (Result:  -0.0060)

2.  Determine the balance of the mortgage at the date when the mortgage is adjusted (4 years).

4 [ g ] (12x) [ n ]
[ FV ]  (Result:  -0.9461)

3.  Transfer the balance to the new mortgage amount and enter the adjusted mortgage rate.

[CHS] [ PV ]
0 [ FV ]
[RCL] [ i ] 0.25 [ENTER] 12 [ ÷ ] [ + ] [ i ]
[ n ] (Result:  333.0000)

If the payment is kept the same, it would take another 333 payments to pay off the mortgage.  The ARM Term is 333.

The total time it takes to pay the mortgage is:

Pre-Adjustment Term + ARM Term

In this case, 381 payments (48 + 333).

The program presented here will calculate the ARM term.  This makes the assumption that the mortgage is only adjusted one time during its entire life.  This is similar to looking up the financial table ARM Term If Renewed Table (refer to source).

HP 12C Program:  ARM Term if Renewed

Keys:

01  1      
02  PV
03  0
04  FV
05  PMT
06  RCL 1 
07  n
08  FV
09  CHS
10  PV
11  0
12  FV
13  RCL i
14  RCL 2
15  +
16  i 
17  n
18 GTO 00   (HP 12C Platinum: GTO 000)

Key Codes:

01  1
02  13
03  0
04  15
05  14
06  45, 1
07  11
08  15
09  16
10  13
11  0
12  15
13  45, 12
14  45, 2
15  40
16  12
17  11
18  43, 33, 00  (HP 12C Platinum:  43, 33, 000)

Instructions:

Store the original number of periods in [ n ]
Store the original periodic interest rate in [ i ]
Store the number of months before the rate adjusts in R1.
Store the periodic adjustment (±r%) in R2.
Press [ R/S ]

Example:

Original term: 35 years
Original rate: 4.5%
The rate is adjusts +0.3% in 5 years.

35 [ g ] [ n ] (12x)
4.5 [ g ] [ i ] (12÷)
5 [ENTER] 12 [ x ] [STO] 1
0.3 [ENTER] 12 [ ÷ ] [STO] 2
[ R/S ]

Result:  391

The ARM term is 391 months.

Source:

Lincoln Title Company "Financial Conventional and ARM Payment Tables" Publication No. 493. Special Edition.  Financial Publishing Company: Boston, MA. May 1985 ISBN 0-87600-493-1

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.

Tuesday, February 26, 2019

HP Prime and HP 42S: Mathematical Pixel Art

HP Prime and HP 42S: Mathematical Pixel Art

HP Prime 

Blue Diamond
Lake

Prime Pixel - Tree Trunk
Yin Yang

HP 42S/DM 42/Free42

Printouts

Screenshots from Free42:

Cat Pixel

Dog Pixel

Pisces Pixel

Question Block Pixel

The code for these files are here:  https://drive.google.com/file/d/14IyWsNZWY0ptxen-lLIFvOvzRHjhJuyA/view?usp=sharing

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.


Saturday, February 23, 2019

HP Prime: Determining the Date For a Phase of Earth's Moon

HP Prime:  Determining the Date For a Phase of Earth's Moon

Introduction

The program MOONDATE determines when a desired phase of Earth's moon given month and year.  The four phases of the moon available are:

New Moon  (0.00)
1st Quarter (0.25)
Full Moon (0.50)
3rd Quarter (0.75)

The following equations are used:

Let  y = year, m = month, t = type (see the above)

y' = y + (m -1)/12
k = integer( (y - 2000) * 12.3685) + t/4
t = k/1236.85

J = 2451550.09765 + 29.530588853 * k + (1.337 * 10^-4) * t^2 - (1.5 * 10^-7) *t^3 + (7.3 * 10^-10) * t^4

J is the Julian Date and will need to be converted to the Gregorian Date.  With the DATE+ function, the HP Prime makes this easy.  Look to Dieter's post on this thread for details, link:  http://www.hpmuseum.org/forum/thread-12184.html?highlight=julian+date

Caution:  This program is designed to work with all dates after January 1, 2000.  If you choose any dates before, you may have to adjust the month

HP Prime Program MOONDATE

EXPORT MOONDATE()
BEGIN
// EWS 2019-02-19
LOCAL P,Y,K,M,T,l,c,s;
LOCAL J,D,N,R;
l:={"New","First Qtr","Full",
"Third Qtr"};
INPUT(
{Y,
{M,{1,2,3,4,5,6,7,8,9,10,11,12}}
,{c,l}},
"Moon Phase Date",
{"Year: ","Month:","Stage:"});
s:=(c-1)/4;
N:=M;

REPEAT 
R:=Y+(N-1)/12;
K:=IP((R-2000)*12.3685)+s;
T:=K/1236.85;
J:=2451550.09765+29.530588853*K
+1.337ᴇ−4*T^2-1.5ᴇ−7*T^3
+7.3ᴇ−10*T^4;
J:=IP(J)-2451545;
D:=DATEADD(2000.0101,J);
N:=N+1;
UNTIL D≥(Y+M/100);

RETURN D;
END;

Note:  You can use an alternate of 1/1/2000 (date code 2000.0101) with corresponding Julian Date 2451545.

Example:

January 2019:
New:  2019.0105 (1/5/2019)
1st Qtr: 2019.0113 (1/13/2019)
Full: 2019.0120 (1/20/2019)
3rd Qtr: 2019.0127 (1/27/2019)

Source:
Meeus, Jean.  "Astronomical Algorithms"  Willmann-Bell, Inc.:  Richmond, VA  1991  ISBN 0-943396-35-2

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.


Sunday, February 17, 2019

HP 42S/DM 42/Free42: Function Table


HP 42S/DM 42/Free42: Function Table

Introduction

The program FTAB uses the function defined in FX, with variable “X” to generate a 2 column matrix of f(X). The matrix is stored in variable MATS. The program ends with MATS in edit mode, so you see all the points generated. Use the soft key [ → ] to view the entries.

Setting up FX

To set up the function FX, the program needs to be in the following format:

00 {nnn-Byte Prgm}
01 LBL “FX”
02 MVAR “X”
03 f(X) starts here, use RCL “X” for X
…
nn-1 RTN
nn END

HP 42S Program FTAB
HP 42S, DM 42, Free42

00 { 99-Byte Prgm }
01▸LBL "FTAB"
02 "X Start:"
03 PROMPT
04 STO 01
05 "X Step:"
06 PROMPT
07 STO 02
08 "# Steps:"
09 PROMPT
10 STO 03
11 1
12 -
13 1ᴇ3
14 ÷
15 STO 04
16 RCL 03
17 2
18 DIM "MATF"
19 INDEX "MATF"
20▸LBL 00
21 RCL 01
22 RCL 04
23 IP
24 RCL× 02
25 +
26 STO "X"
27 STOEL
28 J+
29 XEQ "FX"
30 STOEL
31 J-
32 I+
33 ISG 04
34 GTO 00
35 EDITN "MATF"
36 .END.

Example

f(x) = x^2 * e^x

FX:
00 { 18-Byte Prgm }
01▸LBL "FX"
02 MVAR "X"
03 RCL "X"
04 ENTER
05 X↑2
06 X<>Y
07 E↑X
08 ×
09 RTN
10 .END.


Input:
X Start: 0
X Step: 0.1
# Steps: 10

Result Matrix MATS:

MATF= [ 10x2 Matrix ]
1:1= 0.0000
1:2= 0.0000
2:1= 0.1000
2:2= 0.0111
3:1= 0.2000
3:2= 0.0489
4:1= 0.3000
4:2= 0.1215
5:1= 0.4000
5:2= 0.2387
6:1= 0.5000
6:2= 0.4122
7:1= 0.6000
7:2= 0.6560
8:1= 0.7000
8:2= 0.9867
9:1= 0.8000
9:2= 1.4243
10:1= 0.9000
10:2= 1.9923

Matrix (row:column)

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.

HP Prime and TI-86: Minimum Vertical Curve Length


HP Prime and TI-86: Minimum Vertical Curve Length

Introduction

The program MVCL calculates the minimum vertical curve length for sight distances for crest curves (curve that rises then falls) and sag curves (curves that falls than rises). The equations used were determined by the AASHTO (American Association of Highway and Transportation Officials of Washington, D.C.).

HP Prime Program MVCL

EXPORT MVCL()
BEGIN
// Minimum stop speed
LOCAL g1,g2,a,c,l,s,g;

MSGBOX("Break = 2.5 s,
 Decel = 11.2 ft/s^2");

LOCAL l1:={15,20,25,30,35,40,45,
50,55,60,65,70,75,80};

LOCAL l2:={80,115,155,200,250,
305,360,425,495,570,645,730,
820,910};

INPUT({g1,g2,{c,l1}},"MVCL",
{"Grade1%:","Grade2%:",
"Speed:"});

s:=l2(c);
a:=ABS(g1-g2);

l:=2*s-2158/a;
IF s < l
l:=a*s^2/2158;
END;

g:=2*s-(400+3.5*s)/a;
IF s < g
g:=(a*s^2)/(400+3.5*s);
END;

PRINT();
PRINT("Stop speed (ft)");
PRINT("Crest curve: "+l);
PRINT("Sag curve: "+g);


END;

TI-86 Program MVCL
(744 bytes)

Input “GRADE %1:”, G1
Input “GRADE %2:”, G2
abs(G2-G1) → A
Disp “Break time = 2.5s”, “Decl. = 11.2 ft/s²”,
“Car Speed?”,”(mph)”

Menu(1,”15”,A,2,”20”,B,
3,”25”,C,4,”30”,D,
5,”35”,E,6,”40”,F,
7,”45”,G,8,”50”,H,
9,”55”,I,10,”60”,J,
11,”65”,K,12,”70”,L,
13,”75”,M,14,”80”,N)

Lbl A : 80 → S : Goto Z
Lbl B : 115 → S : Goto Z
Lbl C : 155 → S : Goto Z
Lbl D : 200 → S : Goto Z
Lbl E : 250 → S : Goto Z
Lbl F : 305 → S : Goto Z
Lbl G : 360 → S : Goto Z
Lbl H : 425 → S : Goto Z
Lbl I : 495 → S : Goto Z
Lbl J : 570 → S : Goto Z
Lbl K : 645 → S : Goto Z
Lbl L : 730 → S : Goto Z
Lbl M : 820 → S : Goto Z
Lbl N : 910 → S : Goto Z

Lbl Z
Disp “Stop speed (ft)”, “crest curve:”
2 * S – 2158 / A → L
If S > L
Then
Disp L
Else
A * S² / 2158 → L
Disp L
End
Disp “sag curve:”
2 * S – (400 + 3.5 * S) / A → G
If S > G
Then
Disp G
Else
(A * S²) / (400 + 3.5 * S) → G
Disp G
End

Examples:

Example 1:
Grade 1: -1.75%
Grade 2: 2.25%
Design Speed: 40 mph

Result:
Minimum Vertical Curve Length
Crest Curve: 70.5 ft
Sag Curve: 243.125 ft

Example 2:
Grade 1: -1%
Grade 2: 1.7%
Design Speed: 50 mph

Result:
Minimum Vertical Curve Length
Crest Curve: 50.740740741 ft
Sag Curve: 150.925925926 ft

Source:

Michael R. Lindberg, PE “Civil Engineering Reference Manual for the PE Exam” 11th Ed. Professional Publications, Inc: Belmont, CA. 2008. ISBN 13-978-1-59126-192-2

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-50F/Radio Shack EC-4024 Program Collection: October 2026

Casio fx-50F/Radio Shack EC-4024 Program Collection: October 2026 Notes: * The fx-50F/EC-4024 has a 29 step program space betwe...