Showing posts with label binomial distribution. Show all posts
Showing posts with label binomial distribution. Show all posts

Saturday, January 13, 2024

TI-30Xa Algorithms: Probability

TI-30Xa Algorithms:  Probability



Introduction


Even when a calculator isn't (technically) programmable, algorithms can be applied to scientific and financial calculations.


The calculations take numerical arguments that are stored in the TI-30Xa's three memory slots:  M1, M2, and M3.  Store amounts into the memory registers by the [ STO ] key.  


Careful:  For the solar versions of the TI-30Xa, do not press the [ON/AC] button as doing so clears the memory registers.


The registers used:


M1 = n 

M2 = k 

M3 = p 



Repeated Combinations


nHk = (n + k -1)Ck = (n + k - 1)! ÷ (k! × (n - 1)!)


Registers:


M1:  n = number of objects

M2:  k = number of objects chosen in the population


nHk = number of combinations of picking k from n objects, assuming repeats are allowed


Algorithm:


[ ( ] [ RCL ] 1 [ + ] [ RCL ] 2 [ - ] 1 [ ) ] [ 2nd ] (nCr) [ RCL ] 2 [ = ]


Example:


M1: n = 50

M2: k = 5


Result:  3,162,510



Binomial Probability Distribution


Prob(k) = nCk × p^k × (1 - p)^(n - k) = n! ÷ (k! × (n - k)!) × p^k × (1 - p)^(n - k) 


Registers:


M1:  n = number of trials

M2:  k = number of successes

M3:  p = probability of success (in decimal; i.e. enter 0.30 for 30%)


Prob =  probability of k successes out of n trials with a success probability p


Algorithm:  


[ RCL ] 1 [ 2nd ] (nCr) [ RCL ] 2 [ × ] [ RCL ] 3 [ y^x ] [ RCL ] 2 [ × ] [ ( ] 1 [ - ] [ RCL ] 3  [ ) ] [ y^x ] [ ( ] [ RCL ] 1 [ - ] [ RCL ] 2 [ ) ] [ = ] 


Example:


M1: n = 50

M2: k = 5

M3: p = 0.8


Result:  2.442763967 × 10^-26



Geometric Probability Distribution


Prob(k) = (1 - p)^(k - 1) × p


Registers:


M2:  k = number of failures before the first success

M3:  p = probability of success (in decimal) 


Prob = probability of a event taking k trials before the first success


Algorithm:


[ ( ] 1 [ - ] [ RCL ] 3 [ ) ] [ y^x ] [ ( ] [ RCL ] 2 [ - ] 1 [ ) ] [ × ] [ RCL ] 3 [ = ]


Example:


M2: k = 5

M3: p = 0.8


Result:  0.00128



A Simple Pseudorandom Number Generator


The TI-30Xa does not have a random number function.  To generate random numbers, a pseudorandom number generator algorithm must be used in the form of:


x_n+1 = f(x_n)


where x_0 is the initial value, known as the seed value.  



A simple pseudorandom  number generator to generate numbers between 0 and 1 is:


x_n+1 = frac(997 × x_n + π)



Algorithm:


With x_n in display:

[ × ] 997 [ + ] [ π ] [ = ] 

[ - ] the integer part of the number in the display [ = ]


Result:  x_n+1.   


There is no fraction part or integer part functions are not available on the TI-30Xa.  



Example:   


Starting seed:   0.7896   


[ × ] 997 [ + ] 

[ π ] [ = ]        Display:  799.3457927

[ - ] 799 [ = ]  Display:  0.345792654


[ × ] 997 [ + ] 

[ π ] [ = ]        Display:  347.8968683

[ - ] 347 [ = ]  Display:  0.896868283


[ × ] 997 [ + ] 

[ π ] [ = ]        Display:  897.3192706

[ - ] 897 [ = ]  Display:  0.319270625


[ × ] 997 [ + ] 

[ π ] [ = ]        Display:  321.4544059

[ - ] 321 [ = ]  Display:  0.454405908


and so on...


The random numbers with the starting seed 0.7896 are:

0.345792654

0.896868283

0.319270625

0.454405908


Take as many decimal points as you wish.  




If you enjoy this post, I will consider making a series using the TI-30Xa calculator (and similar simple scientific calculators).  Until next time,


Eddie 


All original content copyright, © 2011-2024.  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, September 17, 2023

Filling the Memory of a Casio fx-4000P

Filling the Memory of a Casio fx-4000P





