(Sharp PC1261) Poisson, Binomial, Negative Binomial Distributions

05112021, 05:53 PM
(This post was last modified: 05112021 06:06 PM by Dave Britten.)
Post: #1




(Sharp PC1261) Poisson, Binomial, Negative Binomial Distributions
I picked up a Sharp PC1261 this week, and it's a pretty neat little machine. It's sort of like a fancied up PC1250 (Tandy PC3), with a twoline display, ~10 KB RAM, and a cool builtin help system that lists all the commands and functions, and even provides simple usage examples of each. It uses the more sophisticated BASIC seen on later models, with twocharacter variable names. This means that PC1211 programs aren't directly compatible like they are on the PC1250, but they can usually be made to work with only some simple changes.
This program calculates the Poisson, binomial, and negative binomial distributions, and uses the CURSOR instruction to take advantage of the twoline display. It also demonstrates SHARP's clever use of the INPUT instruction as a conditional (pressing ENTER without actually entering anything leaves the input variable unchanged and also skips the remainder of the line). Binomial Distribution RUN "BINOM" Inputs N: Number of trials P: Probability of success in one trial L: Minimum number of successes H: Maximum number of successes Total probability will be displayed. If L<>H, then you'll get a cumulative probability for L<=x<=H. Negative Binomial Distribution RUN "NBINOM" Inputs NEED: Number of successful trials needed P: Probability of success in one trial The program will calculate the probability for NEED1 successes in R1 trials, followed by a success in trial number R, for increasing values of R. The first calculation will be for R=NEED. The program displays R, P(x=R), P(x<=R), and P(x>R). Press Enter at the "QUIT?" prompt to increment R and display the new results. To quit, type any character at the prompt before pressing Enter. Poisson Distribution RUN "POIS" Inputs LAMBDA and X, the standard Poisson distribution variables. Outputs F(X)  Probability density P(X)  Cumulative lowertail probability (x<=X) The program will prompt for LAMBDA once, and then repeatedly prompt for values of X. To quit the program, press Enter at the "X?" prompt without typing anything. Code: 200 "POIS" INPUT "LAMBDA?";L 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)