You are on page 1of 1

Training Assignment 11 – Tue 2015-05-12

NUMA22: Computational Mathematics


Claus Führer, Alexandros Sopasakis

This assignment has 2 tasks.

Task 1

Consider two alternative ways to evaluate Chebychev polynomials Ti (x).


Using the definition: Ti (x) = cos(i arccos(x)) or alternatively using the recursion
formula Ti+1 (x) = 2xTi (x) − Ti−1 (x), T0 (x) = 1, T1 (x) = x.
Which alternative is cheaper? Evaluate the expressions for x = 0.55 and measure
the evaluation time by using the timeit module. Plot the execution time versus
i ranging between 1 and 20.

Task 2

Consider your code from Homework 1. Write a test class (unittest) to test
• a correct result for a problem of your choice
• that the integral of a positive function is positive
• that the integral is zero if the integration interval is empty
• that incorrect input is handled by proper exception handling.

You might also like