-] Problem 5 Full Width at Half Maximum(FWHM). Distribution width is a very important quantity. It tells you how wide a the distribution is. One way to do that is to use a quantity called full-width half max This is the width of the distribution at half maximum. For example for distribution shown below the maximum is at x=0.0 and y=1.0 The maximum of this distribution is 1.0. So we are interested in the width of the distribution when the value of the distribution is 1.0/2=0.5 The width of the distribution is shown in black line. In this case it's about 2.35 import math def demo(x): 1 2 3 4 x = np.linspace (-3,3) 5 return math.exp(-x**2/2.0) y = [demo(xx) for xx in x] 6 plt.plot(x,y) 7 plt.axhline (0.5, color='red') 8 9 plt.axvline (2.355/2,color='red',linestyle= 'dashed') 10 plt.axvline (-2.355/2, color='red', linestyle= 'dashed') 11 12 plt.grid() 13 plt.annotate( 14 15 16 '', xy=(-2.355/2, 0.4), xycoords='data', xytext=(2.355/2, 0.4), textcoords='data', arrowprops={'arrowstyle': '<->'}) 17 plt.text(0,0.3, 'FWHM',horizontalalignment ='center') 10- 0.8 0.6 0.4 0.2 0.0 -2 FWHM ✓ ✓ 5.1)Find FWHM of the following function. Make sure the bound on error of the FWHM is less than 10-4. 1 import math mu = 2.345 return gamma/((x-mu)**2+gamma**2) 2 def f(x, gamma=3.1): 3 4 5 6 y = [f(xx) for xx in x] x = np.linspace (-10,10,200) [25] 7 plt.plot(x,y) ... ... [] 0.30- 0.25 0.20 0.15 0.10 0.05- -10.0 -7.5 -5.0 -2.5 0.0 2.5 5.0 7.5 10.0 5.2) Plot FWHM(y-axis) as a function of (gamma) from y = 0.5... 3. Make sure you have at least 30 points. 1 print(f(1.0, gamma-0.2)) # you may find this useful [26] ... 0.108165114047 [ ] 5.3) (Optional) Prove the relation you found in 5.2) 1
-] Problem 5 Full Width at Half Maximum(FWHM). Distribution width is a very important quantity. It tells you how wide a the distribution is. One way to do that is to use a quantity called full-width half max This is the width of the distribution at half maximum. For example for distribution shown below the maximum is at x=0.0 and y=1.0 The maximum of this distribution is 1.0. So we are interested in the width of the distribution when the value of the distribution is 1.0/2=0.5 The width of the distribution is shown in black line. In this case it's about 2.35 import math def demo(x): 1 2 3 4 x = np.linspace (-3,3) 5 return math.exp(-x**2/2.0) y = [demo(xx) for xx in x] 6 plt.plot(x,y) 7 plt.axhline (0.5, color='red') 8 9 plt.axvline (2.355/2,color='red',linestyle= 'dashed') 10 plt.axvline (-2.355/2, color='red', linestyle= 'dashed') 11 12 plt.grid() 13 plt.annotate( 14 15 16 '', xy=(-2.355/2, 0.4), xycoords='data', xytext=(2.355/2, 0.4), textcoords='data', arrowprops={'arrowstyle': '<->'}) 17 plt.text(0,0.3, 'FWHM',horizontalalignment ='center') 10- 0.8 0.6 0.4 0.2 0.0 -2 FWHM ✓ ✓ 5.1)Find FWHM of the following function. Make sure the bound on error of the FWHM is less than 10-4. 1 import math mu = 2.345 return gamma/((x-mu)**2+gamma**2) 2 def f(x, gamma=3.1): 3 4 5 6 y = [f(xx) for xx in x] x = np.linspace (-10,10,200) [25] 7 plt.plot(x,y) ... ... [] 0.30- 0.25 0.20 0.15 0.10 0.05- -10.0 -7.5 -5.0 -2.5 0.0 2.5 5.0 7.5 10.0 5.2) Plot FWHM(y-axis) as a function of (gamma) from y = 0.5... 3. Make sure you have at least 30 points. 1 print(f(1.0, gamma-0.2)) # you may find this useful [26] ... 0.108165114047 [ ] 5.3) (Optional) Prove the relation you found in 5.2) 1
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
%matplotlib inline
import math
import numpy as np
from matplotlib import pyplot as plt
import math
def demo(x):
return math.exp(-x**2/2.0)
x = np.linspace(-3,3)
y = [demo(xx) for xx in x]
plt.plot(x,y)
plt.axhline(0.5, color='red')
plt.axvline(2.355/2,color='red',linestyle='dashed')
plt.axvline(-2.355/2,color='red',linestyle='dashed')
plt.grid()
plt.annotate(
'', xy=(-2.355/2, 0.4), xycoords='data',
xytext=(2.355/2, 0.4), textcoords='data',
arrowprops={'arrowstyle': '<->'})
plt.text(0,0.3,'FWHM',horizontalalignment ='center')
5.1
import math
def f(x, gamma=3.1):
mu = 2.345
return gamma/((x-mu)**2+gamma**2)
x = np.linspace(-10,10,200)
y = [f(xx) for xx in x]
plt.plot(x,y)
5.2
print(f(1.0, gamma=0.2)) # you may find this useful
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education