# Appendix a to applied probability: directory of m-functions and m  (Page 21/24)

 Page 21 / 24

qsample.m Simulates a sample for a given population density. Determines sample parameters and approximate population parameters. Assumes dfsetup or acsetup has been run. Takes asinput the distribution matrices $X,PX$ and the sample size n . Uses a random number generator to obtain the probability matrix U and uses the m-function dquant to determine the sample. Assumes dfsetup or acsetup has been run.

% QSAMPLE file qsample.m Simulates sample for given population density % Version of 1/31/96% Determines sample parameters % and approximate population parameters.% Assumes dfsetup or acsetup has been run X = input('Enter row matrix of VALUES ');PX = input('Enter row matrix of PROBABILITIES '); n = input('Sample size n = ');m = length(X); U = rand(1,n);T = dquant(X,PX,U); ex = sum(T)/n;EX = dot(X,PX); vx = sum(T.^2)/n - ex^2;VX = dot(X.^2,PX) - EX^2; disp('The sample is in column vector T')disp(['Sample average ex = ', num2str(ex),])disp(['Approximate population mean E(X) = ',num2str(EX),])disp(['Sample variance vx = ',num2str(vx),])disp(['Approximate population variance V(X) = ',num2str(VX),])

targetset.m Setup for arrival at a target set of values. Used in conjunction with the m-procedure targetrun to determine the number of trials needed to visit k of a specified set of target values. Input consists of the distribution matrices $X,PX$ and the specified set E of target values.

% TARGETSET file targetset.m Setup for sample arrival at target set % Version of 6/24/95X = input('Enter population VALUES '); PX = input('Enter population PROBABILITIES ');ms = length(X); x = 1:ms; % Value indicesdisp('The set of population values is') disp(X);E = input('Enter the set of target values '); ne = length(E);e = zeros(1,ne); for i = 1:nee(i) = dot(E(i) == X,x); % Target value indices endF = [0 cumsum(PX)];A = F(1:ms); B = F(2:ms+1);disp('Call for targetrun')

targetrun.m Assumes the m-file targetset has provided the basic data. Input consists of the number r of repetitions and the number k of the target states to visit. Calculates and displays various results.

% TARGETRUN file targetrun.m Number of trials to visit k target values % Version of 6/24/95 Rev for Version 5.1 1/30/98% Assumes the procedure targetset has been run. r = input('Enter the number ofrepetitions '); disp('The target set is')disp(E) ks = input('Enter the number of target values to visit ');if isempty(ks) ks = ne;end if ks>ne ks = ne;end clear T % Trajectory in value indices (reset)R0 = zeros(1,ms); % Indicator for target value indices R0(e) = ones(1,ne);S = zeros(1,r); % Number of trials for each run (reset) for k = 1:rR = R0; i = 1;while sum(R)>ne - ks u = rand(1,1);s = ((A<u)&(u<= B))*x'; if R(s) == 1 % Deletes indices as values reachedR(s) = 0; endT(i) = s; i = i+1;end S(k) = i-1;end if r == 1disp(['The number of trials to completion is ',int2str(i-1),])disp(['The initial value is ',num2str(X(T(1))),])disp(['The terminal value is ',num2str(X(T(i-1))),])N = 1:i-1; TR = [N;X(T)]'; disp('To view the trajectory, call for TR')else [t,f]= csort(S,ones(1,r)); D = [t;f]'; p = f/r;AV = dot(t,p); SD = sqrt(dot(t.^2,p) - AV^2);MN = min(t); MX = max(t);disp(['The average completion time is ',num2str(AV),])disp(['The standard deviation is ',num2str(SD),])disp(['The minimum completion time is ',int2str(MN),])disp(['The maximum completion time is ',int2str(MX),])disp(' ') disp('To view a detailed count, call for D.')disp('The first column shows the various completion times;') disp('the second column shows the numbers of trials yielding those times')plot(t,cumsum(p)) gridtitle('Fraction of Runs t Steps or Less') ylabel('Fraction of runs')xlabel('t = number of steps to complete run') end

#### Questions & Answers

what is the stm
Brian Reply
How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
How can I make nanorobot?
Lily
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
how can I make nanorobot?
Lily
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
A fair die is tossed 180 times. Find the probability P that the face 6 will appear between 29 and 32 times inclusive
Samson Reply

### Read also:

#### Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, Applied probability. OpenStax CNX. Aug 31, 2009 Download for free at http://cnx.org/content/col10708/1.6
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Applied probability' conversation and receive update notifications?

 By Sam Luong By By