User:Egm6341.s11.team1.arm/HW2

Part 1


 Matlab code: 

Part 2A (Taylor series)
From Homework 1.2 ,

To integrate,

Using the error definition given in Meeting 7-1 :

From Homework 1.2 ,

By the Integral Mean Value Theorem,

Finding the maximum and minimum of $$f(x)$$ on the interval and applying the Intermediate Value Theorem,

So the error will be bounded depending on $$n$$ in the following table

Using equation 4.5, the value for the integral for each respective $$n$$ are:

 Matlab code: 

Part 2B (Trapezoidal Rule)
For the following parts, Wolfram Alpha was used to determine the "actual" value of $$I(x)$$ to be

The trapezoidal rule states:

Exercising this for a variety of $$n$$ and replacing the value of $$f(0)$$ whenever encountered with $$f(0)=1$$ (from HW1.1 ), the following table is generated:

 Matlab code: 

Part 2C (Simpson's Rule)
Simpson's rule states:

Exercising this for a variety of $$n$$ and replacing the value of $$f(0)$$ whenever encountered with $$f(0)=1$$ (from HW1.1 ), the following table is generated:

 Matlab code: 

Part 2D (Gauss-Legendre Quadrature)
The Gauss-Legendre Quadrature states:

where the values for $$x_i$$ and $$w_i$$ are the roots of the Legendre polynomial of order $$n$$ and their associated weights, respectively.

Exercising this for a variety of $$n$$ and replacing the value of $$f(0)$$ whenever encountered with $$f(0)=1$$ (from HW1.1 ), the following table is generated:

 Matlab code: 

Problem 11
$$p_2$$ must be integrated from $$x_0$$ to $$x_2$$. To simplify, $$x_0$$ and $$x_2$$ can be set to -1 and 1, respectively, without loss of generality.