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

 Page 24 / 24

branchp.m Calculates the transition matrix for a simple branching process with a specified maximum population. Input consists of the maximum population value M and the coefficient matrix for the generating function for the individual propagation random variables Z i . The latter matrix must include zero coefficients for missing powers.

```% BRANCHP file branchp.m Transition P for simple branching process % Version of 7/25/95% Calculates transition matrix for a simple branching % process with specified maximum population.disp('Do not forget zero probabilities for missing values of Z') PZ = input('Enter PROBABILITIES for individuals ');M = input('Enter maximum allowable population '); mz = length(PZ) - 1;EZ = dot(0:mz,PZ); disp(['The average individual propagation is ',num2str(EZ),]) P = zeros(M+1,M+1);Z = zeros(M,M*mz+1); k = 0:M*mz;a = min(M,k); z = 1;P(1,1) = 1; for i = 1:M % Operation similar to gendz = conv(PZ,z); Z(i,1:i*mz+1) = z;[t,p] = csort(a,Z(i,:));P(i+1,:) = p; enddisp('The transition matrix is P') disp('To study the evolution of the process, call for branchdbn')```

chainset.m Sets up for simulation of Markov chains. Inputs are the transition matrix P the set of states, and an optional set of target states. The chain generating procedures listed below assume this procedure has been run.

```% CHAINSET file chainset.m Setup for simulating Markov chains % Version of 1/2/96 Revise 7/31/97 for version 4.2 and 5.1P = input('Enter the transition matrix '); ms = length(P(1,:));MS = 1:ms; states = input('Enter the states if not 1:ms ');if isempty(states) states = MS;end disp('States are')disp([MS;states]')PI = input('Enter the long-run probabilities '); F = [zeros(1,ms); cumsum(P')]'; A = F(:,MS);B = F(:,MS+1); e = input('Enter the set of target states ');ne = length(e); E = zeros(1,ne);for i = 1:ne E(i) = MS(e(i)==states);end disp(' ')disp('Call for for appropriate chain generating procedure')```

mchain.m Assumes chainset has been run. Generates trajectory of specified length, with specified initial state.

```% MCHAIN file mchain.m Simulation of Markov chains % Version of 1/2/96 Revised 7/31/97 for version 4.2 and 5.1% Assumes the procedure chainset has been run n = input('Enter the number n of stages ');st = input('Enter the initial state '); if ~isempty(st)s = MS(st==states); elses = 1; endT = zeros(1,n); % Trajectory in state numbers U = rand(1,n);for i = 1:n T(i) = s;s = ((A(s,:)<U(i))&(U(i)<= B(s,:)))*MS'; endN = 0:n-1; tr = [N;states(T)]'; n10 = min(n,11);TR = tr(1:n10,:); f = ones(1,n)/n;[sn,p] = csort(T,f);if isempty(PI) disp(' State Frac')disp([states; p]')else disp(' State Frac PI')disp([states; p; PI]')end disp('To view the first part of the trajectory of states, call for TR')```

arrival.m Assumes chainset has been run. Calculates repeatedly the arrival time to a prescribed set of states.

```% ARRIVAL file arrival.m Arrival time to a set of states % Version of 1/2/96 Revised 7/31/97 for version 4.2 and 5.1% Calculates repeatedly the arrival % time to a prescribed set of states.% Assumes the procedure chainset has been run. r = input('Enter the number of repetitions ');disp('The target state set is:') disp(e)st = input('Enter the initial state '); if ~isempty(st)s1 = MS(st==states); % Initial state number elses1 = 1; endclear T % Trajectory in state numbers (reset) S = zeros(1,r); % Arrival time for each rep (reset)TS = zeros(1,r); % Terminal state number for each rep (reset) for k = 1:rR = zeros(1,ms); % Indicator for target state numbers R(E) = ones(1,ne); % reset for target state numberss = s1; T(1) = s;i = 1; while R(s) ~= 1 % While s is not a target state numberu = rand(1,1); s = ((A(s,:)<u)&(u<= B(s,:)))*MS'; i = i+1;T(i) = s; endS(k) = i-1; % i is the number of stages; i-1 is time TS(k) = T(i);end [ts,ft]= csort(TS,ones(1,r)); % ts = terminal state numbers ft = frequencies fts = ft/r; % Relative frequency of each ts[a,at] = csort(TS,S); % at = arrival time for each tsw = at./ft; % Average arrival time for each ts RES = [states(ts); fts; w]'; disp(' ')if r == 1 disp(['The arrival time is ',int2str(i-1),]) disp(['The state reached is ',num2str(states(ts)),]) N = 0:i-1;TR = [N;states(T)]';disp('To view the trajectory of states, call for TR') elsedisp(['The result of ',int2str(r),' repetitions is:'])disp('Term state Rel Freq Av time') disp(RES)disp(' ') [t,f]= csort(S,ones(1,r)); % t = arrival times f = frequencies p = f/r; % Relative frequency of each tdbn = [t; p]';AV = dot(t,p); SD = sqrt(dot(t.^2,p) - AV^2);MN = min(t); MX = max(t);disp(['The average arrival time is ',num2str(AV),])disp(['The standard deviation is ',num2str(SD),])disp(['The minimum arrival time is ',int2str(MN),])disp(['The maximum arrival time is ',int2str(MX),])disp('To view the distribution of arrival times, call for dbn') disp('To plot the arrival time distribution, call for plotdbn')end```

