Showing posts with label Atwood machine. Show all posts
Showing posts with label Atwood machine. Show all posts

Sunday, September 29, 2019

fx-260 Solar Algorithms Part II

fx-260 Solar Algorithms Part II

Decimal to Binary Conversions

This is probably best demonstrated by example. 

Algorithm:

To the decimal integer D to binary integer B:

1.  Determine the number of digits (zeroes or ones) that the binary integer is going to have.  Also, we'll store D in memory.

n = int(log D/log 2)

Each digit will represent the powers 2^(n) to 2^0.

Keystrokes: D [SHIFT] (Min) [ log ] [ ÷ ] 2 [ log ] [ = ]  // ignore the decimal part

2.  Starting with n and going to 0, calculate 2^n.  Compare 2^n to the number in memory. 

If 2^n ≤ Memory, then write a 1.  Subtract 2^n from memory:  2^n [ +/- ] [M+].  Decrease n by 1 and continue.

If 2^n > Memory, then write a 0.  Decrease n by 1 and continue.

Each digit will be written to the right of the preceding digit.

Example:  Convert 462 to binary.

Determine n:
462 [SHIFT] (Min) [ log ] [ ÷ ] 2 [ log ] [ = ]
Result:  8.851749041

Start with n = 8.  462 is stored in Memory.

In M:  462  (n = 8)
2 [ x^y ] 8 [ = ] 256,  256 ≤ 462,  [+/-] [ M+ ]   // first digit is 1
Binary:   1________

In M:  206 (n = 7)
2 [ x^y ] 7 [ = ] 128,  128 ≤ 206,  [+/-] [ M+ ]  // next digit is 1
Binary:   11_______

In M:  78 (n = 6)
2 [ x^y ] 6 [ = ] 64,  64 ≤ 78,  [+/-] [ M+ ]  // next digit is 1
Binary:   111______

In M:  14  (n = 5)
2 [ x^y ] 5 [ = ] 32,  32 > 14  // next digit is 0
Binary:   1110_____

In M:  14  (n = 4)
2 [ x^y ] 4 [ = ] 16,  16 > 14  // next digit is 0
Binary:   11100____

In M:  14  (n = 3)
2 [ x^y ] 3 [ = ] 8,  8 ≤ 14,  [+/-] [ M+ ]  // next digit is 1
Binary:   1110001___

In M:  6  (n = 2)
2 [ x^y ] 2 [ = ] 4,  4 ≤ 6,  [+/-] [ M+ ]  // next digit is 1
Binary:   11100011__

In M:  2  (n = 1)
2 [ x^y ] 1 [ = ] 2,  2 ≤ 2,  [+/-] [ M+ ]  // next digit is 1
Binary:   111000111_

In M:  2  (n = 0)
2 [ x^y ] 01 [ = ] 1,  1 > 0  // last digit is 0
Binary:   1110001110

Result:  462_10 = 1110001110_2

Combinations that Allow for Repeated Picks

Sometimes when we are choosing r objects out of a group of n objects, repeated picks are allowed.  That is, any object that is picked is put back in the pool and has a chance to be picked again.  The formula to calculate such calculations is:

nHr = (n + r - 1)! / (r! * (n - 1)!)

We can state nHr in terms of nCr (number of combinations where no repeats are allowed).

aCb = a! / (b! * (a - b)!)
Let a = n + r - 1 and b = n - 1.
Then a - b = n + r - 1 - (r - 1) = r

Then:
nHr = (n + r -1)C(n - 1)

Algorithm:
[ ( ] n [ + ] r [ - ] 1 [ ) ] [SHIFT] (nCr) [ ( ] n [ - ] 1 [ ) ] [ = ]

Example:
Find the number of combinations of picking 10 objects out of the pool of 38, where repeats are allowed.

n = 38, r = 10

[ ( ] 38 [ + ] 10 [ - ] 1 [ ) ] [SHIFT] (nCr) [ ( ] 38 [ - ] 1 [ ) ] [ = ]

Result: 5,178,066,751

Harmonic Mean of Numbers

The harmonic mean of a set of n numbers is calculated by:
HM = n / Σ(1 / x_i)

We can use the Statistics mode to calculate the harmonic mean.

