7HnumInt

Numerical Integration


 * This method makes use of the ability of computers (and CAS calculators) to find the definite integrals of functions we can't integrate using calculus.


 * Aim: ** To solve **y' = f(x)** given the solution **y(x)** passes through **(a, b)** .. {or y(a) = b}

math \text{Since } \, \dfrac{dy}{dx}=f(x) \; \text{it is also true that } \, \dfrac{dy}{dt}=f(t) math

{replacing one variable with another doesn't change the function}

It follows that, for any value of x,

math . \qquad \displaystyle{\int\limits_{t=a}^{t=x}}f(t)\,dt = \displaystyle{\int\limits_{t=a}^{t=x}}\dfrac{dy}{dt}\,dt math . math \\ . \qquad \qquad \qquad = \displaystyle{\int\limits_{t=a}^{t=x}}1\,dy \\. \\ . \qquad \qquad \qquad = \Big[ y(t) \Big]_{t=a}^{t=x} math . math \\ . \qquad \qquad \qquad = y(x)-y(a) \\. \\ . \qquad \qquad \qquad = y(x)-b math

{We introduced **t** as a dummy variable in the integration so that we could retain **x** as the independent variable in the solution}

From above, we get that: math . \qquad \displaystyle{\int\limits_{t=a}^{t=x}}f(t)\,dt = y(x)-b math

Rearrange this, to get: math . \qquad y(x)=\displaystyle{\int\limits_{t=a}^{t=x}}f(t)\,dt+b math

Example 1

Use the numerical integration method to find the value of **y** when **x = 15** for the differential equation: math . \qquad \dfrac{dy}{dx}=2x math

given that, when **x = 0**, **y = 1**.

{To help you understand this method, I will do it by hand first, then with the calculator}


 * Solution: {By Hand} **

From the question ... ... **a = 0** and **b = 1**.

Substitute into the rule: math . \qquad y(x)=\displaystyle{\int\limits_{t=a}^{t=x}}f(t)\,dt+b math . math . \qquad y(15)=\displaystyle{\int\limits_{t=0}^{t=15}}2t\,dt+1 math . math \\ . \qquad \qquad \qquad = \Big[ t^2 \Big]_{t=0}^{t=15}+1 \\. \\ . \qquad \qquad \qquad = 15^2-0^2+1 \\. \\ . \qquad \qquad \qquad = 226 math


 * Solution: {By Calculator} **

Use the integral form in the virtual keyboard, 2D tab, CALC section to enter

math . \qquad \displaystyle{\int\limits_{0}^{15}}2t\,dt+1 math


 * Notice in this example we can find the integral of f(t) using calculus.
 * This method will work even if we can't -- provided the computer (or CAS calculator) can calculate the definite integral.

Example 2

Use the numerical integration method to draw the graph of the solution y(x) given y(0) = 1 in the domain [0, 10] math . \qquad \dfrac{dy}{dx}=e^{-x^2} math


 * Solution: **

math . \qquad y(x)=\displaystyle{ \int\limits_{t=0}^{t=x} } e^{-t^2} \, dt+1 math
 * Numerical integration gives the rule: **


 * To get the graph, we first have to define the function: **
 * Define** is in the **Action/Command** menu

Enter: math . \qquad \text{Define } y(x)= \int\limits_{0}^{x} e^{-t^2} \, dt+1 math


 * Note: Use the abc keyboard for "y" and the variable keyboard for "x" and "t"

Find the endpoints for the domain by entering ... ... y(0) ... {and} ... .. y(10)
 * The calculator shows the numerical solution to the D.E. at x = 10 is y = 1.886

To produce the graph, go to the function entry screen and enter ... ... y1 = y(x)


 * {Again, use abc keyboard for "y" and variable keyboard for "x"}

Then draw the graph (click on the graph icon) ... ... Adjust the screen to show domain [0, 10]


 * When drawing this on paper, don't forget to label the endpoints for the domain. **



.