1.2 1) Chebyshev polynomials
Chebyshev polynomials are namea after Patnuty Chebyshev (sometimes written as
Tschebyschev). They are solutions to the Chebyshev differential equations
The Chebyshev polynomials of the first kind can be defined by the recurrence relation
T1(x) = X
In+1(x)=2xTn(x)-In-1(x). = -
Task 1a: write a function to evaluate the Chebyshev polynomials using only core Python and
the "math" module (ie. don't just call a library function for this task).
Your function should be defined so that it can be called as follows:
y = Chebyshev1_recur(x,1
In other words, if the degree n and a single value X are provided, then a single value equal to
Tn (x) should be returned.
Task 1b: use your Chebyshev1_recur function to generate a good quality figure displaying the
first six (n=0 to 5) Chebyshev polynomials plotted between x=-1 and x=+1.
1.3 2) Orthogonality
Chebyshev polynomials of the first kind are orthogonal over the range [-1, +1]. This means that
the weighted integral inner product is given by
x² dx = 7t n m 0
where the Kroneker delta function 81.) is 1 if i = j and zero otherwise.
Task 2: Use numerical integration to calculate the weighted integral inner product for n =
N and m = 1,2, n. Tabulate the results for N = 5 and then determine the maximum
value of N which you can handle in a reasonable amount of time.
1.4 3) Lissajous figures
In mathematics, a Lissajous curve
is the graph of a system of parametric equations
y = B sin (bt)
The appearance of the figure is highly sensitive to the ratio a/b. Rational ratios produce closed
(connected) or "still" figures, while irrational ratios produce figures that appear to rotate.
Assume that A = B = 1, a = 3, and b = 7.
Task 3a: Plot x versus y starting at t = 0 and continuing until the pattern starts to repeat.
Task 3b: If x(t) and y(t) give the location of an object in the X, y plane, what is the maximum
speed of the object (t) ? At which time t does it occur?
1.5 4) Everything is connected
For Lissajous figures where A = B = 1, a = 1, b = N (N is a natural number) and
N - 1 TT
8 = N 2
it can be shown that y(x) are Chebyshev polynomials of the first kind with degree N.
Task 4: Check this claim. Start by considering the following x-values for n = 5.
Xk = cos 2k-1 2n 7T , k = 1,
Create a table with the results eg.
and discuss them. Briefly describe other ways that you might check to see if y(x) are Cheby-
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction
of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.
import math # Importing math Python module
import numpy as np # Importing numpy module
from scipy.misc import derivative # Importing derivative function from scipy
def Chebyshev1_recur(x, n):
This function evaluates Chebyshev polynomial recursively
:param x: x - value for which chebyshev needs to be evaluated
:param n: n - value for which chebyshev needs to be evaluated
:return: T_n(x) based on the recurrence relation i.e the value of chebyshev polynomial of degree 'n' at 'x'
if n == 0:
# If n = 0 return 1
elif n == 1:
# If n = 1 return x
# Else return recurrence relation
return 2 * x * Chebyshev1_recur(x, n - 1) - Chebyshev1_recur(x, n - 2)
def chebyshev1(n, start, stop, no_of_steps):
This function calculates the chebyshev function of order 'n' from
'start' till 'stop' for a given number of steps('no_of_steps')
:param n: n - value for which chebyshev needs to be evaluated i.e the order of chebyshev polynomial
:param start: Start value for evaluation of chebyshev polynomial values
:param stop: Stop value for evaluation of chebyshev polynomial values
:param no_of_steps: Number of steps for evaluation of chebyshev polynomial values
:return: A tuple containing points of evaluation of chebyshev and evaluated chebyshev value of order 'n'
# Create an ndarray between start and stop with no_of_steps points using linspace
X = np.linspace(start, stop, no_of_steps)
# Calculate chebyshev on all points for given 'n'
Y = [Chebyshev1_recur(x, n) for x in X]
return X, Y
def weighed_integral_inner_product(x, m, n):
This function calculates the weighed inner product function
:param x: x - value for which weighed inner product needs to be evaluated
:param m: m - value for which weighed inner product needs to be evaluated
:param n: n - value for which weighed inner product needs to be evaluated
:return: Weighed inner product at 'x' for order 'm' and 'n'
# Compute the weighed integral inner product