MATLAB Programming I need help with question 1 and 2 (b) (1) Given n number of d
ID: 642405 • Letter: M
Question
MATLAB Programming
I need help with question 1 and 2 (b)
(1) Given n number of dice to throw each time, and the probability of not getting even a single six or there is at least 2 odd numbers. Estimate the probability by performing a single computer simulation involving a suciently large number of points so that the result is likely correct to three significant figures.
(2) Monte Carlo simulation is based on random sampling of the appropriate parameter space.The ability to produce random points within a given region in parameter space eciently is very important. Here we want to produce random points that are distributed uniformly inside a given parallelogram in 2-dimensional space. We can always choose the origin to be located at one of the vertices of the given parallelogram. Then the parallelogram is completely speci ed by giving two vectors, v1 and v1, that de ne two of its adjacent sides .Any point within the parallelogram can be expressed in the form r1v1 + r2v1 with r1 and r2 both inside the interval (0; 1). Therefore we can generate random points distributed uniformly within the parallelogram by using values from a random number generator. In this problem, the components of the two vectors are to be entered one vector at a time from the keyboard during run-time by the user. If the x- and y-coordinates of these points are in the vectors Xvec and Yvec, respectively, then these random points can be plotted point-by-point using the statement plot(Xvec,Yvec,'.'); axis equal; Use about one thousand points so that they almost cover up the entire parallelogram.
(b)Then if r1 > 1??r2 then we replace it by the point (1-??r1)v1 +(1-??r2)v1, otherwise leave the point unchanged. The resulting points will all lie within the triangle with one vertex at the origin and with two sides de ned by the two vectors v1 and v2.
Explanation / Answer
1.) Given a number of dice to throw each time,and the probability of not getting even a single six and there is atleast two odd numbers is,
This is a very complicated method and it is advantageous of being applicable to problems with more than two events.Here is the calculation in the present case and the probability of not getting even a single six probability is defined as
(not getting a 6) AND (not getting a head)
This follows because you did not get a 6 and you did not get a head.
The probability of not getting a six is 1-1/6=5/6
The probability of not getting a head is 1-1/2=1/2
The probability of not getting a six and a head is 5/6*1/2=5/12.This is therefore probability of not getting a six and a head.
The probability by performing a single computer solution:
A computer simulation is a simulation performing on a single computer is to reproduce behaviour of a system.This simulation uses a abstract model.Computer simulations have become a useful part of mathemetical modelling.
The probability by performing a simulation on a single computer is very advantage decreases the computers and the number of computers can be connected.Many scientists worked on this task and proved that simulation on a single computer gives a better result and the probability p(f) increases.
Algorithm:
1.) Initialization:Initialize the number of molecules in the system,reactoin constants and the random number generators.
2.) Monte carlo step:Genearte random numbers to determine the next reaction to occur as well as the time interval.The probability of given reaction to be choosen is proportional to the number of substrate molecules.
3.) Update: Increase the time step by the randomly generated time in step2.Update the molecule count based on the reaction that occured.
4.) Iterate: Go back to step 2 unless the number of reactants is zero or the simulation time has been exceeded.
The algorithm is computationally expensive and thus many modifications and adaptions exist,including the next reaction method.The computational cost of exact versions of the algorthim is determined by the coupling class of the reaction network.
2b.)Given condition r1>1??r2 it is replaced by (1-??r1)v1+(1-??r2)v1
let us consider (1-(1-v2)r1)v1+(1-(1-v2)r2)v1
=(1-(r1-r1v2))v1+(1-(r2-v2r2))v1
=(v1-(v1r1-r1v1v2))+(v1-(v1r2-v1v2r2))
=(v1-v1r1+r1v1v2)+(v1-v1r2+v1v2r2)
=v1-v1r1+r1v1v2+v1-v1r2+v1v2r2
=2v1-v1(r1+r2)+v1v2(r1+r2)
=2v1+v1v2(r1+r2)-v1(r1+r2).
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.