How many programs does it take to fill the 550 step memory?   Here are six programs that pretty much does the job.   I purposely aimed for descriptive prompts and messages. 


Spaces are added for readability.  


Here's are the six programs:


Prg 1:  Approximating the cumulative distribution function of the Normal Curve - to 3 decimal places


Mode +:  COMP,  Number of Steps: 82


"Z≥0" : ?→Z : Fix 3 : 1 - ((1+.196854 Z +.115194 Z² + .000344 Z^3 + .019527 Z^4)^ -4) ÷ 2 : Rnd : Norm : "AREA=" ◢ Ans → A


Source:  Abramowitz and Stegun, Handbook of Mathematical Functions. 1972.


Examples:


Z = 1.6

Results:  AREA = 0.945


Z = 1

Results:  AREA = 0.841


For best results, enter a positive Z.  



Prg 2:  Binomial Distribution PDF with Mean and Variance 


Mode +: COMP, Number of Steps: 86


"P(WIN)" : ?→P : "TRIALS" : ?→T : "WINS" : ?→N : "PDF=" ◢ T nCr N × P x^y N × (1-p) x^y (T-N) ◢ "MU=" ◢ T P  ◢ "VAR=" ◢ Ans (1 - P)


Note:  The combination function, nCr, is shown on the screen as a lone solid C.  I have the nCr for clarification.  


P(WIN):  probability of a successful event

TRIALS:  number of events

WINS:  number of successful events

PDF:  probability of we get the number of successful events

MU:  expected value, mean - depending on P(WIN) and TRIALS

VAR:  variance - depending on P(WIN) and TRIALS


Example:


P(WIN) = 0.7,  TRIALS = 25, WINS = 10

Results:  PDF = 1.324897424 x 10^-3, MU= 17.5, VAR= 5.25   



Prg 3:  Angles of a triangle given 3 side lengths in Degrees - Solve a SSS (side-side-side) Triangle


Mode +: COMP,  Number of Steps: 86


Deg : "A" : ?→A : "B" : ?→B : "C" : ?→C : "<A=" ◢ cos^-1 ((A² + B² - C²) ÷ (-2 B C))  → D ◢ "<B=" ◢ sin^-1(B sin D ÷ A) → E ◢ "<C=" ◢ 180-D-E→F 


Angle <A  (stored in D) is opposite of side with length A

Angle <B (stored in E) is opposite of side with length B

Angle <C (stored in F) is opposite of side with length C


Degrees mode is set in the program.  


Example:

Triangle with lengths A = 24, B = 60, C = 44

Results:  <A = 20.04997572,  <B = 58.99241697, <C = 100.9576073



Prg 4:   Free Fall with Air Resistance (from Ke!san)  

Assume coefficient is standard at k = 0.24 kg/m

(angle is not needed, hyperbolic trig does not depend on angle unit)


Site:  https://keisan.casio.com/exec/system/1231475371

(last retrieved:  February 27, 2023)


Mode +:  COMP,  Number of Steps:  88


.24 → K : 9.80665 → G : "MASS" : ?→M : "DIST" : ?→D : √(M ÷ G ÷ K) → X : "TIME=" ◢ 

X cosh^-1 (e(D K ÷ M)) → T ◢ "VEL=" ◢ X G tanh(T ÷ X) → V


SI units are assumed.


Example:

MASS = 68 kg, DIST (free fall distance) = 1874 m

Results:  TIME = 39.27745305 s, VEL (velocity at free fall) = 52.71191359 m/s



Prg 5:  Sums of 1 to n for k, k^2, k^3, and K^4


Mode +:  COMP, Number of Steps:  83


"1 TO..." : ?→N : "K =" ◢ N (N+1) ÷ 2 → S ◢ "K²=" ◢ S (2 N + 1) ÷ 3 → T ◢ 

"K◢3=" ◢ S² → U ◢ "K◢4=" ◢ T (3 N² + 3 N - 1) ÷ 5 → V 



The power character, x^y can not be used in a string or an error occurs.  The stop character, ◢, can be used.  


K:   Σ (K from K = 1 to K = N)

K²:  Σ (K^2 from K = 1 to K = N)

K◢3:  Σ (K^3 from K = 1 to K = N)

K◢4:  Σ (K^4 from K = 1 to K = N)


Example:  

N = 9

Results:

K:  45

K²:  285

K◢3:  2025

K◢4:  15333



Prg 6:  Simple Ohm's Law Wheel/Volts, Current, Resistance:  "PIE" chart


