Musings and comments about our common interest
Let’s us finish with the distribution functions for the HP Prime. Remember that we posted two blog issues about it: here and here.
All were taken from user Salvomic in HPmuseum. This is a monumental job and a great help for those that cannot bear to have an approximation when you can have the real thing.
Here are the last ones:
EXPORT rayleigh(s, t)
// Rayleigh distribution s=σ scale parameter, t>=0 var
// rayleigh(2σ2) = weibull(σ*sqrt(2),2)
BEGIN
local f;
f:= piecewise(t<0, 0, ((t/(s2))*e(-(t2)/(2*(s2)))));
return f;
END;
EXPORT rayleigh_cdf(s, t)
BEGIN
local f;
f:= piecewise(t<0, 0, 1 - e(-t2/(2*(s2))));
return f;
END;
Pareto distribution
EXPORT paretod(xm, a, k)
// Pareto distribution x_m >0 scale, a=α > 0 shape
BEGIN
local f;
IF ((a<=0) OR (xm <= 0) OR (k<xm)) THEN RETURN(“Use: xm > 0, a >0, k >= xm”); END;
f:=(a*xma)/k(a+1);
return f;
END;
EXPORT paretod_cdf(xm, a, k)
BEGIN
local f;
IF ((a<=0) OR (xm <= 0) OR (k<xm)) THEN RETURN(“Use: xm > 0, a >0, k >= xm”); END;
f:=1-(xm/k)^a;
return f;
END;
EXPORT paretod_bound(a, L, H, k)
// Bounded Pareto distribution
// a=α >0 shape, L>0, H>L location, k var
BEGIN
local f;
IF (a<=0 OR L<=0 OR H<=L) THEN RETURN(“Use a>0, L>0, H>L”); END;
f:= (a*La*k(-a–1))/(1-(L/H)^a);
return f;
END;
EXPORT paretod_bnd_cdf(a,L,H,k)
BEGIN
local f;
IF (a<=0 OR L<=0 OR H<=L) THEN RETURN(“Use a>0, L>0, H>L”); END;
f:= (1-La*k(-a))/(1-(L/H)^a);
return f;
END;
n-Erlang distribution
EXPORT erlang(k,l,n)
// n-Erlang distribution k shape parameter, l=λ >=0 rate parameter
// from Gamma d.; if k=1 -> erlang(1,l,n) = exponential(l,n)
// erlang(k,λ) = gamma(k,1/λ)
BEGIN
local f;
f:=piecewise(n<0,0, l<0, 0, ((lk)*(n(k–1)e^(-ln)))/(k–1)! );
END;
EXPORT erlang2(k, m, n)
//k shape parameter, m=μ=1/λ >=0 scale parameter
// if μ=2 -> chi2 with 2k degree of freedom
BEGIN
local f;
f:=piecewise(n<0,0, m<0, 0, (n(k-1)*e(-n/m))/((mk)*(k–1)!));
END;
EXPORT erlang_cdf(k, l, n)
// k shape parameter, l=λ >=0 rate parameter (μ=1/λ)
BEGIN
local f;
f:= 1- sum((1/X!)*(e(-l*n))*(l*n)X,X,0,k–1);
END;
Until now, we have sold blue HP50gs in Spanish-Portuguese packaging. This has not affected users from buying the model, since it is well known that the calculator itself is only in English, and the box languages have only effect in the manuals printed and shipped with the machine. Now, when ordering from our distributor, we have received French, German, Italian and Dutch. Please write to sales@thecalculatorstore.com if you want to obtain one of these.
I have not decided myself which of the HP50g I like best. On one side, the black colour makes a "professional" impression; but, truth to be told, the contrast of the orange labels is limited - and probably a bad choice if you're visually challenged. I am begining to be so, when approaching half a century.
On the other hand, the blue colour HP50g looks younger, decidely student-like; but the letter contrast is so much better than the other.
The one depicted in the picture besides shows the Spanish-Portuguse model, just because it was the only picture available when writing this blog issue!
The HP Prime is a daunting prospect for those that left maths many years ago but still want to refresh it, or for youngsters that have one for class, but are completely frightened by its apparent complexity. I feel it myself: my math knowledge is too small and too old for most of the things that can be done with it.
Well, there is a French site that has created an abosolute beginners' guide to the HP Prime. You can find it here, in its English translation, courtesy of Moravia, an HP distributor in Europe.
http://www.hp-prime.de/de/file/download/...ages_m.pdf
I copy also the link to the French original. Not only for the French among our readers - it is another proof that oftentimes, the original reads better than the copy. The beauty of the French language helps, too (and I am not French!)
http://www.calculatrices-hp.com/uploads/pdf/Livret%20HP%20Prime_v2.pdf
I find especially interesting the programming part. Even though it is thought for French secondary school, it is thought-provoking and it gives you many hints to develop your programming skills with the HP Prime
We continue with the distributions as promised on last blog issue:
Beta Distribution:
EXPORT betad(a, b, n)
// Beta distribution: a=α>0, b=β>0 shape param, n var (0<=n<=1)
BEGIN
local f;
f:= piecewise(n<0 ,0, n>=1, 0, (1/Beta(a,b))*(n(a-1))*(1-n)(b–1));
return f;
END;
EXPORT betad_cdf(a, b, n)
BEGIN
local f, b1;
b1:= int((X(a-1))*(1-X)(b–1),X,0,n);
// incomplete beta function
f:=piecewise(n<0,0,n>=1, 0, b1/Beta(a,b));
return f;
END;
Gamma distribution
EXPORT gammad(a,l,n)
// Gamma distributio 1st formn a=α>0 shape param
// l=λ>0 rate param, n var
BEGIN
local f;
f:= piecewise( n<0,0, (l*e(-l*n)*(l*n)(a–1))/Gamma(a) );
END;
EXPORT gammad_cdf(a,l,n)
BEGIN
local f;
f:= int(X(a-1)*e(-X),X,0,l*n)/Gamma(a);
return f;
END ;
EXPORT gammad2(k,t,n)
// Gamma distribution 2nd form k>0 shape param,
// t=θ>0 scale param, n var
BEGIN
local f;
f:=piecewise(n<0,0, (n(k-1)*e(-n/t)) / ((tk) * Gamma(k)) );
return f;
END;
EXPORT gammad2_cdf(k,t,n)
BEGIN
local f;
f:= int(X(k-1)*e(-X),X,0,n/t)/Gamma(k);
return f;
END ;
Zeta distribution
EXPORT Zetazipf(s, k)
// Zeta (Zipf) distribution, not defined in s=1
BEGIN
local f;
IF s=1 THEN return “Not defined in s=1”; ELSE
f:= (k^(-s))/Zeta(s);
return f;
END; //if
END;
EXPORT Zetazipf_cdf(s,k)
BEGIN
local f, hks;
hks:= sum(1/(Xs), X, 1, k);
// nth generalized armonic number
f:= hks/Zeta(s);
return f;
END;
Laplace distribution:
EXPORT laplaced(m,b,n)
// Laplace distribution m=μ location param, b scale param, n var
// if m=0 and b=1 -> expond scaled by 1/2
BEGIN
local f;
f:= (1/(2b))e^(-(ABS(n-m))/b);
return f;
END;
EXPORT laplaced_cdf(m,b,n)
BEGIN
local f;
f := piecewise(n<n, (1/2)*e((n-m)/b), 1-(1/2)*e(-(n-m)/b));
return f;
END ;
Uniform Distribution
EXPORT uniformd(a,b,n)
// Uniform, distribution [a-b], n var
BEGIN
local f:= piecewise(n>=a AND n<=b, 1/(b-a), 0);
return f;
END;
EXPORT uniformd_cdf(a,b,n)
BEGIN
local f:= piecewise(n<a, 0, n≥b, 1, (n-a)/(b-a));
return f;
END;
start: postbit_signature
Multinomial Distribution:
The multinomial distribution is a generalization of the binomial distribution. For n independent trials each of which leads to a success for exactly one of k categories, with each category having a given fixed success probability, the multinomial distribution gives the probability of any particular combination of numbers of successes for the various categories.
EXPORT Multinomd(n, k, p)
// Multinomial distribution (n>0,{list k_i}, {list p_i})
BEGIN
IF ((type(k) ≠ 6) OR (type(p) ≠ 6)) THEN
return “2nd and 3th argument must be a list”; ELSE
IF n<1 THEN return “n must be >0”; END;
n:= ip(n); //n must be integer
IF (size(k) ≠ size(p) ) THEN return “items in k must be = those in p”; END;
IF (ΣList(k) ≠ n) THEN return “ΣList(k) must be = n”; END;
IF (ΣList(p) > 1) THEN return “ΣList(p) must be <= 1”; END;
// ΣList(p) should be = 1 but we can use in list k only values with no 0
//so items in p could be less than those in k…
return (n!/ΠLIST(k!))*ΠLIST(pk);
END; // if
END;
There is an interesting article about statistical distributions for the HP Prime in hpmuseum.org. As you may know, the HP Prime comes with several functions to provide statistical distributions. The ones that come to my mind now are:
These come in all three flavors: density, cumulative and inverse. So, compared with my beloved HP41CL, it is very well provided. But there are many other distributions that may be needed if you’re heavily into statistics. User Salvomic provides programs for several interesting cases. As he does not claim any copyright to them, and in the interest of the readers, I will post here the programs that create them. For the sake of reader comfort, we’ll post them in several installments, lest the page becomes too long!
Logistic Distribution:
EXPORT logisticd(m,s,k)
// Logistic distribution m=µ, s=s, k=x
BEGIN
local f,g;
g:= (k-m)/s;
f:=e(-g)/(s*(1+e(-g))^2) ;
return f;
END;
EXPORT logistic_cdf(m,s,k)
BEGIN
local f,g;
g:= (k-m)/s;
f := 1/(1+e^(-g));
return f;
END ;
EXPORT logisticd_icdf(m,s,p)
// inverse m=µ, s=s, p probability
BEGIN
local f;
f:= m+s*ln(p/(1-p));
return f;
END;
Lognormal
EXPORT LgNrm(m,s,k)
// LogNormal distribution m=µ, s=s, k=x
BEGIN
local f;
f:= (1/(kssqrt(2pi)))e(-(ln(k)-m)2/(2*s2));
return f;
END;
EXPORT LgNrm_cdf(m,s,k)
BEGIN
local f;
f := normal((ln(k)-m)/s) ;
return f;
END ;
Exponential
EXPORT expond(l,n)
// exponential distribution l=λ=1/np, n
BEGIN
local f;
f:= piecewise(n<0,0, le^(-ln));
return f;
END;
EXPORT expond_cdf(l,n)
BEGIN
local f;
f := piecewise(n<0, 0, 1-e^(-l*n));
return f;
END ;
Geometric
EXPORT geometric(n,p)
// Geometric distribution, n tries, p prob
BEGIN
local f;
f:= p*(1-p)^n;
return f;
END;
EXPORT geometric_cdf(n,p)
BEGIN
local f;
f := 1-(1-p)^(n+1);
return f;
END ;
Hypergeometric
EXPORT ipergeom(n,m,k,j)
// Hypergeometric distribution, n total, m one kind, k extracted, j var
BEGIN
local f;
f:= (comb(m,j)*comb(n-m,k-j))/(comb(n,k));
return f;
END;
Negative Binomial
EXPORT NegBin(r, p,n)
// Negative Binomial distribution observing until r success, with p probability of success
// n num trials for r success (k failures), n=r, r+1,…
BEGIN
local f;
IF (n<r) THEN return “n must be >= r”; ELSE
f:= comb(n–1, r–1)*(pr)*(1-p)(n-r);
return f;
END; //if
END;
EXPORT NegBin_cdf(r, p, n)
BEGIN
local f, b1, a, b;
a:=r; b:= n+1;
b1:= int((X(a-1))*(1-X)(b–1),X,0,p);
// incomplete beta function
f:=( b1/Beta(a,b));
return f;
END;
EXPORT NegBin2(r, p,k)
// Negative Binomial observing until r failures, with p probability of success (1-p failure)
// n num trials, k = n-r success
// i.e. NegBin(5,0.4,15) = NegBin2(5,0.6,10)
BEGIN
local f;
f:= (comb(k+r–1,k))*(pk)*((1-p)r);
return f;
END;
Gompertz
EXPORT gompertz(h,b,n)
// Gompertz distribution h=η shape param, b scale param, n var
BEGIN
local f;
IF (n<0 OR h<=0 OR b<=0) THEN return “Not defined for η or b < =0 or n <0”; ELSE
f:= bhe(b*n)*ehe(-h*e(bn)) ;
return f;
END; // if
END;
EXPORT gompertz_cdf(h,b,n)
BEGIN
local f;
IF (n<0 OR h<=0 OR b<=0) THEN return “Not defined for η or b < =0 or n <0”; ELSE
f := 1-e(-h*(e(b*n)–1));
return f;
END;
END ;
Weibull
EXPORT weibull(l, k, t)
// Weibull distribution: l=λ>0 scale param (characteristic lifetime), k>0 shape parameter t var (time)
BEGIN
local f;
f:= piecewise(t<0,0, (k/l)(t/l)^(k–1)e(-(t/l)k));
return f;
END;
EXPORT weibull_cdf(l, k, t)
BEGIN
local f;
f:= piecewise(t<=0,0, 1-e(-(t/l)k)) ;
return f;
END ;
EXPORT weibull_translate(l, k, t, v)
// Weibull distribution tranlated: v location parameter
BEGIN
local f;
f:= piecewise(t<=v,0, (k/l)((t-v)/l)^(k–1)e(-((t-v)/l)k));
return f;
END;
EXPORT weibull_translate_cdf(l, k, t, v)
BEGIN
local f;
f:= piecewise(t<=v,0, 1-e(-((t-v)/l)k)) ;
return f;
END ;
Cauchy
EXPORT cauchyd(x0,g,n)
// Cauchy distribution x0 location param, g=γ scale param, n var
BEGIN
local f;
f:= 1/ (pig(1+((n-x0)/g)^2)) ;
return f;
END;
EXPORT cauchy_cdf(x0,g,n)
BEGIN
local f;
f:= (1/pi)*atan((n-x0)/g)+1/2 ;
return f;
END ;
EXPORT cauchy_icdf(x0,g,p)
// inverse x0, g=γ, p probability
BEGIN
local f;
f:= x0+gtan(pi(p-(1/2)));
return f;
END;
We have added an infrared module, HP code 82242.
This was a very good idea from HP. If you have used one of the printers with cable (of which we have also a couple of units), or the HP-IL connection, you would agree that it was a much better idea to have a wireless printing.
The module is fully compatible with the HP41cl (tested!) and with both HP82240A and B printers (which are available at 99 € new in our web too)
You will find it in the HP41c corner.
We are putting together two new items:
A new HP41cl, coming from a version 41C, but boxed and with English manuals. It is already available as an option in the website. It is more expensive than the rest - but it is not so easy to get boxed units in good shape. More and more, we’re finding difficult to find units with un-corroded battery contacts. Yes, we know that this can be perfectly repaired with a repair kit, but some users may object to having a less-than-original calculator when they are paying north of 600 €.
A set of HP17bII, including all of the most significant models:
The original, brown color HP17bII
A black model - I have two available only, so only two persons will be able to have this pack
The gold, curvy HP17bII+
The latest, silver HP17bII+
With them, you have this part of the collection ready in just one swift stroke!
You will have the chance to compare all the different versions of what I feel is the most accomplished financial calculator ever made - and one of the 3 or 4 top calculators from HP - all types comprised.
(For the sake of clarity - the silver HP17bII in the pack is a new unit, in its original blister. You can choose in the instructions of the order which specific language you want it)
There is a new product for the HP12c fanatics: a set of 4 different versions of the long-lived, standard setting financial calculator. It consists of:
The combined price of all is 312 €, but the collector’s set sells for 280 - a 32 € off. It also includes free shipping within the European Union - and additional estimated 25 €. All in all, close to 20% off!
It’s your opportunity to enter in the HP12c area with a full collection from scratch.
I have received a couple of questions about the HP 12 C variants. As you all know the HP 12 C is the longest existing product in HP range. It was one of the original Calculator in the Voyager range, and it started to sell in 1981. Hence the 30th anniversary title of the latest version.
The original versions were produced with the technology of the day. They were based on a Coconut-type processor, but running at an even lower speed than the HP 41C, that is 250,000 kHz instead of 640,000 KHz in the Hp 41c. It shared exactly the same processor as the rest of the Voyager range, the only difference between them were the ROMs that each one was using. All Voyager calculators did use a 4 kbyte ROM, except the 15c which used 8 kbytes. When you compare that with the current operating system sizes, several million times bigger, it is amazing how much Mr. Kahan and the HP engineers were able to put in so little silicon space.
The latest versions are based on an ARM processor, running an emulator of the original processor, with a much higher clock speed. This speed can be changed according to the state of the calculator: very low when waiting for a key press, extremely fast when running a program. This is used to lower energy consumption when it is not needed, and be fast when required. And it is fast! My estimate of its relative speed compared with the original, is of about 150 times. Even the newer version of the HP15c does not fare as well as the 12c, at around 100x. And all this, running on an emulator layer!!!
HP discovered that some users did not accept a very fast 12c. They expected it to take its time when solving for interest, distrusting it when the results appeared too fast.
Still, this is a calculator that all users covet - and that they try to replace whith a new one, when -and if- it dies or it is stolen.
I have now sold our last HP41CV. While this is a very old calculator, it is surprising how well they hold their own. Most of the half-nut machines that I have seen are still in working order. Half-nut is another story, but then these offer the possibility of conversion into HP41cl - a different animal.
I am seeing again and again the same profile: a person that had used it in the past, lost/destroyed/got stolen his calculator (with a big percentage of the latter factor), and now want to revive the joy of using it.
Probably the best keyboard action belongs to the Pioneer series, although this is debatable; but the HP41c was much more covetable than any other calculator of the time. Maybe the 67 experienced similar status in past years - but at the time, I was still using a humble 33c and in my father’s office they were using HP97s as secondary desktop computers (the main ones were the HP9815 machines, also RPN-based but that could hold 2kb of program. It was amazing seeing it driving a plotter) - so there was no way for a young student to even see a 67.
Despite being the HP41c a vintage calculator now, I can’t take out of my mind the “modern” sticker that it got in my mind. And it was modern in comparison with everything else, including my hp33c or the then top hp34c. It lived together with other calculators that had true “dot matrix” LCD screens. However, the contrast and visibility of those was minimal. And the upgradeability of the HP41c made it the dream of every engineer, even if they could not afford the additional bits at the time…
Well, now these engineers CAN afford these bits. These are the customers that are buying old HP41cv, or even the powerful HP41CL(of which there are two ready, with the latest circuit version). And if they knew that they could link it with an HP-Il multimeter like the HP3468A, they would probably do it too.