recurrence.m Assumes chainset has been run. Calculates repeatedly the recurrence time to a prescribed set of states, if initial state is in the set; otherwise calculatesthe arrival time.

```% RECURRENCE file recurrence.m Recurrence time to a set of states % Version of 1/2/96 Revised 7/31/97 for version 4.2 and 5.1% Calculates repeatedly the recurrence time % to a prescribed set of states, if initial% state is in the set; otherwise arrival time. % Assumes the procedure chainset has been run.r = input('Enter the number of repititions '); disp('The target state set is:')disp(e) st = input('Enter the initial state ');if ~isempty(st) s1 = MS(st==states); % Initial state numberelse s1 = 1;end clear T % Trajectory in state numbers (reset)S = zeros(1,r); % Recurrence time for each rep (reset) TS = zeros(1,r); % Terminal state number for each rep (reset)for k = 1:r R = zeros(1,ms); % Indicator for target state numbersR(E) = ones(1,ne); % reset for target state numbers s = s1;T(1) = s; i = 1;if R(s) == 1 u = rand(1,1);s = ((A(s,:)<u)&(u<= B(s,:)))*MS'; i = i+1;T(i) = s; endwhile R(s) ~= 1 % While s is not a target state number u = rand(1,1);s = ((A(s,:)<u)&(u<= B(s,:)))*MS'; i = i+1;T(i) = s; endS(k) = i-1; % i is the number of stages; i-1 is time TS(k) = T(i);end [ts,ft]= csort(TS,ones(1,r)); % ts = terminal state numbers ft = frequencies fts = ft/r; % Relative frequency of each ts[a,tt] = csort(TS,S); % tt = total time for each tsw = tt./ft; % Average time for each ts RES = [states(ts); fts; w]'; disp(' ')if r == 1 disp(['The recurrence time is ',int2str(i-1),]) disp(['The state reached is ',num2str(states(ts)),]) N = 0:i-1;TR = [N;states(T)]';disp('To view the trajectory of state numbers, call for TR') elsedisp(['The result of ',int2str(r),' repetitions is:'])disp('Term state Rel Freq Av time') disp(RES)disp(' ') [t,f]= csort(S,ones(1,r)); % t = recurrence times f = frequencies p = f/r; % Relative frequency of each tdbn = [t; p]';AV = dot(t,p); SD = sqrt(dot(t.^2,p) - AV^2);MN = min(t); MX = max(t); disp(['The average recurrence time is ',num2str(AV),]) disp(['The standard deviation is ',num2str(SD),]) disp(['The minimum recurrence time is ',int2str(MN),]) disp(['The maximum recurrence time is ',int2str(MX),]) disp('To view the distribution of recurrence times, call for dbn')disp('To plot the recurrence time distribution, call for plotdbn') end```

kvis.m Assumes chainset has been run. Calculates repeatedly the time to complete visits to a specified k of the states in a prescribed set.

```% KVIS file kvis.m Time to complete k visits to a set of states % Version of 1/2/96 Revised 7/31/97 for version 4.2 and 5.1% Calculates repeatedly the time to complete % visits to k of the states in a prescribed set.% Default is visit to all the target states. % Assumes the procedure chainset has been run.r = input('Enter the number of repetitions '); disp('The target state set is:')disp(e) ks = input('Enter the number of target states to visit ');if isempty(ks) ks = ne;end if ks>ne ks = ne;end st = input('Enter the initial state ');if ~isempty(st) s1 = MS(st==states); % Initial state numberelse s1 = 1;end disp(' ')clear T % Trajectory in state numbers (reset) R0 = zeros(1,ms); % Indicator for target state numbersR0(E) = ones(1,ne); % reset S = zeros(1,r); % Terminal transitions for each rep (reset)for k = 1:r R = R0;s = s1; if R(s) == 1R(s) = 0; endi = 1; T(1) = s;while sum(R)>ne - ks u = rand(1,1);s = ((A(s,:)<u)&(u<= B(s,:)))*MS'; if R(s) == 1R(s) = 0; endi = i+1; T(i) = s;end S(k) = i-1;end if r == 1disp(['The time for completion is ',int2str(i-1),])N = 0:i-1; TR = [N;states(T)]'; disp('To view the trajectory of states, call for TR')else [t,f]= csort(S,ones(1,r)); p = f/r;D = [t;f]';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')end```

plotdbn Used after m-procedures arrival or recurrence to plot arrival or recurrence time distribution.

```% PLOTDBN file plotdbn.m % Version of 1/23/98% Plot arrival or recurrence time dbn % Use after procedures arrival or recurrence% to plot arrival or recurrence time distribution plot(t,p,'-',t,p,'+')grid title('Time Distribution')xlabel('Time in number of transitions') ylabel('Relative frequency')```

are nano particles real
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
no can't
Lohitha
where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
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 simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
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?
what king of growth are you checking .?
Renato
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
A fair die is tossed 180 times. Find the probability P that the face 6 will appear between 29 and 32 times inclusive

#### Get Jobilize Job Search Mobile App in your pocket Now! By Janet Forrester By Mike Wolf By OpenStax By Sandhills MLT By Yasser Ibrahim By Madison Christian By OpenStax By Cath Yu By Brooke Delaney By OpenStax