Mode +:  COMP, Number of Steps: 121


Lbl 0 : "ENT 0 TO SLV" ◢ "I" ◢ ?→I : "V" ◢ ?→ V : "R" ◢ ?→R : I=0 ⇒ Goto 1 : V=0 ⇒ Goto 2:  R=0 ⇒ Goto 3: Goto 0:  Lbl 1:  "I="  ◢ V ÷ R → I ◢ Goto 4: Lbl 2: "V=" ◢ I R → V ◢ Goto 4: Lbl 3: "R=" ◢ V ÷ I → R ◢ Lbl 4: "END"


I:  current (amps, A)

V: voltage (volts, V)

R:  resistance (ohms, Ω)


The inputs will be in this order.  Enter a zero for the variable you want to solve for.  


Examples:


Solve for I:  I = 0, V = 12, R = 3

Result:  I = 4


Solve for V:  I = 20, V = 0, R = 30

Result:  V = 600


Solve for R:  I = 17, V = 120, R = 0

Result:  R ≈ 7.05






Total Number of Programs: 6

Total Steps Used: 121 (I only have 4 left)


Eddie



All original content copyright, © 2011-2023.  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, September 9, 2023

Casio fx-9750GIII: Coin Flips and Probability of Winning

Casio fx-9750GIII:  Coin Flips and Probability of Winning




Introduction


The program COINPROB answers two questions in probability:



Take a game, with the chance of winning p.    There are only wins (success) and losses (failures).  Each game is independent and has the same chance of win.


1.  What is the chance of having an amount of wins in a set amount of games?   The binomial distribution is used to answer this question.


2. How many losses must be endured before a win occurs?  For this question, we turn to the geometric distribution.


Three results are listed are:


PDF:  the probability

MEAN:  expected value

VAR:  variance


The probability of success is also listed.



Casio fx-9750GIII Program:  COINPROB


Program Code:

(most spaces are added for readability)


"EWS 2023-06-25"

.5 → P

Locate 1, 4, "P(WIN) = P"

Locate 1, 5, "P(LOSS) = 1-P"

Locate 1, 6, "GAMES = TRIALS" ◢


Lbl 0

ClrText

Menu "PROB WIN VS LOSS", "SETTINGS", S, "# WINS IN GAMES", 1,

"# LOSS BEF. WIN", 2, "EXIT", E


Lbl S

Menu "SETTINGS", "P(WIN) = 0.5", F, "SET P(WIN)", U

Lbl F

.5 → F

"P(WIN) = .5"

"P(LOSS) = .5" ◢

Goto 0


Lbl U

"P(WIN)"? → P

"P(LOSS) = "

1 - P ◢

Goto 0


Lbl 1

"# GAMES"? → N

"# WINS"? → S

N nCr S × P^S × (1 - P)^(N - S) → D

N × P → M

M × (1 - P) → V

Goto R


Lbl 2

"# LOSSES"? → F

(1 - P)^(F - 1) × P → D

P⁻¹ → M

M × (1 - P) ÷ P → V

Goto R


Lbl R

ClrText

Locate 1, 3, "PDF= "

Locate 7, 3, D

Locate 1, 4, "MEAN="

Locate 7, 4, M

Locate 1, 5, "VAR="

Locate 7, 5, V

Locate 1, 6, "P(WIN)="

Locate 9, 6, P ◢

Goto 0


Lbl E

"THANK YOU"


Note:  The bold C is the combination function (nCr).  


A typo has been corrected (see line in red).  I thank Richard Antley for pointing out my error. - 9/27/2023 


Examples



1.  A fair coin is flipped.  You win if the coin flipped is heads.   What is the probability that you win 7 out of 10 times?


P = 0.5


# GAMES?  10

# WINS?  7


Problem Type:  # WINS IN GAMES


Results:

PDF=  0.1171875

MEAN= 5

VAR= 2.5

P(WIN)= 0.5


2.  What is the probability that you flip 7 tails before flipping a head?  Assume a fair coin.


P = 0.5


Problem Type:  # LOSS BEF. WIN


# LOSSES? 7


Results:


PDF=  0.0078125

MEAN= 2

VAR= 2

P(WIN)= 0.5


3.  On any given day in Luau Town, the chance of rain is 35% each day.   On a given week, how many days are expected to be sunny?


WIN:  sunny days (because that is what we want)

P(WIN) = 1 - 35% = 65% = 0.65

We want the mean (expected value).


