The Student[NumericalAnalysis] Package
The Student[NumericalAnalysis] package contains commands that can be used to learn and understand numerical analysis concepts. The areas of numerical analysis that the package covers are: initial-value problems, interpolation, numerical linear algebra, numerical quadrature, and root finding. This worksheet demonstrates how to use some of the commands and how to launch the interactive tutors.
|
Getting Started
|
|
While any command in the package can be referred to using the long form, for example, Student[NumericalAnalysis][Euler], it is often easier to load the package and then use the short form command names.
>
|
|
|
|
Initial-Value Problems
|
|
The Student[NumericalAnalysis] package contains several commands that can numerically approximate the solution to an initial-value problem. A standard suite of approximation methods are available, including the Adams-Bashforth explicit, Adams-Moulton implicit, Adams-Bashforth-Moulton predictor-corrector, Euler, Runge-Kutta, and Taylor methods. In particular, difference formulae of various orders are available from the Adams and Runge-Kutta families of methods.
>
|
|
| (2.1) |
>
|
|
>
|
|
The InitialValueProblem command can also return a plot of the exact and approximated solution, using the output=plot option.
>
|
|
The comparewith option allows the student to compare different approximation methods and the exact solution. The comparewith option can be used with the output=plot and output=information options.
>
|
|
>
|
|
| (2.4) |
|
|
Interpolation
|
|
The Student[NumericalAnalysis] package contains several commands that allow students to perform polynomial and cubic spline interpolations on data points. The available methods of interpolation include Lagrange, Newton, Hermite, Neville, and cubic spline interpolation. The interpolation is computed by either the PolynomialInterpolation command or the CubicSpline command. These commands return a POLYINTERP data structure which can then be passed to different Student[NumericalAnalysis] commands to retrieve information. A list of commands that accept a POLYINTERP structure is found in the Glossary of Commands, under Interpolation.
>
|
|
| (3.1) |
Use the PolynomialInterpolation command to perform the interpolation and store all information.
>
|
|
Extract the interpolant from the POLYINTERP structure using the Interpolant command.
| (3.2) |
Extract the function using the Function command.
Extract the remainder term using the RemainderTerm command.
| (3.4) |
Use the Draw command to plot the basis functions from the Newton interpolation.
>
|
|
Perform a cubic spline interpolation using the CubicSpline command.
>
|
|
Use the Draw command to plot the interpolating polynomial.
|
|
Numerical Linear Algebra
|
|
The Student[NumericalAnalysis] package contains several commands that allow students to explore numerical linear algebra. Matrix decomposition and iterative approximation methods are the two main focuses of the numerical linear algebra commands in the Student[NumericalAnalysis] package. The available iterative approximation techniques include the Gauss-Seidel, Jacobi, and Successive Over-Relaxation methods.
>
|
|
| (4.1) |
Factor the matrix.
>
|
|
| (4.2) |
Check if the matrix is strictly diagonally dominant.
>
|
|
Approximate the solution to a system of equations using the Successive Over-Relaxation method.
>
|
|
>
|
|
| (4.5) |
|
|
Numerical Quadrature
|
|
The Student[NumericalAnalysis] package contains several commands that allow students to numerically approximate integrals using different methods. The available quadrature methods include the complete family of Newton-Cotes formulae (open or closed, with a user-specified order), Gaussian Quadrature, and Romberg Integration. Some of these methods can be used with the adaptive=true option in the Quadrature command or with the AdaptiveQuadrature command. The results of the approximate integration can be returned as a sum, value, plot, animation, or as printed information about the computation.
>
|
|
Use the Boole method to numerically approximate the value of
>
|
|
The output=plot option can be used to display a plot of the approximation.
>
|
|
Adaptive quadrature is also available using the adaptive=true option in the Quadrature command or the AdaptiveQuadrature command.
>
|
|
Use the output=information option to print a record of the adaptations performed during the approximation.
>
|
|
INTEGRAL: Int((1+cos(x)^2)^(1/2),x=1..14) = 15.7418533
APPROXIMATION METHOD: Adaptive Bode's Rule
---------------------------------- INFORMATION TABLE ----------------------------------
Approximate Value Absolute Error Relative Error
15.7418676 1.426e-05 9.059e-05 %
---------------------------------- ITERATION HISTORY ---------------------------------------
Interval Status Present Stack
1..14 fail EMPTY
1..15/2 fail [15/2, 14]
1..17/4 fail [[1], [17/4, 15/2]]
1..21/8 PASS [[2], [21/8, 17/4]]
21/8..17/4 PASS [[1], [17/4, 15/2]]
17/4..15/2 fail [15/2, 14]
17/4..47/8 PASS [[1], [47/8, 15/2]]
47/8..15/2 PASS [15/2, 14]
15/2..14 fail EMPTY
15/2..43/4 fail [43/4, 14]
15/2..73/8 PASS [[1], [73/8, 43/4]]
73/8..43/4 PASS [43/4, 14]
43/4..14 fail EMPTY
43/4..99/8 PASS [99/8, 14]
99/8..14 PASS EMPTY
--------------------------------------------------------------------------------------------
Number of Function Evaluations: 65
| |
|
|
Root Finding
|
|
The Student[NumericalAnalysis] package contains commands that allow students to numerically approximate the roots of an expression. A suite of basic numerical root-finding methods are available, including Newton-Raphson, Modified Newton-Raphson, Bisection, Secant, Fixed-Point Iteration, False-Position, and Steffensen.
Try the Bisection method.
>
|
|
Try the Newton-Raphson method and use the output=plot option to display the approximation.
>
|
|
|
|
Tutors
|
|
The Student[NumericalAnalysis] package contains four interactive tutors to assist students with solving numerical analysis problems: EulerTutor, InitialValueProblemTutor, IterativeFormulaTutor, and MatrixDecompositionTutor. The tutors can be accessed via the menu path Tools > Tutors > Numerical Analysis or by invoking the tutor in a worksheet as shown below.
|
Return to Index for Example Worksheets
|