Algorithm:
[ON]  // clear everything and reset calculator to COMP mode
[MODE] 0  // Mode 0 is SD mode (single data, standard deviation)
x_i [SHIFT] (1/x) [M+](DATA)
....
[SHIFT] (n) [ × ] [SHIFT] (Σx) [ = ]

Example:
Data:  3.8, 4.6, 5.9, 7.1, 7.6, 9.0  (n = 6)

[ON]
[MODE] 0 
3.8 [SHIFT] (1/x) [M+](DATA)
4.6 [SHIFT] (1/x) [M+](DATA)
5.9 [SHIFT] (1/x) [M+](DATA)
7.1 [SHIFT] (1/x) [M+](DATA)
7.6 [SHIFT] (1/x) [M+](DATA)
9.0 [SHIFT] (1/x) [M+](DATA)
[SHIFT] (n) [ × ] [SHIFT] (Σx) [ = ]

Result:  6.20145512

Atwood Machine

Given the masses of two weights (in kg) on an Atwood Machine, the following system describes the relationship between the masses, tension, and acceleration of the system:

T + M1 * a = M1 * g
T - M2 * a = M2 * g

where:
T = tension of the system (N)
a = acceleration, positive means the pulley rotates counter-clockwise; negative means the pulley rotates clockwise (m/s^2)
g = Earth's gravity constant, 9.80665 m/s^2

Assumptions:
1.  The mass of both the pulley and the string are negligent
2.  Mass 1 is on the left side of the pulley while Mass 2 is on the right. 

Solving for T and a give:
a = (M1 - M2) * g / (M1 + M2)
T = M1 * (g - a) = M2 (g + a)

Algorithm:
[ ( ] M1 [ - ] M2 [ ) ] [ × ] 9.80665 [ ÷ ] [ ( ] M1 [ + ] M2 [ ) ] [ = ]   
// acceleration is displayed

[ +/- ] [ + ] 9.80665 [ = ] [ × ] M1 [ = ]
// tension is displayed

Example:
M1 = 18 kg, M2 = 12 kg

[ ( ] 18 [ - ] 12 [ ) ] [ × ] 9.80665 [ ÷ ] [ ( ] 18 [ + ] 12 [ ) ] [ = ]   
Acceleration: 1.96133 m/s^2  (pulley is rotating counter-clockwise)

[ +/- ] [ + ] 9.80665 [ = ] [ × ] 18 [ = ]
Tension:  141.21576 N


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, May 29, 2018

Fun With the Casio fx-3650P: Program Collection 5/29/2018


Fun With the Casio fx-3650P


Previous Entries

5/11/2014:


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:


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 

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


Contents for this Blog Entry:

1. kth Derivative of f(x) = y^n
2. Sight Reduction Table
3. Distance Off at Second Bearing by Two Bearings and Run
4. Hydraulic Cylinder:  Force and Flow
5. Mass Held by Two Strings
6. Atwood Machine: Tension and Acceleration

kth Derivative of f(x) = x^n

This program calculates the kth derivative of x^n. Using the variables of the Casio fx-3650p, this program calculates:

‘d^A/dx^A X^B.  A is an integer, where B and X are real numbers.

Program (47 steps):
? → A : ? → B : → X : 1 → C : Lbl 1 : CB → C : B – 1 → B : A – 1 → A : A ≠ 0 Goto 1 : CX ^ B

Input order:  A = order, B = power, X = x

Examples:
A = 3, B = 2.5, X = 3.  Result:  1.08253175473
A = 4, B = 6, X = 1.  Result:  360

Sight Reduction Table

The program calculates altitude and azimuth of a given celestial body.

Inputs:
A: Local Hour Angle (LHA)
B: The observer’s latitude on Earth, north is positive, south is negative (L)
D: Declination of the celestial’s body, north is positive, south is negative (δ)

The latitude is often entered in degrees/minutes/seconds format. 
Do this using the [ ° ‘ “ ] key.   The calculator is set in Degrees program.

Formulas:

Altitude: 
H = asin (sin δ sin L + cos δ cos L cos LHA)

Zenith:
Z = acos ((sin δ – sin L sin H) ÷ (cos H cos L))
If sin LHA < 0 then Z = 360° - Z


Output variables:

C = altitude
X = zenith


Program (67 steps):
Deg : ? → A : ? → B : ? → D : sin^-1 ( sin D sin B + cos D cos B cos A ) → C cos^-1 ( ( sin D – sin B sin C ) ÷ ( cos C cos B ) ) → X: sin A > 0 360 – X → X : X