Problem Type:  # WINS IN GAMES


Change P(WIN) to 0.65 in settings.  


# GAMES?  7  (7 days)

# WINS? (since we are interested in the mean, we can enter any number 0 to 7)


Results:


PDF= (N/A)

MEAN= 4.55

VAR= 1.5925

P(WIN)= 0.65


A week is expected to have about 4.55 sunny days.  Expected value does not have to be an integer.


4.  Assuming the chance of rain is 35% in Luau Town, what is the chance that there are 3 rainy days before a sunny day?


WIN:  sunny days, P(WIN) = 0.65


# LOSSES?  3


Results:  


PDF= 0.079625

MEAN= 1.538461538

VAR= 0.8284023669

P(WIN)= 0.65



Eddie


All original content copyright, © 2011-2023.  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, June 19, 2021

7000G Retro Month - June 19 Edition

7000G Retro Month - June 19 Edition





Introduction


Welcome to the 7000G Retro Month, which features programming for the classic Casio calculators from the mid/late 1980s:  primarily fx-7000G and fx-7500G.  Since the programming language stays similar throughout the years, programs can be translated to the fx-6300G and later graphing calculators with little to no adjustments.  Non graphic programs should be ported to the fx-4000P, fx-4500P (A), fx-3650p (II), fx-50F Plus (II), and fx-5800P with little to no adjustments.  


7000G Retro Month takes place every Saturday during June 2021.


To make text easier to type, I can going to use the following text friendly symbols for the following:


->  for →


/I for ⊿


=> for ⇒


What do you think?   Unicode or simple text equivalents?  


- - - - - - -- - -- - -


Today's subject revolves around Probability and Random Numbers.  Enjoy!


- - - -- - - -- - -- -- -


Random Integers: Repeats Allowed 


This program allows the user to generate a number of integers between A and B, repeats are allowed.   Each integer is displayed one at a time.


"A"? -> A

"B"? -> B

"N"? -> N

Lbl 1

