EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
Bartleby Related Questions Icon

Related questions

Question
100%

Please show the code for each part of this assignment using python in a jupyter notebook. The data file previoulsy used that is referenced in the first part is included

1. Using the data file used previously, make a histogram of the number of muons passing
through the muon detector per second. You can limit the displayed histogram to be
between 0 and 18, inclusive. Remember that the data records are recorded every second
and that for any record whose first value is 40,000 or above, the amount that exceeds
40,000 tells you how many muons per second passed completely though the dector. For
example, 400002 means 2 muons passed throiuhg the detector in the second described
by the secod integer of the same data record. Ignore records whoe first integer is below
40,000. You worked already on this task in class.
2. Now fit this histogram withal a poisson distriibution taking care to fit to the center
of the bins as described in class. Your plot should contain the histogram, data points
and a curve through the the data points. Determine the value (lambda) from the fit and
its corresponding uncertainty. For our poisson distribution, lambda tells you the mean
number of passing muons per second.
3. Calculate 200-230 prime numbers starting from 3. Plot the the values of the primes
as a function of their ordinal number. For example, th prime 3 corresponds to 1, 5 to
2, 7 to 3, and so on. You can use your own code or a built-in method to determine the
primes. Place the primes in an array and print the array so we can verify you did the
calculation correctly. DO NOT print out the primes line by line or your pdf will be a
mile long.
4. Plot the primes as a function of their ordinal number. For example, th prime 3
corresponds to 1, 5 to 2, 7 to 3, and so on. This plot will have a curvatue to it. Fit
the plot with a line, a quadratic and a cubic. What are the vales of each paramter
in those cruves and their uncertainties? What do you think is the best fit, accounting
foruncertainty and simplicity of the curve?
expand button
Transcribed Image Text:1. Using the data file used previously, make a histogram of the number of muons passing through the muon detector per second. You can limit the displayed histogram to be between 0 and 18, inclusive. Remember that the data records are recorded every second and that for any record whose first value is 40,000 or above, the amount that exceeds 40,000 tells you how many muons per second passed completely though the dector. For example, 400002 means 2 muons passed throiuhg the detector in the second described by the secod integer of the same data record. Ignore records whoe first integer is below 40,000. You worked already on this task in class. 2. Now fit this histogram withal a poisson distriibution taking care to fit to the center of the bins as described in class. Your plot should contain the histogram, data points and a curve through the the data points. Determine the value (lambda) from the fit and its corresponding uncertainty. For our poisson distribution, lambda tells you the mean number of passing muons per second. 3. Calculate 200-230 prime numbers starting from 3. Plot the the values of the primes as a function of their ordinal number. For example, th prime 3 corresponds to 1, 5 to 2, 7 to 3, and so on. You can use your own code or a built-in method to determine the primes. Place the primes in an array and print the array so we can verify you did the calculation correctly. DO NOT print out the primes line by line or your pdf will be a mile long. 4. Plot the primes as a function of their ordinal number. For example, th prime 3 corresponds to 1, 5 to 2, 7 to 3, and so on. This plot will have a curvatue to it. Fit the plot with a line, a quadratic and a cubic. What are the vales of each paramter in those cruves and their uncertainties? What do you think is the best fit, accounting foruncertainty and simplicity of the curve?
In [12]: #Problem 3
from numpy.random import random
tnp. linspace (-1, 1, 201)
plt.subplot(2, 2, 1); plt.hist (random(500) 21, t)
plt.subplot(2, 2, 2); plt.plot(t, t**2, t, t**3 - t)
plt.subplot(2, 2, 3); plt.scatter ((random (100)
plt.subplot(2, 2, 4); plt.plot(t
plt.suptitle('Data Visualization')
2) -1, (random(100) * 2)
np.cos (10 *t), tnp.sin(10 * t))
Out [12]: Text (0.5, 0.98, 'Data Visualization')
ttps://hpc.m3.smu.edu/node/c002/8909/lab/tree/saltzman_hw2.ipynb
0/3/24, 4:35 PM
In []:
8
6
4
saltzman_hw2
Data Visualization
1.0
0.5
0.0
2
0
-1.0 -0.5
0.0
0.5
1.0
-1.0 -0.5 0.0
0.5
1.0
1.0
0.75
0.50
0.5
0.25
0.0
0.00
-0.5
+0.25
0.50
-1.0
-1.0
-0.5
0.0
0.5
1.0
-1.0
-0.5
0.0
0.5
1.0
expand button
Transcribed Image Text:In [12]: #Problem 3 from numpy.random import random tnp. linspace (-1, 1, 201) plt.subplot(2, 2, 1); plt.hist (random(500) 21, t) plt.subplot(2, 2, 2); plt.plot(t, t**2, t, t**3 - t) plt.subplot(2, 2, 3); plt.scatter ((random (100) plt.subplot(2, 2, 4); plt.plot(t plt.suptitle('Data Visualization') 2) -1, (random(100) * 2) np.cos (10 *t), tnp.sin(10 * t)) Out [12]: Text (0.5, 0.98, 'Data Visualization') ttps://hpc.m3.smu.edu/node/c002/8909/lab/tree/saltzman_hw2.ipynb 0/3/24, 4:35 PM In []: 8 6 4 saltzman_hw2 Data Visualization 1.0 0.5 0.0 2 0 -1.0 -0.5 0.0 0.5 1.0 -1.0 -0.5 0.0 0.5 1.0 1.0 0.75 0.50 0.5 0.25 0.0 0.00 -0.5 +0.25 0.50 -1.0 -1.0 -0.5 0.0 0.5 1.0 -1.0 -0.5 0.0 0.5 1.0
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT