**TI89**mainRdiscreteD ¥Z ê() Prgm ToolBar Title "discrete" Item "binomial",lbl1 Item "geometric",lbl2 Item "hypgeom",lbl3 Item "neg. binomial",lbl4 Item "poisson",lbl5 Item "quit",lbl6 EndTBar Lbl lbl1 ClrIO Disp "number of trials" Input n Disp "probability" Input p Disp "lower bound" Input j Disp "upper bound" Input k sum(seq(nCr(n,i)*p^i*(1-p)^(n-i),i,j,k))c int ((n+1)p)m nCr(n,m)*p^m*(1-p)^(n-m)a If mž1 Then nCr(n,(m-1))*p^(m-1)*(1-p)^(n-m+1)b Else 0b EndIf Disp "complete distribution?" Input z If z=1 Then FnOff NewData dist,seq(i,i,0,n),seq(round(nCr(n,i)*p^i*(1-p)^(n-i)),i,0,n) NewData dist,dist[1],dist[2],cumSum(dist[2]) 0xmin nxmax 1xscl 0ymin aymax 1yscl PlotsOff PlotsOn 1 NewPlot 1,1,c1,c2,,,,1 EndIf ClrIO Output 1,1,"prob" Output 1,50,round(c) Output 16,1,"mean" Output 16,50,round(n*p) Output 31,1,"st.dev" Output 31,50,round(¨(n*p*(1-p))) If round(a)=round(b) Then Output 46,1,"bimodal" Output 46,50,{m-1,m} Else Output 46,1,"mode" Output 46,50,m EndIf Stop Lbl lbl2 ClrIO Disp "probability" Input p Disp "lower bound" Input j Disp "upper bound" Input k (1-p)^(j-1)-(1-p)^kc Disp "complete distribution?" Input z If z=1 Then min(int(ln(.025)/ln(1-p))+1,999)m NewData dist,seq(i,i,1,m),seq(round((1-p)^(i-1)*p),i,1,m),seq(round(1-(1-p)^i),i,1,m) EndIf ClrIO Output 1,1,"prob" Output 1,50,round(c) Output 16,1,"mean" Output 16,50,round(1/p) Output 31,1,"st.dev" Output 31,50,round(¨(1-p)/p) Stop Lbl lbl3 ClrIO Disp "population size" Input n Disp "type a size" Input m Disp "sample size" Input r Disp "lower bound" Input j Disp "upper bound" Input k sum(seq(nCr(m,i)*nCr(n-m,r-i)/nCr(n,r),i,j,k))c Disp "complete distribution?" Input z If z=1 Then max(0,r-(n-m))i NewData dist,seq(j,j,i,min({m,r,998})),seq(round(nCr(m,j)*nCr(n-m,r-j)/nCr(n,r)),j,i,min({m,r,998})) NewData dist,dist[1],dist[2],cumSum(dist[2]) EndIf ClrIO Output 1,1,"prob" Output 1,50,round(c) Output 16,1,"mean" Output 16,50,round(r*m/n) Output 31,1,"st.dev" Output 31,50,round(¨(r*m/n*(n-m)/n*(n-r)/(n-1))) Stop Lbl lbl4 ClrIO Disp "probability" Input p Disp "number of occurrences" Input r Disp "lower bound" Input j Disp "upper bound" Input k sum(seq(nCr(m-1,r-1)*p^r*(1-p)^(m-r),m,j,k))c Disp "complete distribution?" Input z If z=1 Then 2*int(r/p)l NewData dist,seq(i,i,r,l),seq(round(nCr(m-1,r-1)*p^r*(1-p)^(m-r)),m,r,l) NewData dist,dist[1],dist[2],cumSum(dist[2]) EndIf ClrIO Output 1,1,"prob" Output 1,50,round(c) Output 16,1,"mean" Output 16,50,round(r/p) Output 31,1,"st.dev" Output 31,50,round(¨(r*(1-p))/p) Stop Lbl lbl5 ClrIO Disp "average" Input p Disp "lower bound" Input j Disp "upper bound" Input k –^(­p)*sum(seq(p^i/i!,i,j,k))c int(p)r –^(­p)*p^r/r!a If rž1 Then –^(­p)*p^(r-1)/(r-1)!b Else 0b EndIf Disp "complete distribution?" Input z If z=1 Then FnOff r+1m While –^(­p)*sum(seq(p^i/i!,i,0,m))<.975 and mœ998 m+1m EndWhile NewData dist,seq(i,i,0,m),seq(round(–^(­p)*p^i/i!),i,0,m) NewData dist,dist[1],dist[2],cumSum(dist[2]) 0xmin mxmax 1xscl 0ymin aymax 1yscl PlotsOff PlotsOn 1 NewPlot 1,1,c1,c2,,,,1 EndIf ClrIO Output 1,1,"prob" Output 1,50,round(c) Output 16,1,"mean" Output 16,50,p Output 31,1,"st.dev" Output 31,50,round(¨(p)) If round(a)=round(b) Then Output 46,1,"bimodal" Output 46,50,{r-1,r} Else Output 46,1,"mode" Output 46,50,r EndIf Stop Lbl lbl6 Stop EndPrgm äåÜ*