Sorted independent finance guides are full of helpful information on everyday money matters.

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.


Leave a Reply

Your email address will not be published.