# Problem set 9

## Problems from the textbook

These are from the 10th edition of the book; see the scans if you have another.

## Old exam problems

The following old exam problems are taken from TMA4135, a course that is almost identical to TMA4123/TMA4125. The problems could just as well have been from a TMA4123/TMA4125 exam.

## Programming problem 1 (harder than problem 2)

Make a Matlab function that does interpolation either using Lagrange's
method or Newton's divided differences (hint: due to its recursive
nature, you might find Newton's divided differences easier to implement if we
ignore performance concerns^{1)}.)

Test your function by finding the polynomial that interpolates the following values:

\(x\) | -1.5 | -0.75 | 0 | 0.75 | 1.5 |

\(f(x)\) | -14.1014 | -0.931597 | 0.000000 | 0.931597 | 14.1014 |

The values are samples of the \(\tan\) function; plot your interpolation polynomial together with \(\tan\) on \([-1.5, 1.5]\).

## Programming problem 2 (easy)

Make a Matlab function that approximates integrals using Simpson's method. Table 19.4 on Kreyszig's page 829 is a good starting point. Use your function to approximate \(\int_{-1}^1 e^{-x^2}\, \mathrm{d}x\) (an integral that is impossible to compute analytically).

## Voluntary repetition problems

**TMA4122 exam from the spring of 2008**: problem 2

^{1)}