Source:  “NAV 1-19A Sight Reduction Table”    HP 65 Navigation Pac.  Hewlett Packard, 1974.

Distance Off at Second Bearing by Two Bearings and Run

This program calculates the distance off between to bearings. 

Input variables:

A:  first bearing
B:  second bearing
C:  run (typically in miles, distance will be in the same length unit)

Distance formula:

D = C * sin A° / sin |A° - B°|

Since the Casio fx-3650P does not have an absolute value function, the workaround    (x^2) is used instead. 

Program (31 steps):
Deg : ? → A : ? → B : ? → C : C sin A ÷ sin ( √ (A – B) ^ 2 ) → D

Example:
A = 15°, B = 8 °, C = 1.5 miles

Result:  3.185613024 miles
(updated 7/1/2018; the result is now correct)

Source:  Henry H. Shufeldt and Kenneth E. Newcomer.  The Calculator Afloat: A Mariner’s Guide to the Electronic Calculator Naval Institute Press:  Annapolis, MD.  1980

Hydraulic Cylinders: Force and Flow

The program calculates the force and flow.

Input variables:

D:  large radius
C:  small radius, radius of the cut
X:  pressure
Y:  speed of the cylinder

Formulas:

Area: A = π (D^2 – C^2) / 4
Force: F = pressure * area = X * A
Flow:  q = velocity * area = Y * A

Program (36 steps):
? → D : ? → C : π ( D^2 – C^2 ) ÷ 4 → A : ? → X : AX ? → Y : AY

Example:

Input:
D = 8 in, C = 4 in  (8 in cylinder with a 4 in cutout), X = 68 psi, Y = 3.6 in/sec

Results:
Force:  2563.539605 lb,  Flow:  3.6 in^3/sec

Mass Held by Two Strings



The program calculates the tension of the two strings shown in the diagram above.  The tension of both strings are found by solving the following system of two equations:

cos A° * X – sin B° Y = 0
sin A° * X – cos B° * Y = M * g

Where g is Earth’s gravitation constant, or g = 9.80665 m/s^2 ≈ 32.174 ft/s^2

SI units are used in this program.

Program (45 steps):
Deg : ? → A : ? → B : ? → M : 9.80665 M ÷ ( tan A sin B – cos B ) → Y : Y sin B ÷ cos A → X Y

Example:

Input:
A = 43°, B = 89°, M = 16 kg

Results:
X = 234.4572201 N, Y = 171.4972763 N

Atwood Machine:  Tension and Acceleration



The program calculates the tension in the string of the Atwood Machine and the acceleration of the system.  If the acceleration is negative, the pulley is turning clockwise, otherwise it is turning counterclockwise.  The following system of equations is solved, where X is the tension of the strings and Y is the acceleration of the system.

X + A * Y = g * A
-X + B * Y = -g * B

Where g is Earth’s gravitation constant, or g = 9.80665 m/s^2 ≈ 32.174 ft/s^2

SI units are used in this program.

Program (45 steps):
? A : ? B : 9.80665 (A – B) ÷ ( A + B ) Y : A (9.80665 – Y) X Y

Examples:

Input:
A = 11.2 kg, B = 10.3 kg

Results:
X = 105.2367576 N, Y = 0.41051093 m/s^2

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.



Friday, May 11, 2018

Fun with the Sharp EL-5500 III (May 2018 Edition)


Fun with the Sharp EL-5500 III   (May 2018 Edition)

The EL-5500 III is one of my favorite pocket programming device, small, portable, and has my favorite programming language: BASIC. 

Let’s get started.

Note:  Substitute line numbers with labels that you find fit.  Add defined labels to the first line if you would like.  Labels can come from the bottom two rows of the QWERTY keyboard (A row and Z row).

