(35S) Statistical Distributions Functions
11-20-2015, 05:47 PM (This post was last modified: 11-20-2015 06:47 PM by Dieter.)
Post: #69
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP 35s Statistical Distributions Functions
(11-20-2015 01:19 PM)Dieter Wrote:  BTW, it seems that the program titled "Distribución Polinomial" actually calculates the multinomial distribution (es: distribución multinomial). Since I am not sure about the correct Spanish term: is there a difference between these two expressions or do they refer to the same distribution? If yes: the multinomial distribution can be calculated much easier and without using so many registers.

OK, here is a version that features some advantages:
• Usage is quite straightforward. No need to prestore values in registers or calculate sums manually.
• Uses merely two registers instead of eleven.
• Number k of events can be anything between 1 and ...infinity
• Erroneous data entry can be corrected by re-entering with a negative frequency x.
• Despite all this: shorter. Could be even shorter (not much more than 20 lines) without the error recovery function (see below)
Here is the listing:

Code:
M001  LBL M M002  CLSTK M003  STO N     n=0 M004  e^x M005  STO P     p=1 M006  ALL M007  CLSTK M008  VIEW N    show accumulated n M009  x=0?      zero or no entry? M010  GTO M027  jump to probability calculation M011  x<>y M012  STO+ N    n := n + x_i M013  SGN M014  x<>y      save sign(x_i) M015  LASTx M016  ABS M017  y^x M018  LASTx M019  ! M020  ÷         p_i^x_i / x_i! M021  x<>y      if xi was negative this is -1 (instead of 1 else) M022  y^x       which turns this into its reciprocal M023  STOx P    update product M024  GTO M006 M025  RCL N M026  ! M027  STOx P    calculate probability M028  FIX 6 M029  RCL P     return result in X M030  VIEW P    and display labelled output M031  GTO M001  start a new calculation with R/S

Here is an example using the data from your (Pedro's) PDF:

Code:
 x1 = 2     p1 = 0,25  x2 = 2     p2 = 0,25  x3 = 5     p3 = 0,25  x4 = 3     p4 = 0,25  [XEQ] M  [ENTER]                        N=         0    // Data is entered by  2 [ENTER] 0,25 [R/S]                  // x_i [ENTER] p_i  [R/S]                        N=         2  2 [ENTER] 0,25 [R/S]                        N=         4  5 [ENTER] 0,5  [R/S]                        N=         9    // oops... wrong data -5 [ENTER] 0,5  [R/S]                  // re-enter with negative x                        N=         4    // and it gets removed  5 [ENTER] 0,25 [R/S]                        N=         9  3 [ENTER] 0,25 [R/S]                        N=        12                 [R/S]                  // data complete, simply press [R/S] or 0 [R/S]                        P=  0,009913    // result

Hmmm... I just got another idea. Maybe this could be done with the Σ+ key using a sum of logs instead of a product... *8)

Edit: Yes, this will also work:

Code:
M001  LBL M M002  CLΣ M003  ALL M004  Σx M005  STO N M006  CLSTK M007  VIEW N M008  x=0? M009  GTO M030 M010  LN M011  x<>y M012  SGN M013  STO N     save sign(x_i) M014  LASTx     * x_i M015  x         = abs(x_i) M016  x M017  LASTx M018  ENTER M019  R↓ M020  ! M021  LN M022  - M023  R↑ M024  RCLx N    multiply M025  x<>y      both values M026  RCLx N    by +1 or -1 M027  x<>y      so that this M028  Σ+        Σ+ may become a Σ- M029  GTO M003 M030  Σx M031  ! M032  LN M033  Σy M034  + M035  e^x M036  STO P M037  FIX 6 M038  VIEW P M039  GTO M001

Program usage is the same as before. The code uses only logs of the factorial function (both "!" are followed by a "LN") so that this approach may be especially useful for calculators with lnΓ function, thus avoiding potential overflow problems.

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread (35S) Statistical Distributions Functions - PedroLeiva - 10-25-2015, 12:19 AM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-25-2015, 01:29 PM RE: HP 35s Statistical Distributions Functions - SlideRule - 10-26-2015, 03:03 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-26-2015, 04:41 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-26-2015, 08:30 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-26-2015, 10:29 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-26-2015, 11:04 PM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-26-2015, 08:39 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-26-2015, 09:25 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 02:29 PM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-26-2015, 09:28 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 11:59 AM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-27-2015, 04:48 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 05:22 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-27-2015, 07:32 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-27-2015, 10:25 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 12:24 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-28-2015, 12:34 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 06:59 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 11:48 PM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-27-2015, 10:29 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 11:41 PM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-28-2015, 12:11 AM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 12:36 AM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-28-2015, 01:05 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-28-2015, 11:55 AM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-28-2015, 01:40 AM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 06:21 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-28-2015, 07:54 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 10:34 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-30-2015, 02:36 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-30-2015, 01:56 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-30-2015, 05:20 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-30-2015, 07:16 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-30-2015, 07:43 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-30-2015, 11:08 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-30-2015, 11:16 PM RE: HP 35s Statistical Distributions Functions - rprosperi - 10-31-2015, 09:11 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 10:45 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-29-2015, 12:09 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-29-2015, 07:01 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-29-2015, 07:18 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-29-2015, 11:56 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-31-2015, 09:05 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-01-2015, 12:44 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-01-2015, 09:17 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-05-2015, 01:37 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-05-2015, 02:16 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-13-2015, 06:59 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-13-2015, 08:04 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-13-2015, 09:05 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-14-2015, 11:22 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-15-2015, 03:04 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-15-2015, 09:26 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-16-2015, 01:13 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-16-2015, 07:08 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-16-2015, 10:47 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-17-2015, 12:44 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-17-2015, 09:20 PM RE: HP 35s Statistical Distributions Functions - Gerald H - 11-19-2015, 09:24 AM RE: HP 35s Statistical Distributions Functions - Dieter - 11-19-2015, 01:00 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-19-2015, 01:17 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-19-2015, 08:31 PM RE: HP 35s Statistical Distributions Functions - Gerald H - 11-19-2015, 05:52 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-20-2015, 12:09 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015, 01:19 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-20-2015, 05:45 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015, 08:30 PM RE: HP 35s Statistical Distributions Functions - Marcio - 11-20-2015, 08:37 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015, 08:54 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015, 11:06 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-21-2015, 07:27 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015 05:47 PM RE: HP 35s Statistical Distributions Functions - Marcio - 11-20-2015, 12:24 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-26-2015, 11:07 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-27-2015, 06:41 AM RE: HP 35s Statistical Distributions Functions - Dieter - 11-29-2015, 06:50 PM

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