Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Page M... coding: utf-8. #pylint: disables invalid-nane, no member, C0301, C0411, W0511 Semester 2, Assignment 1 Assignment Tasks: 4 Restrictions: Do not change anything outside

image text in transcribed
image text in transcribed
image text in transcribed
Page M... coding: utf-8". #pylint: disables invalid-nane, no member, C0301, C0411, W0511 Semester 2, Assignment 1 Assignment Tasks: 4 Restrictions: Do not change anything outside TODO blocks. Do not add pylint directives. Guidance: Define a function to generate random numbers with a PDF reflecting the angular intensity distribution behind a single suit and generate a plot comparing the histogram of a drawn sample with the PDF. The angular range is pi/2 to pi/2. Ensure that your program correctly evaluates sin(x)/x at x=0, which should yield 1. Task 2: Ensure that the PDF is normalized. Author of template: Wolfgang Theis School of Physics and Astronomy University of Birmingham import numpy as np import scipy interpolate as interpolate import scipy integrate as integrate import matplot lib.pyplot as plt # F wavelength and suit width in metres wavelength = 500e-9 slit width = 1500e-9 TODO: Assignment Task 1: define any additional functions you might need pass a End of Task 1: proceed to task 2. det slit pdf(alpha): w Calculate the value of the par at angles alpha Parameters alpha 1 float or numpy array of float angle(s) to evaluate the pdf at. angles are in radians. Returns pdf values: float or numpy array of float resulting value(s) of the pdf # TODO: Assignment Task 2: write function body pass 2 of 3 En poco B 23. det tv fra por (pdf function pof_range) ** cateutate rand values with given per Parters pat function function The Por function pof_range array odt range() is the seved in value for the randon values ifrangeli is the allowed man var for the rain valus Integer number of randon values to draw Heturns PV y array of float resulting anden van TODO: Assignment T write function by PESS End of Tank 3; proceed to take der generate platiti, bano) Create Patty labelled plot Madily the movided figure object to show histogram with error bare overlayed by the POF and return the rige. Paranter Formatolotto figure object to draw on tante per Ar of ples to use to generate the historia DAS Steer unter of bind to use to onerate the historian Retures rigi antplotti Figure figure object with fully labelled plot TOLOI Ansignment Task 41 write function Body End of Tank Further tasks def sain do everything fit.figure 19. venerate plot(fig. 10000, ) pit show pas 1 AIR Rain 3.7 - Coding assignment 1 Submit Assignment Due 13 Feb by 23:59 Points 100 Available until 8 May at 23:59 Submitting a file upload File types py This assignment asks you to write a function which generates random values for the angles at which photons are detected behind a single slit. In contrast to the example of the quadratic PDF, in the present case closed form integration is not a viable approach. Instead, the introduced numerical methods for integration and interpolation need to be employed. Please download v1 Semester 2Assignment 1.py, complete all TODO tasks and submit it. We mark your final pre- deadline submission Additional help is provided in video podcasts. The assignment template does not include any unittests in order to more accurately reflect programming tasks encountered when applying your computing skills outside of this computer lab. Feedback will be provided within one day of the submission deadline. Page M... coding: utf-8". #pylint: disables invalid-nane, no member, C0301, C0411, W0511 Semester 2, Assignment 1 Assignment Tasks: 4 Restrictions: Do not change anything outside TODO blocks. Do not add pylint directives. Guidance: Define a function to generate random numbers with a PDF reflecting the angular intensity distribution behind a single suit and generate a plot comparing the histogram of a drawn sample with the PDF. The angular range is pi/2 to pi/2. Ensure that your program correctly evaluates sin(x)/x at x=0, which should yield 1. Task 2: Ensure that the PDF is normalized. Author of template: Wolfgang Theis School of Physics and Astronomy University of Birmingham import numpy as np import scipy interpolate as interpolate import scipy integrate as integrate import matplot lib.pyplot as plt # F wavelength and suit width in metres wavelength = 500e-9 slit width = 1500e-9 TODO: Assignment Task 1: define any additional functions you might need pass a End of Task 1: proceed to task 2. det slit pdf(alpha): w Calculate the value of the par at angles alpha Parameters alpha 1 float or numpy array of float angle(s) to evaluate the pdf at. angles are in radians. Returns pdf values: float or numpy array of float resulting value(s) of the pdf # TODO: Assignment Task 2: write function body pass 2 of 3 En poco B 23. det tv fra por (pdf function pof_range) ** cateutate rand values with given per Parters pat function function The Por function pof_range array odt range() is the seved in value for the randon values ifrangeli is the allowed man var for the rain valus Integer number of randon values to draw Heturns PV y array of float resulting anden van TODO: Assignment T write function by PESS End of Tank 3; proceed to take der generate platiti, bano) Create Patty labelled plot Madily the movided figure object to show histogram with error bare overlayed by the POF and return the rige. Paranter Formatolotto figure object to draw on tante per Ar of ples to use to generate the historia DAS Steer unter of bind to use to onerate the historian Retures rigi antplotti Figure figure object with fully labelled plot TOLOI Ansignment Task 41 write function Body End of Tank Further tasks def sain do everything fit.figure 19. venerate plot(fig. 10000, ) pit show pas 1 AIR Rain 3.7 - Coding assignment 1 Submit Assignment Due 13 Feb by 23:59 Points 100 Available until 8 May at 23:59 Submitting a file upload File types py This assignment asks you to write a function which generates random values for the angles at which photons are detected behind a single slit. In contrast to the example of the quadratic PDF, in the present case closed form integration is not a viable approach. Instead, the introduced numerical methods for integration and interpolation need to be employed. Please download v1 Semester 2Assignment 1.py, complete all TODO tasks and submit it. We mark your final pre- deadline submission Additional help is provided in video podcasts. The assignment template does not include any unittests in order to more accurately reflect programming tasks encountered when applying your computing skills outside of this computer lab. Feedback will be provided within one day of the submission deadline

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions

Question

List the 10 main sections of the systems proposal.

Answered: 1 week ago