Showing posts with label trapezoid. Show all posts
Showing posts with label trapezoid. Show all posts

Monday, August 13, 2018

HP 35S: Trapezoid Analysis (Daniel Pedro Levia)


HP 35S: Trapezoid Analysis (Daniel Pedro Levia)

Have some time to squeeze in a post.  Much thanks to Daniel Pedro Levia.

Introduction

Given the trapezoid below:






The following are calculated:

Midsegment length:  (A + B)/2

Height: √( (-A+B+C+D)(A-B+C+D)(A-B+C-D)(A-B-C+D) )/(2 * abs(B-A))

Area:  M * H

You can see the HP Prime and Casio fx-CG50 programs here:  https://edspi31415.blogspot.com/2017/06/


HP 35S Program: Trapezoid – Pedro Daniel Leiva

Here is the program for the HP 35S, written by Pedro Daniel Levia.   The program is listed with permission of the author.

Variables Used:

R_A = length of side A
R_B = length of side B
R_C = length of side C
R_D = length of side D
R_H = height
R_M = mid-length
R_K = area
R_P = perimeter

Program:

T001 LBL T
T002 STO D
T003 R ↓
T004 STO C
T005 R ↓
T006 STO B
T007 R ↓
T008 STO A
T009 SQRT((-A+B+C+D)*(A-B+C+D)*(A-B+C-D)*(A-B-C+D))/(2*ABS(B-A)) // EQN
T010 STO H
T011 (A+B)/2  // EQN
T012 STO M
T013 STOP   // R/S
T014 RCL M
T015 RCL H
T016 ×
T017 STO K
T018 A+B+C+D  // EQN
T019 STO P
T020 RTN

20 steps

Instructions:  Enter the length of all four sides then run the program.

A [ENTER] B [ENTER] C [ENTER] D [XEQ] T [ENTER]

The height and midlength are shown first (Y and X stack, respectively).  Press [R/S] to get the area and perimeter.

Example:

A = 400
B = 350
C = 125
D = 106

Results:

Height:  104.3032
Midlength: 375.0000
Area:  39113.7186
Perimeter:  981.0000

  
Eddie


 All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Thursday, July 12, 2018

Fun with the Radio Shack EC-4026



Fun with the Radio Shack EC-4026 

(Equivalent of the Casio fx-4500P)

Programming Notes

 


The syntax for prompting for variables and displaying results are slightly different from the usual Casio programming language (as I mentioned, the EC-4026 is a clone of the fx-4500P).  Check out the unusual If-Then-Else-End structure as well. 

Prompting Syntax:
{var} : var “prompt string”

Example:
 {X}: X”ENTER X”

Display Syntax:
Calculation
“Display string” ◢  (solid right triangle, [2ndF] [↑])

Example: 
X
“F(X)=” ◢

The If-Then-Else-End Structure:
If condition ⇒ do if the condition is true ⇏do if condition is false ◺  (clear right triangle, [2ndF] [√])

Note:  I symbolize the [x^y] by ^.

Finding the Monthly Payment of a Mortgage with Total Interest Paid and Total Cash Outflow

Program MORTGAGE:

L1  Fix 2
L2 {A}: A”LOAN AMOUNT”
L3 {Y}: Y”YEARS”
L4 {I}: I”RATE”
L5 I = I/1200
L6 N = Y*12
L7 P = A*(I(1+I)^N)/((1+I)^N-1)
L8 “MONTHLY PMT” ◢
L9 N*P
L10 “OUTFLOW” ◢
L11 N*P-A
L12 “TOTAL INTEREST” ◢
L13 Norm

Example:

A:  Loan is $250,000.00
Y:  30 years
I: Interest rate of 4%

Results:

P:  Payment:  $1,193.59
Outflow:  $429,673.77
Total Interest:  $179,673.77

Midlength, Height, and Area of a Trapezoid



Program TRAPEZIOD:

L1 {A}
L2 {B}
L3 {C}
L4 {D}
L5 H = √((-A+B+C+D)*(A-B+C+D)*(A-B+C-D)*(A-B-C+D))/(2*Abs(B-A))
L6 M = (A+B)/2
L7 K = M*H
L8 M
L9 “MIDLENGTH” ◢
L10 H
L11 “HEIGHT” ◢
L12 K
L13 “AREA” ◢


Quadratic Equation A*x^2 + B*x + C = 0

Program QUAD:

L1 {A}: A”A”
L2 {B}: B”B”
L3 {C}: C”C”
L4 D = B^2-4*A*C
L5 D<0 ⇒ Goto 1 ◺
L6 X = (-B + √D)/(2A) ◢
L7 Y = (-B - √D)/(2A) ◢
L8 Goto 0
L9 Lbl 1
L10 X = -B/(2A)
L11 “REAL” ◢
L12 Y = √(Abs D)/(2A)
L13 “IMAG” ◢
L14 Lbl 0
L15 “DONE” ◢

Example:

3x^2 + 6x – 1 = 0; A = 3, B = 6, C = -1
Result:  0.154700538, -2.154700538

3x^2 + 6x + 10 = 0; A = 3, B = 6, C = 10
Result:  REAL: -1, IMAG: 1.527525232.  -1 ± 1.527525232i

Minimum Loss Matching



Variables:

Input: Y = Z0, Z = Z1

Output:

R = R1
S = R2
L = Loss Marching

Program MINLOSS:

L1 1:  “Z1<Z0” ◢
L2 {Y}: Y”Z0”
L3 {Z}: Z”Z1”
L4 L = √(1 – Z/Y)
L5 R = Y*L: “R1”◢
L6 S = Z/L: “R2” ◢
L7 L = 20 log (√(Y/Z) + √(Y/Z – 1)): “LOSS” ◢

Example:

Input:


Y: Z0: 15
Z: Z1: 10

Output:

R1: 8.66025 Ω
R2:  17.32051 Ω
Loss:  5.71948

Add Two Polar Numbers

Polar and Rectangular conversions

Variable
Rectangular Results
Polar Results
V
x
r
W
y
θ

Program ADDPOLAR:

L1 {R}: R”R1”
L2 {S}: S”ANG1”
L3 Rec(R,S)
L4 R = V: S = W
L5 {V}: V”R2”
L6 {W}: W”ANG2”
L7 Rec(V,W)
L8 R = R+V: S = S+W
L9 Pol(R,S)
L10 V: “R SUM”◢
L11 W: “ANG SUM”◢

Example:

4 ∠ 20° + 3 ∠ 11 ° (In Degrees Mode)

Result (rounded to 4 digits): 6.9789 ∠ 16.1442°

How to Handle a Tax Bracket (Simple Sample)

Take a sample (and simplified) tax bracket, where income is X:

0 < X ≤ 200:  tax rate is 10% of X
200 < X ≤ 600:  tax rate is 13% of X
600 < X: tax rate is 16% of X

Program:

L1 {X}: X”X”
L2 X > 600 ⇒ P = 16: Goto 1 ◺
L3 X > 200 ⇒ P = 13: Goto 1 ◺
L4 P = 10
L5 Lbl
L6 X * P/100


Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Sunday, July 2, 2017

Fun with the Casio fx-3650p

Links to previous fx-3650p programs:

5/11/2014:


Contents:
1. Circular Sectors
2. Stopping Sight Distance
3. Resistors in Parallel
4. Net Present Value
5. Rod Pendulum
6. Vectors: Dot and Cross Products


10/27/2015:


Contents for this blog:
1.  Combination with Replacement
2.  Great Circle (Distance in km) 
3.  Orbital Speed and Period 
4.  Eccentricity and Area of an Ellipse
5.  Super Factorial
6.  Escape Velocity 
7.  Finance: Payment of a Monthly Mortgage
8.  Wind Chill Factor
9.  Speed of Sound in Dry Air 

-------

Contents for this blog entry (7/2/2017)

1.  Modulus Function
2.  Normal CDF
3.  Sum:  Σ (AX + B)^C,  from X = 0 to X = Y
4.  Sun Altitude and Azimuth Based on the Vernal Equinox
5.  Trapezoid: Midsegment, Height, and Area
6.  Solar Irradiance
7.  General a list of X Random Integers from 0 to Y

Modulus Function

Calculates A mod B for A > 0 and B > 0.   Since the fx-3650p has no integer or fraction part functions, a loop of repeated subtractions are needed.

Program (25 steps):
? → A : ? → B : Lbl 1 : A – B → A : A ≥ B ⇒ Goto 1 : A

Examples:
Input:  A = 77, B = 9.  Result: 5
Input:  A = 92.38, B = 2.38.  Result:  1.94 

