# DIGMATH: Dynamic Investigatory Graphical Displays of Math: Graphical Explorations for Numerical Analysis in Excel

## Sheldon P. Gordon

Most of the following graphical explorations require the use of macros to operate. In order to use these spreadsheets, Excel must be set to accept macros. To change the security setting on macros:

With Excel 2007 and later:

- When you open the spreadsheet, a new bar appears near the top of the window that says "Security Warning: Active content has been disabled".
- Click on Options.
- Click on "Enable this Content" and then click OK.

The following are the DIGMath explorations that are currently (July 2017) completed and ready for use. (Many others are under development.) Please feel free to download and use any or all of these files; if you want all of them, you can click on the link: numerical-analysis.zip or you can send an e-mail to gordonsp@farmingdale.edu and I will send try sending you a zip file with all of the files currently ready. If you have any problems downloading or running any of these files, please contact me for assistance. If you have any suggestions for improvements or for new topics, please pass them on also.

## Root Finding Methods

The Bisection Method This DIGMath module illustrates the convergence of the Bisection Method for finding
the real zeros of any function *y* = *f*(*x*). To use it, you enter the desired function and an initial interval from a to b over
which the function has at least one zero and the program performs successive iterations
of the method, displaying the results both graphically and in a table.

The Secant Method This DIGMath module illustrates the convergence of the Secant Method for finding
the real zeros of any function *y* =* f*(*x*). To use it, you enter the desired function and an initial estimate x0 of any real
zero and the program performs successive iterations of the method, displaying the
results both graphically and in a table.

Newton's Method This DIGMath module lets you investigate Newton's Method for finding the roots of
a function *f*, both numerically and graphically. For any desired function, any desired starting
value, and any desired number of iterations, you can see the set of iterated approximations
in a table and the graph of the process, either in a fixed window of your choice (although
the sequence of approximations may leave the window) or in a variable window that
follows the sequence of iterations.

Bairstow's Method This DIGMath spreadsheet lets you investigate Bairstow's Method for approximating the complex roots of a polynomial by creating a sequence of quadratic functions that converges to an irreducible quadratic factor of the polynomial. You can use any polynomial up to 8th degree and any choice of initial estimate for the quadratic factor. The spreadsheet draws the first five quadratic approximations to illustrate the convergence both graphically and numerically.

## Approximating a Function

Taylor Polynomial Approximations This DIGMath spreadsheet allows you to investigate the Taylor polynomial approximations to the four most common transcendental function: the exponential function, the sine function, the cosine function, and the natural logarithm function. In each case, you can enter any desired interval and select which polynomial approximations you want to see displayed along with the function. For instance, with the exponential function, you can select any or all of the linear through the fifth degree polynomials; with the sine function, you can select any or all of the polynomials of odd degree up to the seventh degree.

Power Series Approximations This DIGMath spreadsheet allows you to investigate the successive polynomial approximations
to a power series Σ* a _{k}* (

*x - c*)

^{k}based on the coefficients of the series and the center point. You can enter any desired interval and select which polynomial approximations you want to see displayed from the constant up through the quintic (fifth degree).

Fourier Series Approximations This DIGMath spreadsheet allows you to investigate the successive Fourier approximations to three common periodic functions -- the square wave, the triangle wave, and the sawtooth wave. In each case, you can select which of the first four Fourier approximations you want to see displayed and can turn them on or off via sliders to observe how the successive approximations relate to one another and how they begin to converge to the shape of the desired target wave.

Lagrange Interpolation Formula This DIGMath module lets you investigate the Lagrange Interpolating Polynomial based on any set of up to 8 data points. The spreadsheet draws the graph of the Lagrange polynomial as it passes through the interpolating points. It also displays the equation of the polynomial using the Lagrange formula for the linear, quadratic, and cubic cases.

Building Lagrange Interpolation Polynomials This DIGMath spreadsheet lets you investigate the way that the Lagrange Interpolating Polynomial is created as a combination of the individual component polynomials. You can look at the way that the linear, the quadratic, and the cubic Lagrange polynomials are built based on the sum of two linear, three quadratic, or four cubic polynomials, respectively. In each case, the individual components are drawn along with the Lagrange polynomial based on the data points entered and you can then examine the relationships between the roots of the polynomial components, the interpolating points, and the associated function values.

Newton Interpolation Formula This DIGMath module lets you investigate the Newton Forward Interpolating Polynomial based on any set of up to 8 uniformly spaced data points. The spreadsheet draws the graph of each of the successive linear, quadratic, ... Newton polynomials as they pass through the various interpolating points.

Approximating the Sine using Lagrange Interpolation This DIGMath spreadsheet lets you investigate how the sine function can be approximated
on the interval [0, π/4] using Lagrange Interpolating Polynomials based on either
three or four interpolating points given either in radians or degrees. The spreadsheet
draws the graph of sine and the interpolating polynomial as well as the graph of the
error function *P*(*x*) - sin *x* so you can see how well or poorly the polynomial fits the function as you change
the interpolating points.

Approximating the Sine using Newton Interpolation This DIGMath spreadsheet lets you investigate how the sine function can be approximated
on the interval [0, π/4] using Newton Interpolating Polynomials based on either three
or four uniformly spaced interpolating points given either in radians or degrees.
The spreadsheet draws the graph of sine and the interpolating polynomial as well as
the graph of the error function *P*(*x*) - sin *x* so you can see how well or poorly the polynomial fits the function as you change
the interpolating points.

