Problem set#MP3
Problem set#MP3
Exercise 1.1: Write a Python program to create a complex number and access its real and
imaginary parts. Calculate and display the modulus and conjugate of given complex number.
Perform addition, subtraction, multiplication, and division of two complex numbers. Display
and verify you results.
Exercise 1.2: Use a Python library like Matplotlib to plot complex numbers as ordered pairs
of real numbers in a plane. Write a Python function to convert a complex number from
Cartesian to polar representation and vice versa. Verify your results.
Exercise 1.3: Write a Python program to calculate the powers of each complex number in polar
form. Find z4 when z=2 cis (70∘). Find z2 when z=5 cis (3π/4). Print your results in both
Cartesian and polar forms and verify.
Exercise 1.4: Write a Python program to calculate the nth roots of a complex number. Evaluate
the cube root of z when z=64 cis (210∘). Evaluate the square root of z when z=25 cis (3π/2).
Display the roots in both Cartesian and polar forms. Verify your results.
Exercise 1.5: Implement a Python program to perform translation, scaling, rotation, and
reflection operations on a complex number representing a 2-D vector. Display the resulting
vectors after each transformation. Do the same set of operations on a rectangle / a triangle in
complex plane.
Exercise 1.6: Choose an elementary complex function (e.g., identity, exponential, square,
absolute) and implement it as a Python function. Create a visualization that maps points from
the z-plane to the w-plane using the chosen complex function. Plot the original points in the z-
plane using colour scheme of their mapped points of the w-plane.
Problem set#2
Exercise 2.1: Write a Python program to find the following definite integral using Gauss
Legendre quadrature.
2
∫ 𝑥 5 𝑑𝑥
0
Tabulate your integral value with number of quadrature points. Compare the results obtained
using inbuild function.
Exercise 2.2: Write a Python program to find the following definite integral using Gauss
Legendre quadrature.
3
∫ (𝑥 2 + 3𝑥 − 5)𝑑𝑥
0
Tabulate your integral value with number of quadrature points. Compare the results obtained
using inbuild function.
Exercise 2.3: Write a Python program to find the following definite integral using Gauss
Legendre quadrature.
3
∫ 𝑥 5 𝑑𝑥
0
Tabulate your integral value with number of quadrature points. Compare the results obtained
using inbuild function.
Exercise 2.4: Write a Python program to solve the following improper integral over the entire
real axis using Gauss Legendre quadrature.
∞
1 2
∫ 2
𝑒 −𝑥 𝑑𝑥
−∞ 1 + 𝑥
Tabulate your integral value with number of quadrature points. Compare the results obtained
using inbuild function.
Exercise 2.5: Write a Python program to solve the following improper integral over the positive
real axis using Gauss Laguerre quadrature.
∞
1
∫ 𝑒 −𝑥+2 𝑑𝑥
0 1 + 𝑥2
Tabulate your integral value with number of quadrature points. Compare the results obtained
using inbuild function. Note: Apply the method to a function with an exponential weight.
Exercise 2.6: Write a Python program to solve the following improper integral over the positive
real axis using Gauss Laguerre quadrature.
∞
∫ 𝑥 5 𝑒 −𝑥+2.2 𝑑𝑥
0
Tabulate your integral value with number of quadrature points. Compare the results obtained
using inbuild function. Note: Apply the method to a function with an exponential weight.
Exercise 2.7: Write a Python program to solve the following improper integral over the entire
real axis using Gauss Hermite quadrature.
∞
1 2
∫ 2
𝑒 −𝑥 𝑑𝑥
−∞ 1 + 𝑥
Tabulate your integral value with number of quadrature points. Compare the results obtained
using inbuild function. Note: Apply the method to a function with a Gaussian weight.
Exercise 2.8: Write a Python program to solve the following improper integral over the entire
real axis using Gauss Hermite quadrature.
∞
2 −1
∫ 𝑥 4 𝑒 −𝑥 𝑑𝑥
−∞
Tabulate your integral value with number of quadrature points. Compare the results obtained
using inbuild function. Note: Apply the method to a function with a Gaussian weight.
Problem set#3
Exercise 3.1: Write a Python program to compute the Discrete Fourier Transform (DFT) of a
given sequence using complex numbers. Apply the DFT to a sample sequence and display the
magnitude and phase spectra.
Exercise 3.2: Find the FFT implementation of two sample sequences of different lengths and
compare the results with the DFT implementation.
Exercise 3.3: Write a Python program to calculate the FFT of a given mathematical function
(e.g., exp(-x2)) using numerical methods and tabulate the results. Plot the original function and
its frequency spectrum obtained from the FFT.
Exercise 3.4: Generate a synthetic signal composed of multiple sinusoidal components with
noise. Apply FFT to analyze the frequency content of the signal and identify the frequencies of
the individual sinusoids.
Problem set#4
Exercise 4.1: Write a Python program to solve given two-point BVP using the Finite Difference
Method.
𝑑 2 𝑦(𝑥) 𝜋 𝜋
2
+ 𝑦(𝑥) = 0, 0 ≤ 𝑥 ≤ , 𝑦(0) = 1, 𝑦 ( ) = 1
𝑑𝑥 2 2
Also plot your numerical solution and match it with analytic solution.
Exercise 4.2: Write a Python program to solve a simple two-point BVP using the Finite
Difference Method.
𝑑 2 𝑦(𝑥) 𝜋 𝜋
2
+ 𝑦(𝑥) = 0, 0 ≤ 𝑥 ≤ , 𝑦(0) = 1, 𝑦 ( ) = 3
𝑑𝑥 2 2
Also plot your numerical solution and match it with analytic solution.
Exercise 4.3: Write a Python program to solve a simple two-point BVP using the Finite
Difference Method.
𝑑 2 𝑦(𝑥)
= 𝑦(𝑥), 0 ≤ 𝑥 ≤ 1, 𝑦(0) = 1, 𝑦 ′ (1) = 0
𝑑𝑥 2
Also plot your numerical solution and match it with analytic solution.
Exercise 4.4: Write a Python program to solve a simple two-point BVP using the Finite
Difference Method.
𝑑 2 𝑦(𝑥)
= 𝑦(𝑥), 0 ≤ 𝑥 ≤ 1, 𝑦(0) = 0, 𝑦(1) = 1
𝑑𝑥 2
Also plot your numerical solution and match it with analytic solution.