Normal Distribution CDF

This calculates the area of a normal distribution curve between points A and B, given that mean = 0 and deviation = 1.  Radians mode is set.  The result is stored in C.

Program (34 steps):
? → A : ? → B : Rad : ∫ ( e (-X² ÷ 2 ), A, B → C : C ÷ √ (2 π → C

Note e is the exponential function (e^x).

Examples:
Input:  A = 0, B = 2.  Result:  0.47725066
Input:  A = -1, B = 1.  Result:  0.682709924


Sum:  Σ (AX + B)^C,  from X = 0 to X = Y

Program (51 steps):
? → A : ? → B : ? → C : ? → Y : 0 → X : 0 → M : Lbl 1 : (AX + B)^C M+ : 1 + X → X : Y ≥ X ⇒ Goto 1: M

Examples:
Input:  A = 2. B = 6, C = 2, Y = 4.  Result:  540
Input:  A = -3, B = 1, C = 3, Y =6.  Result:  -9632

Sun Altitude and Azimuth Based on the Vernal Equinox


Input:
Y =  days after the vernal equinox, usually March 21
A = latitude on Earth (north-south, -90° to 90°)
X = the time before solar noon, local time

For example, for 10 AM (10:00), enter 2.  For 3 PM (15:00), enter -3.  Hence:  12 – time.

Output:
D = approximate declination of the sun (-23.45° to 23.45°)
B = sun’s altitude
C = sun’s azimuth (from ground wise north)

Program (69 steps):
? → Y : ? → A : ? → X : Deg : 23.45 sin(.9856Y → D ◢  sin¯¹ (cos A cos D cos (15X) + sin A sin D → B ◢ cos¯¹ ( ( sin B sin A – sin D) ÷ (cos A cos B → C

Examples:

Input:  Y = 90 days, A = 25°, X = -3  (3 PM)
Results: 
D = 23.44400127° = 23°26’38.4”
B = 48.81756385° = 48°49’3.23”
C = 99.85903298° = 99°51’32.52”

Input:  Y = 68 days, A = 46°, X = 4 (8 AM)
Results:
D = 21.58916369° = 21°35’20.99”
B = 35.989914° = 35°59’23.69”
C = 84.40834691° = 84°24’30.05”

Source: Sun Altitude, Azimuth, Solar Pond Absorption, HP 67/97 Energy Conservation December 1978, Author: HP

Trapezoid: Midsegment, Height, and Area


Input:
A = length of top side
B = length of bottom side
C = length of left side
D = length of right side

Output:
X = Midsegment length
Y = Height
M = Area

Program (92 steps):
? → A : ? → B : ? → C : ? → D : .5(A + B → X ◢ (-A + B + C + D)(A – B + C + D)(A – B + C – D)(A – B- C- + D) → Y : √Y ÷ ( 2 √( (B – A)² ) → Y ◢ (A + B)Y ÷ 2 → M

Example:
Input:  A = 18, B = 16, C = 12, D = 11
Results:  X = 17, Y = 9.921567417, M = 168.6666461

Source:  “Trapezoid”  Wikipedia.  Edited July 7, 2014.  Retrieved July 8, 2014

Solar Irradiance



The program calculates:



1. The solar angle of incidence given the angular elevation and azimuth (from south going “counterclockwise”:  east-north-west) of both the sun and panel.
2. The irradiance given by the solar panel. 


Input:
X = elevation of the sun
A = azimuth of the sun
Y = elevation of the solar panel
Z = azimuth of the solar panel
M = the sun’s power or irradiance.  Often this is treated as a constant, which is approximately 1367 W/m^2 for extraterrestrial solar power, or approximately 1000 W/m^2 when we are dealing with the Earth’s surface (taking scattering of light into account)

Output:
C = incidence angle
D = solar irradiance

Program (46 steps):
? → X : ? → A : ? → Y : ? → B : ? → M : Deg : cos¯¹ ( cos Y sin X + sin Y cos X cos (A – B → C ◢ M cos Y → D

Example:
Input:

Sun:
X = 55°24’21”
A = 175°15’44”

Panel:
Y = 40°
B = 90°

Sun’s Irradiance:
M = 1000 W/m

Results:
C = 48.6431686°
D = 766.0444431 W/m

Sources (you might have to copy and past these links)  

Baldocchi, Dennis “Lecture 7, Solar Radiation, Part 3, Earth-Sun Geometry”  Biometeorogy, ESPM 129  University of California, Berkeley.


Retrieved February 17, 2015. 

Mortimer, David  “Lambert’s Cosine Law”  30 January 2014.  The Solar Bucket.


Retrieved March 18, 2015

University of Oregon Solar Radiation Monitoring Laboratory  “Solar Radiation Basics”  University of Oregon.  http://solardat.uoregon.edu/SolarRadiationBasics.html   Retrieved February 10, 2015

General a list of X Random Integers from 0 to Y

This program generates a list of random integers (X) from 0 to upper limit Y.  This program uses the Fix 0 mode and makes use of the Rnd (round the number in the display) command.  Note the integers as they appear.  The program finishes by setting the calculator back in Norm 1 mode.

Program (33 steps):
? → Y : ? → X : 1 → M : Fix 0 : Lbl 1 : Ran# Y : Rnd ◢ 1 M+ : X ≥ M ⇒ Goto 1 : Norm 1

Example:
Generate 5 random integers from 0 to 10.  (Y = 10, X  = 5)
Result:  6, 7, 6, 6, 10 (your results will vary)

Comments

As with the other fx-3650p I and others have posted, they can easily be adapted to the fx-50fH, fx-5800p, fx-6300g, fx-CG50, and (almost) any other Casio programming calculator. 

Recently I learned that Casio updated the fx-3650P and the fx-50F(H) with the fx-3650P II and fx-50F(H) II respectively.  The only difference I was able to spot is that the fx-3650P II now has 390 programming steps instead of 360. http://www.casio-intl.com/asia/en/calc/school/programmable/

And yes, I still wish Casio sold these models in stores in the United States.  Currently, for us U.S. residents, they can only be purchased online. 

Now if Casio made a solar version of the fx-6300g, with more memory.

Eddie


This blog is property of Edward Shore, 2017.

Friday, June 23, 2017

HP Prime and Casio fx-CG50: Trapezoid Midsegment, Height, Area

HP Prime and Casio fx-CG50:  Trapezoid Midsegment, Height, Area



The program TRAPEZ calculates the following:

Midsegment length:  M = (A + B)/2

Height:  H = √( (-A+B+C+D)(A-B+C+D)(A-B+C-D)(A-B-C+D) )/(2 * abs(B-A))

Area:  K = M * H

HP Prime Program TRAPEZ

EXPORT TRAPEZ()
BEGIN
// trapezoid
// 2017-06-23 EWS

INPUT({A,B,C,D},
"Trapezoid",
{"a: ","b: ","c: ","d: "},
{"Top","Bottom","Left","Right"});

M:=(A+B)/2;
I:=(−A+B+C+D)*(A-B+C+D)*(A-B+C-D)*
(A-B-C+D);
IF I≤0 THEN
PRINT();
PRINT("Invalid Trapezoid");
ELSE
H:=√(I)/(2*ABS(B-A));
K:=H*M;
PRINT();
PRINT("Midlength = "+M);
PRINT("Height = "+H);
PRINT("Area = "+K);
END;

END;

Casio fx-CG50 Program TRAPEZ

"TOP"?->A
"BOTTOM"?->B
"LEFT"?->C
"BOTTOM"?->D
(A+B)/2->M
((-)A+B+C+D)(A-B+C+D)(A-B+C-D)(A-B-C+D)->I
If I<=0
Then
"INVALID TRAPEZIOD"DispsElse
√I/(2Abs (B-A))->H
M*H->K
ClrText
Locate 1,1,"MIDLENGTH="
Locate 1,2,M
Locate 1,3,"HEIGHT="
Locate 1,4,H
Locate 1,5,"AREA="
Locate 1,6,K
IfEnd

Example

A = 13, B = 23, C = 6, D = 7
Results:
Midlength, M = 18
Height, H = 4.139493194
Area, A = 74.3848775

Source:
“Trapezoid”  Wikipedia.  Edited July 7, 2014.  Retrieved July 8, 2014

Eddie


This blog is property of Edward Shore, 2017.

HP 15C: The I Squared Rule and HHC 2026

HP 15C: The I Squared Rule and HHC 2026 HHC 2026 Videos Before we start, the videos for HHC 2026 are up! Please take a look, ev...