Approximating the Cosine using Lagrange Interpolation This DIGMath spreadsheet lets you investigate how the cosine function can be approximated
on the interval [0, π/4] using Lagrange Interpolating Polynomials based on either
three or four interpolating points given either in radians or degrees. The spreadsheet
draws the graph of cosine and the interpolating polynomial as well as the graph of
the error function *P*(*x*) - cos *x* so you can see how well or poorly the polynomial fits the function as you change
the interpolating points.

Approximating the Cosine using Newton Interpolation This DIGMath spreadsheet lets you investigate how the cosine function can be approximated
on the interval [0, π/4] using Newton Interpolating Polynomials based on either three
or four uniformly spaced interpolating points given either in radians or degrees.
The spreadsheet draws the graph of sine and the interpolating polynomial as well as
the graph of the error function *P*(*x*) - cos *x* so you can see how well or poorly the polynomial fits the function as you change
the interpolating points.

Approximating the Exponential Function using Lagrange Interpolation This DIGMath spreadsheet lets you investigate how the exponential function* y* = e^{x} can be approximated on the interval [0, 1] using Lagrange Interpolating Polynomials
based on either three or four interpolating points. The spreadsheet draws the graph
of exponential function and the interpolating polynomial as well as the graph of the
error function *P*(*x*) - e^{x} so you can see how well or poorly the polynomial fits the function as you change
the interpolating points.

Chebyshev Nodes This DIGMath module lets you investigate the so-called Chebyshev nodes that are often the best points to use to construct an interpolating polynomial based on a set of points. The Chebyshev nodes have the property that they provide the minimum value of the maximum error in the approximation at the interpolating points. The spreadsheet lets you enter your choice of either three or four interpolating points on the interval [-1, 1] and compares, both numerically and graphically, the maximum error to the corresponding maximum error using the Chebyshev nodes.

Cubic Splines This DIGMath spreadsheet lets you investigate the notion of cubic splines, a way to construct a smooth curve determined by a set of points in such a way that the curve is made up of a series of smoothly connected cubic curves. The spreadsheet has two components. In the first, the data points are grouped three at a time subject to the condition that the slope at the third point must be equal to the slope of the following cubic at the first point. In the second, the points are grouped two at a time subject to the two conditions that the slope and the value of the second derivative must agree at each of the overlapping points.

## Approximating the Derivative

Tangent Line to a Curve This DIGMath spreadsheet allows you to investigate how the value of the derivative
of a function at a point can be approximated by using the slope of the tangent line
to the graph of any desired function of the form *y = f*(*x*) on any desired interval *a* to *b*. You control the point of tangency using a slider and watch the effects on the resulting
tangent line to the curve, and therefore the derivative, as the point changes. The
length of the tangent line also changes to reflect the size of the slope or, equivalently,
the value of the derivative of the function at the point.

Newton Difference Quotients This DIGMath module lets you investigate the notion of the Newton difference quotient as an approximation to the slope of the tangent line to a curve at a point. You can use any function, any interval, any desired step-size, and any point of tangency. The spreadsheet displays graphically the graph, the associated secant line and the triangle based on the point of tangency. If also displays numerically slope of the secant line compared to the slope of the tangent line, so you can see what happens to the agreement as the step-size is decreased or as the point of tangency moves along the curve.

## Numerical Integration

Numerical Integration Methods This DIGMath spreadsheet allows you to investigate four different methods to approximate
the value of a definite integral -- using left and right-hand Riemann Sums, using
the Trapezoid Rule, the MidPoint Rule, and Simpson's Rule for any function of the
form *y = f*(*x*) on any desired interval [*a, b*]. You control the number of subdivisions for each method using a slider and the spreadsheet
draws the graph of the function, draws the approximating subdivisions, and displays
the associated approximation to the definite integral.

Monte Carlo Method for Definite Integrals This DIGMath spreadsheet allows you to investigate visually and numerically the use
of Monte Carlo simulations for estimating the value of the definite integral of any
function of the form *y = f*(*x*) that is non-negative on any desired interval [*a, b*]. You control the number of random points, between 500 and 2500, via a slider and
the spreadsheet draws the graph of the function, plots the random points, and displays
the number and percentage of them that fall under the curve, and uses that percentage
to estimate the area of the region.

## Approximating Solutions of Differential Equations

Euler's Method for Numerical Solutions to Differential Equations *y' = f*(*x, y*) This DIGMath spreadsheet lets you investigate Euler's Method for generating numerical
approximations to the solution of the differential equation *y' = f*(*x, y*), for any desired function of *x* and *y*, with any desired initial condition. The spreadsheet calculates and displays the
approximation solutions corresponding to *n* = 4, 8, 16, ..., 128 steps across any desired interval, so you can observe the convergence
of the successive approximations toward a smooth curve.

Euler's Method for Numerical Solutions to Differential Equations *y' = f*(*x*) This DIGMath spreadsheet lets you investigate Euler's Method for generating numerical
approximations to the solution of the differential equation *y*' = *f*(*x*), for any desired function of *x* (but not *y*) with any desired initial condition. The spreadsheet calculates and displays the
approximation solutions corresponding to* n* = 4, 8, 16, ..., 128 steps across any desired interval, so you can observe the convergence
of the successive approximations toward a smooth curve.

Second Order Homogeneous Differential Equations with Constant Coefficients This DIGMath module lets you investigate the behavior of the solutions of the second
order homogeneous differential equation *ay*" + *by*' + *cy* = 0 for your choice of the coefficients *a, b*, and *c* and initial conditions *y*_{0} and *y*'_{0}.