Int ((B-A+1) Rnd#) /I

Dsz N

Goto 1


Combinatorics


The program allows the user to choose between three options:


1.  PERM:  permutation:  nPr

2.  COMB:  combination:  nCr

3.  COMB REPLACE:  combination with replacements allowed (n+r-1)Cr


"N"? -> N

"R"? -> R

"1. PERM"

"2. COMB"

"3. COMB REPLACE"

? -> K

K=1 => N!÷(N-R)! -> X

K=2 => N!÷(R!(N-R)!) -> X

K=3 => (N+R-1)!÷(R!(N-1)!) -> X

X


Binomial Distribution


This program calculates the sum of probabilities for a binomial distribution:


total probability = ∑( nCr(N,K) p^K (1-p)^(N-K), K=A to B)


Probability:  0 < p < 1


"A"? -> A : "B"? -> B

"N"? -> N : "P"? -> P

0 -> M : Lbl 1

M+(N!×P^A×(1-P)^(N-A))÷(A!(N-A)!) -> M

A+1 -> A

A>B => Goto 2

Goto 1

Lbl 2

M


Confidence Interval


This program generates a confidence interval using one of four probabilities are assigned to the following variables:


F: 99%  (z* ≈ 2.576)

G: 98% (z* ≈ 2.326)

H: 95% (z* ≈ 1.96)

I: 90% (z* ≈ 1.645)


interval = mean ± z* × variance / √n


"CONF INTERVAL"

2.576 -> F

2.326 -> G

1.96 -> H

1.645 -> I

"MEAN"? -> A

"VAR"? -> B

"N"? -> N

"F=.99, G=.98"

"H=.95, I=.90"

? -> J

A-JB÷√N -> E /I

A+JB÷√N -> F


E:  low, F: high


Eddie


All original content copyright, © 2011-2021.  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. 


Friday, April 7, 2017

Retro Review: Hewlett Packard HP 20S and 21S


Retro Review:  Hewlett Packard HP 20S and 21S



Company:  Hewlett Packard
Type:  Scientific Programming
Memory:  9 Registers, 99 Programing Steps, 6 Pre-loaded programs
Years:  1988? – 1993? (21S); 1988 – 2002(?) (20S), original price was around $50
Operating System:  Algebraic
Batteries:  3 x LR44

HP 21S:  The Rarer Cousin of the HP 20S

The HP 21S is an algebraic, keystroke programming calculator.  I paid $35, which is not bad considering the keyboard and the display are in supreme quality, the keys are a pleasure to touch, and the learning curve is easy to operate the calculator.   

The HP 21S was originally released by Hewlett Packard along with the more familiar cousin the HP 20S.   Both had a great dark brown keyboard with white font for primary labels, orange and blue for shift key fonts (my favorite!).  This design has been used several Hewlett Packard calculators from the late 1980s/early 1990s, including the HP 32SII and the HP 48 SX.  Sometime during the 1990s, the HP 20S garnered a purple/green shift font scheme, to match the HP 48 G series. 


What the 20S and 21S Have in Common

Both are algebraic programming calculators.  Each calculator has 10 memory registers (R0 through R9) with storage arithmetic available (STO+, STO-, STO*, and STO÷).  Both models have the standard array of scientific functions including trigonometric, logarithmic, exponential, combination, permutation, integer and fraction parts, and decimal/hours-minutes-seconds conversions.  However, there is no fraction mode and all numbers are real numbers. 

One thing is to consider is that the factorial function (n!) only accepts positive integers. 

 

The INPUT Key

 It does take a little getting used to working the [INPUT] key, especially for those who work with HP calculators, since we’re used to RPN.  The INPUT key stores the number in a temporary “x” slot.  The INPUT key places a role in several functions:
 
Rectangular to Polar Conversion:  x, [INPUT], y, [left shift], [STO] (>P) 
(θ is displayed, r is stored)
 
Polar to Rectangular Conversion:  r, [INPUT], θ, [right shift], [STO] (>R) 
(y is displayed, x is stored)
 
Combinations/Permutations:  n, [INPUT], r, [right shift], [ 0 ] (combination) or [ . ] (permutation)
 
Percent Change: 
HP 20S:  old, [INPUT], new, [left shift], [ 1/x ] (%CHG)
HP 21S:  old, [INPUT], new, [right shift], [ 5 ] (%CHG)

 

Statistics

 
Both the HP 20S and HP 21S have one variable, one weighted variable, two variable statistics, and linear regression.  There is no separate mode to be entered, just enter data with the [ Σ+ ] and go.  Upon entering and clearing data though, the following registers become holders of statistical sums:


R4 = n

R5 = Σx

R6 = Σy

R7 = Σx^2

R8 = Σy^2

R9 = Σxy

 
What is really nice is that both models have the sums indicated in gray at the bottom right hand corner of the keys as reminders.

Programming
 
Both the HP 20S and the HP 21S are keystroke programmable.  Both allow for labels A – F, 0 – 9.  In addition there are two tests:  x=0? and x≤y?.

The x≤y? Test:  x, [INPUT]*, y, [right shift], [ 7 ] (x≤y?).   A way to remember this command is:  hidden value ≤ displayed valued?

 
* According to the manuals, any other arithmetic/pending operation can be used such as [ + ] and [ ÷ ] are also allowed.
 

Each digit takes a step.  For example, 250 takes three steps, one for the 2, the 5, and the 0.

 
Differences between the HP 20S and HP 21S
 

Scientific Operations

 
HP 20S
HP 21S
Hyperbolic functions, base conversions (binary, octal, hexadecimal, binary), metric/US conversions (kg/lb, °C/°F, cm/in, l/gal)
Upper tail areas and inverse (z, t, F, Chi-squared), random numbers, seeding

 
Preloaded Programs

 

The HP 20S and HP 21S have six-preloaded programs.  The can be loaded by the key sequence [left shift], [ ← ] (LOAD).  While the HP 21S programs can be loaded at any time, the HP 20S must be in programming mode to load programs.

 

Unfortunately, user-created programs cannot be stored into permanent memory which would have been nice.

 

Preloaded Programs HP 20S

 

A
Root Finder
62 steps
B
Numerical Integration
58 steps
C
Complex Arithmetic
75 steps
D
3 x 3 Matrices
98 steps
E
Quadratic Equation
65 steps
F
Curve Fitting (logarithmic, exponential, power)
77 steps

 

Preloaded Programs HP 21S

 

A
One Sample Stat Tests
82 steps
B
Two Sample Stat Tests
82 steps
C
Linear Regression Stat Tests (used with One Sample Tests)
86 steps
D
Chi Square Tests
53 steps
E
Binomial Distribution
39 steps
F
Time Value of Money Solver (Finance)
99 steps

 

Final Verdict
 

Do I recommend buying the HP 21S and/or the HP 20S?  Assuming the price is reasonable, Yes, Yes, and Yes!  It is shame that the HP 20S and HP 21S are no longer produced because these are nice calculators.


The original price was around $45 - $55.    
 

Let’s get to the features.  I think it would be appropriate comparing the features of both the HP 21S and HP 20S at the same time. 
 

Eddie
 

This blog is property of Edward Shore, 2017

Wednesday, August 31, 2016

HP 12C: Combination/Binomial Distribution/Negative Binomial Distribution



HP 12C:  Combination/Binomial Distribution/Negative Binomial Distribution

Introduction and Formulas

Combination: Find the number of groups out of a possible set of objects.  The order of objects obtained does not matter. 
Store n in R1, x in R0, and p in R2.  Press [ f ] [ R↓]  (CLEAR PRGM), [ R/S ]
Formula:  COMB(n, x)  = n!/(x! * (n-x)!)

Binomial Distribution:  Find number of successes (x) in a fixed number of trials (n). 
Store n in R1, x in R0, and p in R2.  Press [ g ] [ R↓ ] (GTO) 26, [R/S]
Formula:  COMB(n, x) * p^x * (1 – p)^(n – x)

Negative Binomial Distribution:  Find the number of trials (n) needed to obtain a fixed amount of successes (x).
Store x in R1, n in R0, and p in R2.  Press [ g ] [ R↓ ] (GTO) 43, [R/S]
Formula:  COMB(x – 1, n – 1) * p^(n -1) * (1 – p)^((x - 1) - (n – 1))

In the distribution calculations, p is the probability where 0 ≤ p ≤ 1. 
Note: R3 is used as a flag, which will allowed for branching.

STEP
CODE
KEY
Combination


01
0
0
02
44, 3
STO 3
03
45, 1
RCL 1
04
43, 3
N!
05
45, 0
RCL 0
06
43, 3
N!
07
10
÷
08
45, 1
RCL 1
09
45, 0
RCL 0
10
30
-
11
43, 3
N!
12
10
÷
Flag Testing


13
45, 3
RCL 3
14
1
1
15
30
-
16
43, 35
X=0
17
43, 33, 29
GTO 29
18
45, 3
RCL 3
19
2
2
20
30
-
21
43, 35
X=0
22
43, 33, 49
GTO 49
23
33
R↓
24
33
R↓
25
43, 33, 00
GTO 00
Binomial Distribution


26
1
1
27
44, 3
STO 3
28
43, 33, 03
GTO 03
29
33
R↓
30
45, 2
RCL 2
31
45, 0
RCL 0
32
21
Y^X
33
20
*
34
1
1
35
45, 2
RCL 2
36
30
-
37
45, 1
RCL 1
38
45, 0
RCL 0
39
30
-
40
21
Y^X
41
20
*
42
43, 33, 00
GTO 00
Negative Binomial Distribution


43
1
1
44
44, 30, 1
STO- 1
45
44, 30, 0
STO- 0
46
2
2
47
44, 3
STO 3
48
43, 33, 03
GTO 03
49
33
R↓
50
33
R↓
51
45, 2
RCL 2
52
45, 0
RCL 0
53
21
Y^X
54
20
*
55
1
1
56
45, 2
RCL 2
57
30
-
58
45, 1
RCL 1
59
45, 0
RCL 0
60
30
-
61
21
Y^X
62
20
*
63
43, 33, 00
GTO 00

Examples:

Find the number of combinations of groups of 2 out of possible 12 objects. 
12 [STO] 1, 2 [STO] 0, [ f ] [ R↓ ] (CLEAR PRGM)
Result:  66

Binomial Distribution:  Toss a coin 25 times. (trails) What is the probability of tossing 10 heads? (successes)  Assume a fair coin.  The variables n = 25, x = 10, p = 0.5 
25 [ STO ] 1, 10 [ STO ] 0, 0.5 [ STO ] 2, [ g ] [ R↓ ] (GTO) 26 [ R/S ]
Result:  0.10   (0.0974166393)

Negative Binomial Distribution:  Assume a fair coin. What is the probability that the 15th tossed of heads comes on the 25th toss of the coin?  x = 15, n = 25, p = 0.5
25 [STO] 1, 15 [STO] 0, 0.5 [ STO ] 2, [ g ] [ R↓] (GTO) 43 [ R/S ]
Result:  0.12  (0.1168999672)

This blog is property of Edward Shore, 2016.

Python in Numworks: Duplicating and Grayscale

Python in Numworks: Duplicating and Grayscale All three scripts presented today use the math, random, and the Numworks specific ...