How to resolve the algorithm Deming's funnel step by step in the PARI/GP programming language
How to resolve the algorithm Deming's funnel step by step in the PARI/GP programming language
Table of Contents
Problem Statement
W Edwards Deming was an American statistician and management guru who used physical demonstrations to illuminate his teachings. In one demonstration Deming repeatedly dropped marbles through a funnel at a target, marking where they landed, and observing the resulting pattern. He applied a sequence of "rules" to try to improve performance. In each case the experiment begins with the funnel positioned directly over the target.
Apply the four rules to the set of 50 pseudorandom displacements provided (e.g in the Racket solution) for the dxs and dys. Output: calculate the mean and standard-deviations of the resulting x and y values for each rule.
Note that rules 2, 3, and 4 give successively worse results. Trying to deterministically compensate for a random process is counter-productive, but -- according to Deming -- quite a popular pastime: see the Further Information, below for examples.
Stretch goal 1: Generate fresh pseudorandom data. The radial displacement of the drop from the funnel position is given by a Gaussian distribution (standard deviation is 1.0) and the angle of displacement is uniformly distributed.
Stretch goal 2: Show scatter plots of all four results.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Deming's funnel step by step in the PARI/GP programming language
Source code in the pari/gp programming language
drop(drops, rule, rnd)={
my(v=vector(drops),target=0);
v[1]=rule(target, 0);
for(i=2,drops,
target=rule(target, v[i-1]);
v[i]=rnd(n)+target
);
v
};
R=[-.533-.136*I,.27-.717*I,.859-.459*I,-.043+.225*I,-.205-1.39*I,-.127-.385*I,-.071-.121*I,.275+.395*I,1.25-.490*I,-.231+.682*I,-.401+.0650*I,.269-.242*I,.491+.288*I,.951-.658*I,1.15-.459*I,.001,-.382-.426*I,.161-.205*I,.915+.765*I,2.08+2.19*I,-2.34+.742*I,.034+.0100*I,-.126-.0890*I,.014-.208*I,.709-.585*I,.129-.633*I,-1.09+.444*I,-.483+.351*I,-1.19+1.09*I,.02-.199*I,-.051-.701*I,.047-.0960*I,-.095+.0250*I,.695+.868*I,.34-1.05*I,-.182-.157*I,.287-.216*I,.213-.162*I,-.423-.249*I,-.021+.00700*I,-0.134-.00900*I,1.8-.508*I,.021+.790*I,-1.1-.723*I,-.361-.881*I,1.64+.508*I,-1.13-.393*I,1.32+.226*I,.201-.710*I,.034-.0380*I,.097+.217*I,-.17-.831*I,.054-.480*I,-.553-.407*I,-.024-.447*I,-.181+.295*I,-.7-1.13*I,-.361-.380*I,-.789-.549*I,.279+.445*I,-.174+.0460*I,-.009-.428*I,-.323+.0740*I,-.658-.217*I,.348+.822*I,-.528-.491*I,.881-1.35*I,.021+.141*I,-.853-1.23*I,.157+.0440*I,.648-.0790*I,1.77-.219*I,-1.04-.698*I,.051-.275*I,.021-.0560*I,.247-.0310*I,-.31-.421*I,.171-.0640*I,-.721*I,.106-.104*I,.024+.729*I,-.386-.650*I,.962+1.10*I,.765-.154*I,-.125+1.72*I,-.289-.0510*I,.521+.385*I,.017-.477*I,.281-1.54*I,-.749+.901*I,-.149-.939*I,-2.44+.411*I,-.909-.341*I,.394+.411*I,-.113-.106*I,-.598-.224*I,.443+.947*I,-.521+1.42*I,-.799+.542*I,.087+1.03*I];
rule1(target, result)=0;
rule2(target, result)=target-result;
rule3(target, result)=-result;
rule4(target, result)=result;
mean(v)=sum(i=1,#v,v[i])/#v;
stdev(v,mu=mean(v))=sqrt(sum(i=1,#v,(v[i]-mu)^2)/#v);
main()={
my(V);
V=apply(f->drop(100,f,n->R[n]), [rule1, rule2, rule3, rule4]);
for(i=1,4,
print("Method #"i);
print("Means: ", mean(real(V[i])), "\t", mean(imag(V[i])));
print("StDev: ", stdev(real(V[i])), "\t", stdev(imag(V[i])));
print()
)
}
You may also check:How to resolve the algorithm Sum and product of an array step by step in the V (Vlang) programming language
You may also check:How to resolve the algorithm File input/output step by step in the Ruby programming language
You may also check:How to resolve the algorithm Leap year step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Perfect numbers step by step in the C++ programming language
You may also check:How to resolve the algorithm Increment a numerical string step by step in the dt programming language