Comments are followed by double slashes (//), they are not typed.

Sharp EL-5500 III Program:  Net Present Value

2  PAUSE “NET PRESEN VALUE”
4  CLEAR    // clears all the variables
6  INPUT “CF0:”; N, “RATE:”; I
8  J = 1
10 INPUT “FLOW:”; F, “FREQ:”; K
12 FOR L=1 TO K: N = N + F/(1 + I/100)^J: J = J+1
14 NEXT L
16 INPUT “MORE=1: “; L   // enter 1 to enter more cash flows, anything else to end entry
18 PRINT USING “#############.##”; “NPV: “; N
20 END

Example:

CF0:  -7,000,  Interest Rate:  8%
Flow 1:  2,000, Freq 1: 1  (enter 1 for MORE)
Flow 2:  1,500, Freq 2: 2  (enter 1 for MORE)
Flow 3:  2,500, Freq 3: 2  (we are at the end, enter anything other than 1 at MORE)

Result:
NPV:  2443.06

Sharp EL-5500 III Program: Synthetic Division

2 PAUSE “Synthetic Division”: CLEAR
4 PRINT “P(X)/(X – R)”: WAIT 59   // WAIT 59 is about 1 second
6 INPUT “DEGREE:”; N
8 DIM P(N): DIM Q(N)
10 FOR I=1 TO N
12 PRINT “COEF OF X^”; N-I
14 INPUT P(I): Q(I) = P(I)
16 NEXT I   // there is no line 18
20 INPUT “R:”; R
22 FOR I=0 TO N-1
24 Q(I+1) = R*Q(I) + P(I+1)
26 NEXT I
28 E = Q(N)
30 PRINT “Q(X) = “
32 FOR I=0 TO N-1
34 PRINT Q(I); “X^”; N-I-1
36 WAIT 150  // about 2.5 seconds
38 NEXT I
40 PRINT “+”; E; “/(X-“; R; “)”: END

Example:  (x^4 – 2*x^3 + 1) / (x – 1)
Degree: 4
Coefficients:  1, -2, 0, 0, 1
R: 1

Result: 1, -1, -1, -1, no remainder
x^3 – x^2 – x – x

Sharp EL-5500 III Program: Vector Basics

Cross product, dot product, norm of two vectors, angle between two vectors

2 PAUSE “Vector Basics”
4 INPUT “X1:”; X1, “Y1:”; Y1, “Z1:”; Z1  \\ vector 1
6 INPUT “X2:’; X2, “Y2:”; Y2, “Z2:”, Z2  \\ vector 2
8 C1 = Y1*Z2 – Y2*Z1: C2 = -X1*Z2 + X2*Z1: C3 = X1*Y2 – X2*Y1  // cross product
10 D = X1*X2 + Y1*Y2 + Z1*Z2  \\ dot product
12 N1 = √(SQU X1 + SQU Y1 + SQU Z1): N2 = √(SQU X2 + SQU Y2 + SQU Z2)  // norm, SQU is the x^2 key
14 DEGREE
16 A = ACS( D/(N1*N2))  // angle between vectors, ACS is ACOS
18 PRINT “CROSS X: ”; C1
20 PRINT “CROSS Y: ”; C2
22 PRINT “CROSS Z: ”; C3
24 PRINT “DOT: ”; D
26 PRINT “NORM V1: “; N1
28 PRINT “NORM V2: “; N2
30 PRINT “ANGLE: “; A
32 END


Example:  V1 = [-2, 3, 0] and V2 = [ 4, 2, -11]
Cross: [-33, -22, -16]
Dot: -2
Norm V1: 3.605551275
Norm V2: 11.87434209
Angle: 92.67749998°

Sharp EL-5500 III: Atwood Machine

M1:  mass hanging on the left side of the machine
M2:  mass hanging on the right side of the machine

The program asks to choose a unit system.  Enter 1 for US units (feet, pounds, seconds, g = 32.174 ft/s^2), anything else for SI units (meters, kilograms, seconds, g = 9.80665 m/s^2).

2 PAUSE “Atwood Machine”
4 INPUT “1: US, ELSE: SI “; I
6 IF I=1 THEN LET G=32.174
8 IF I<>1 THEN LET G=9.80665
10 INPUT “M1: “; M1, “M2: “; M2
12 A = (M1 – M2)*G / (M1 + M2)
14 T = M1 * (G-A)
16 PRINT “Accel.: “; A
18 PRINT “Tension: “: T
20 END

Example:  M1 = 11.82 kg, M2 = 9.38 kg, use SI units (enter anything other than 1 at the 1:US, ELSE:SI prompt)

Results:
Accel.: 1.128689906 m/s^2
Tension: 102.5734883 N


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.

The MU Key on a Four Function Calculator and Programs for the DM42/HP 42S

  The MU Key on a Four Function Calculator and Programs for the DM42/HP 42S Not too long ago, I purchased this very colorful, four funct...