PHYS2160 – Lab 6: Advanced Plotting and SciPy Solved

$ 20.99
Category:

Description

Exercise 1: Wave Function for a 2D Infinite Square Well
AIM:
The normalized wave functions for a particle in a 2D infinite square well located in the region 0  x  L, 0  y  L are
2 mx ny
m,n(x, y) = sin ( ) sin ( )
L L L

where (x, y) is the position of the particle, m = 1, 2, 3, … and n = , 2, 3, … are the quantum numbers of the state. Write a Python program that uses the matplotlib module to make the 3D surface plot and the 3D wireframe plot of the wave function 4,3(x, y) over the region 0  x  L, 0  y  L sideby-side inside the same figure.
ALGORITHM:

PROGRAM:

OUTPUT:

Exercise 2: Mass, Center of Mass, and Moment of Inertia of a Laminar
AIM:
For a lamina occupying a region D in the x-y plane with mass density (x, y), the mass M, the center of mass (xcm, ycm), as well as the moment of inertia about the x-axis Ix and about the y-axis Iy are given by the double integrals

M = ∬ 𝜎(x, y) dA,
D

xcm =dA, ycmy 𝜎(x, y) dA,
DD

Ix = ∬ y2 𝜎(x, y) dA, Iy = ∬ x2 𝜎(x, y) dA.
D D

Write a Python program that uses the scipy.integrate function dblquad to compute M, xcm, ycm, Ix, and Iy for a lamina occupying the region 0  x  2, 0  y  xe−x with mass density (x, y) = x2y2 and then outputs the results. Assume all the quantities are expressed in SI units.
ALGORITHM:

PROGRAM:

OUTPUT:

Exercise 3: Series LRC Circuit
AIM:
A series LRC circuit is composed of an inductor of inductance L, a resistor of resistance R, and a capacitor of capacitance C connected in series with an alternating emf (t). It can be shown that the charge q on the capacitor obeys the differential equation:
d2q dq q
L 2 + R + = (t) dt dt C
where the current in the circuit I(t) = q(t). Write a Python program to solve this equation subject to the initial conditions q(0) = 0 C, I(0) = 6 A from time t = 0 to 5s for the case L = 0.5 H, R = 20 , C
= 0.001 F, and (t) = 100 sin 60t V by using the scipy.integrate.odeint method. Your program should also use the matplotlib module to plot the numerical solutions of q(t) and I(t) versus t as separate plots sharing the same horizontal axis.
ALGORITHM:

PROGRAM:

OUTPUT:

Exercise 4: Legendre Polynomial
AIM:
Below is a table listing the data set drawn from the Legendre polynomial of degree 4, P4(x), with some noise added.
x −1.0 −0.8 −0.6 −0.4 −0.2 0
y 0.91695 −0.19706 −0.29293 −0.04645 0.24494 0.44410
x 0.2 0.4 0.6 0.8 1.0
y 0.31141 -0.04369 −0.42651 −0.39541 1.14994
Write a Python program that uses the scipy.optimize function curve_fit to fit the data set to a degree-4 polynomial of x with the initial guesses of all fitting parameters set to 1, prints out the fitting parameters, as well as plots the data set, fitting result, and the polynomial P4(x) on the same graph using the matplotlib module and the scipy.special function eval_legendre.
ALGORITHM:

PROGRAM:

OUTPUT:

Reviews

There are no reviews yet.

Be the first to review “PHYS2160 – Lab 6: Advanced Plotting and SciPy Solved”

Your email address will not be published. Required fields are marked *