Question

In: Statistics and Probability

In this project we will consider a particle sitting at the origin inside of a square...

In this project we will consider a particle sitting at the origin inside of a square whose sides intersect at the points (-10, -10), (-10, 10), (10, -10), and (10, 10). Each second, the particle moves in a random direction a random distance. That distance has an X as well as a Y component, each of which are standard normally distributed.

1.1 [8 points] Use R-Studio to model the following scenario: the particle moves every second as described above, use your code to model that motion until the particle steps out of bound “FOR THE FIRST TIME” then stop counting the steps.

1.2 [5 points] Repeat this simulation 1,000 times and store the number of steps in a matrix, then calculate the mean number of steps needed for the particle to step out of bounds, the median and the standard deviation.

1.3 [4 points] Plot a box plot and a histogram of the number of steps of all replications.

1.4 [3 points] Using the last simulation run, trace the motion of that particle using a line plot. What where the coordinates of the particle when it stepped out of bound.

Solutions

Expert Solution

1.1]

#Initial co-ordinates
x=0
y=0
z<-c(0,0) #Origin(al) co-ordinates of particle stored in vector
#Simulate x and y co-orindates until the particle is out of bounds
while(x<10 & x>-10 & y<10 & y>-10)
{
x<-x + rnorm(1)
y<-y + rnorm(1)
l<-c(x,y)
z<-c(z,c(l))
  
}
print(z) #This is the vector which has the path of co-ordinates the particle takes

1.2]


#Simulating x and y co-ordinates 1000 times
a=0;

while(a<1001)
{
a<-a+1
x=0
y=0
z<-c(0,0) #Origin(al) co-ordinates of particle stored in vector


while(x<10 & x>-10 & y<10 & y>-10)
{
  
x<-x + rnorm(1)
y<-y + rnorm(1)
l<-c(x,y)
z<-c(z,c(l))
  
}
q<-c(q,length(z))# storing no.of steps after which particle was out of bounds
  
}

print(mean(q))# printing mean and standard deviation of vector q which has the no.of steps the particles takes to go out of bounds in each of the 1000 simulation
print(sd(q))

1.3] boxplot(q,
main = "Mean no.of steps for particle to go our of bounds",
xlab = "Steps",
ylab = "Particle",
col = "orange",
border = "brown",
horizontal = TRUE,
notch = TRUE
)

hist(q)

1.4] plot(X,Y)
   lines(X,Y,type="l") #syntax for plotting path of particle

Path of Particle


Related Solutions

A +7.50 μC point charge is sitting at the origin.
A +7.50 μC point charge is sitting at the origin. What is the radial distance between the 500 V equipotential surface and the 1000 V surface? What is the distance between the 1000 V surface and the 1500 V surface?  
Consider a particle of mass ? in an infinite square well of width ?. Its wave...
Consider a particle of mass ? in an infinite square well of width ?. Its wave function at time t = 0 is a superposition of the third and fourth energy eigenstates as follows: ? (?, 0) = ? 3i?­3(?)+ ?­4(?) (Find A by normalizing ?(?, 0).) (Find ?(?, ?).) Find energy expectation value, <E> at time ? = 0. You should not need to evaluate any integrals. Is <E> time dependent? Use qualitative reasoning to justify. If you measure...
5. Consider a particle in a two-dimensional, rigid, square box with side a. (a) Find the...
5. Consider a particle in a two-dimensional, rigid, square box with side a. (a) Find the time independent wave function φ(x,y)describing an arbitrary energy eigenstate. (b)What are the energy eigenvalues and the quantum numbers for the three lowest eigenstates? Draw the energy level diagram
Consider a particle in an infinite square well, but instead of having the well from 0...
Consider a particle in an infinite square well, but instead of having the well from 0 to L as we have done in the past, it is now centered at 0 and the walls are at x = −L/2 and x = L/2. (a) Draw the first four energy eigenstates of this well. (b) Write the eigenfunctions for each of these eigenstates. (c) What are the energy eigenvalues for this system? (d) Can you find a general expression for the...
Particle A of charge 3.25 ✕ 10−4 C is at the origin, particle B of charge...
Particle A of charge 3.25 ✕ 10−4 C is at the origin, particle B of charge −6.20 ✕ 10−4 C is at (3.98 m, 0) and particle C of charge 1.25 ✕ 10−4 C is at (0, 3.38 m). (a) What is the x-component of the electric force exerted by A on C? N (b) What is the y-component of the force exerted by A on C? N (c) Find the magnitude of the force exerted by B on C....
Particle A of charge 3.25 ✕ 10−4 C is at the origin, particle B of charge...
Particle A of charge 3.25 ✕ 10−4 C is at the origin, particle B of charge −6.20 ✕ 10−4 C is at (3.98 m, 0) and particle C of charge 1.25 ✕ 10−4 C is at (0, 3.38 m). (e) Calculate the y-component of the force exerted by B on C. N (f) Sum the two x-components to obtain the resultant x-component of the electric force acting on C. N (g) Repeat part (f) for the y-component. N (h) Find...
Particle A of charge 2.97 10-4 C is at the origin, particle B of charge -5.58...
Particle A of charge 2.97 10-4 C is at the origin, particle B of charge -5.58 10-4 C is at (4.00 m, 0), and particle C of charge 1.10 10-4 C is at (0, 3.00 m). We wish to find the net electric force on C. (a) What is the x component of the electric force exerted by A on C? N (b) What is the y component of the force exerted by A on C? N (c) Find the...
A particle of charge -q1 is at the origin of an x axis. (a) At what...
A particle of charge -q1 is at the origin of an x axis. (a) At what location on the axis should a particle of charge -36q1 be placed so that the net electric field is zero at x = 4.8 mm on the axis? (b) If, instead, a particle of charge +36q1 is placed at that location, what is the direction (relative to the positive direction of the x axis) of the net electric field at x = 4.8 mm?
The force exerted by an electric charge at the origin on a charged particle at a...
The force exerted by an electric charge at the origin on a charged particle at a point (x, y, z) with position vector r = <x, y, z> is F(r) = Kr/|r|3 where K is a constant. Find the work done as the particle moves along a straight line from (3, 0, 0) to (3, 4, 5).
A +7.50 μC point charge is sitting at the origin. What is the radial distance between...
A +7.50 μC point charge is sitting at the origin. What is the radial distance between the 500 V equipotential surface and the 1000 V surface? What is the distance between the 1000 V surface and the 1500 V surface?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT