# Homework 7

```Homework 7
Problem 1
1) Determine the nodes and weights for Gaussian formula of the form
Z 1
x4 f (x) ≈ A0 f (x0 ) + A1 f (x1 ).
−1
2) Determine the composite rule for
a pseudocode).
Rb
a
x4 f (x)dx using two-point Gaussian formula (write
Problem 2
Rb
Write a program for the calculation of a f (x)dx using Simpson’s rule and trapezoidal
rule. Find the convergence rate of these methods for f (x) = cos(x), a = 0, b = π/2 using n
equally spaced points with n = 2j + 1, with j = 3, 4, 5, 6, 7, 8, 9, 10.
Problem 3
The vibration of a mass m connected to a nonlinear spring of stiffness k(x), is governed
by
d2
d2
x
+
k(x)
=
0
or
x + F (x) = 0,
dt2
dt2
where F (x) = k(x)/m and x(t) is the displacement of the mass at time t.
a) Show that by integrating the equation we have
Z x
1
dξ
qR
t= √
,
x0
2 0
F
(η)dη
ξ
m
where the initial displacement and the initial velocity of the mass are assumed to be x0 and
2
d d
( dt x)2 = 2 dtd 2 x).
0 respectively (you can use the identity dx
b) Assuming that F (x) = x5 and x0 = 1, find the value of t corresponding to x = 1(= x0 )
using a numerical method (i.e. a period of the oscillation).
Problem 4
Show how to use Richardson extrapolation to obtain the accuracy O(h5 ), O(h7 ) and
O(h9 ) if
L = φ(h) + a1 h + a3 h3 + a5 h5 + . . . .
1
```