Monday, June 19, 2023

An Introduction To Numerical Analysis - Part 1 (Preliminaries)

 Numerical analysis is a powerful tool for finding approximate solutions to complex mathematical problems, particularly differential equations. In the fields of space plasma physics and solar physics, whole courses are devoted to numerical analysis approaches that can then be applied to numerical simulations of specific problems - say the development of auroral substorms, or the origins of coronal mass ejections. In this first part of my introduction we will not dive in at that deep end but confine attention to preliminaries.  

In fact though, we've already seen some cases of how numerical analysis can be applied, for instance in power series solutions to differential equations:

      Let f  then be a function defined on the closed interval [a, b] and f has n continuous derivatives on [a, b] then f n+1 (x)  exists for all x in [a, b]. And:

f(b) = f(a) + f ’(a) × (b – a) + f ” (a)/ 2! (b – a)2 +

….+   f n (a) / n! (b – a)n  + f n+1 (c)/ (n +1)! [(b- a) n+1]

Where c lies between a and b. 

So in the case of f(x) in the power series solns. post:

f(x) = f(x ) + f ’(x o× (x – x o) + f ” (x o) (x – x o)2 / 2!  +

 f ”’ (x o) (x – x o)3 / 2!  +   f n (x o) (x– x o)n!  +  ….

This is provided all derivatives exist at x = x o

An example of use of Taylor series in a specific problem:

Integrate:  ò b a  f(x)  dx

 Using a Taylor series method and justify it. 

Solution:

Take f(x) = å ¥ n = 0    f n (a) / n! (x – a) n

Then:    ò b a    f(x)  dx = ò b a    f(a)  dx +  ò b a  f ’(a) × (x – a)   dx

+ ò b a     f ” (a)/ 2! (x – a)2

ò b a  f(x)  dx = [f (a) × (b – a)  + f ’(a)/ 2! (x – a)÷ b

+ ò b a f ” (c)/ 2! (x – a)2

 The addition of the two terms in the bracket, with b, a limits, will yield a least upper bound to the value of the integral.  Given a function f, assume it is infinitely differentiable at some point a. Then we can write:

f(x) =  å ¥ n = 0    f n (a) / n! (x – a) n

Series and partial sums can also factor into numerical analysis, and convergence is often at the forefront. 

If {S n } converges we say the series converges.

Where:  S n  = å k k = 1   u n  =   u 1  +   u 2  +   u 3  +…. u n

From which we can get a sequence of partial sums:

E.g.  S 1   =  u 1 ,    S 2   =  u 1 +   u 2 ,     S 3   =  u 1 +   u 2 +   u 3

 Example:

å ¥ n = 1    1/ (n+1) =   å ¥ n = 1   (1/n  -  1/ (n +!)  =   1

S k  = ( 1 – ½)  +(1/2 – 1/3) +  (1/3 – ¼)  + …..(1/k – 1/ k -1) =  1

So: S k  =  1 - 1/ k + 1   converges to 1

If:  å u n   converges then:  lim  u n ® 0o  =  0  

For absolute convergence:  Given: å ¥ n = 1  u n

If  å ¥ n = 1  ÷ u ÷  converges then å u n   converges absolutely

Ratio Test for absolute convergence.  

Compute:    lim n® 0o÷ u n+1  / u ÷ =  L

If  L   <  1  the series converges

If  L   >  1  the series diverges

If  L   =  1  the test fails, so no result

Example: å ¥ n = 1   n  (2/3) n

lim n® 0÷ n + 1  (2/3) n+1  n (2/3) n ÷ =  lim n® 0o ÷ (2/3)(1 + 1/n)÷  =

=  2/3  < 1   (So converges absolutely)

Now back to more basic generalities to see how numerical analysis works in the most primitive settings.

We take x and y as real numbers ( R ) and let F be a generic computing system. Then x* and y*  are the representations of x and y in F.   Thus we can write for translation sake:  

x =  x*  +   e

y  =  y*  +  h

Let w denote a binary operation and let w* be the pseudo operation correction for w. Then if I want:  x w y  I actually get: x* w* y*.  So that:

x w y =  x* w* y*   = (x w y -  x* w y*) + (x* w y*  -   x* w* y*)

Hence:   

÷ x w y -  x* w* y*÷   ÷ x w y -  x*  y*÷  + 

÷ x* w y* -  x* w*  y*÷ 

Then the relative error is:

 ÷ x w y -  x* w* y*÷ x* w*  y*

While the absolute error is:  ÷ x w y -  x* w* y*÷  

This primitive and admittedly reductive example gets to the heart of numerical analysis.

Suggested Problems For Math Nerds:

1) Evaluate:   x + 4 x  +   6 x + 2x + 2 

At x = 1.2  using Horner's approximation method

You may use the "Horner calculator" e.g.

Online calculator for the Horner scheme (elsenaju.eu)

But then write all steps in long form ultimately comparing: 

a) 4 multiplications, 4 additions, and 

b) 10 multiplications, 4 additions.

2) Check to see if the series:

å ¥ n = 1   2 (x + 5)n   /n 2

Converges.

Challenge Problem:

The Taylor series can be used to find an approximation to a function’s value, i.e. of a square root, in terms of the order n desired viz.

P n  =   f(n) + f ’(n) × (x – n) + f ” (n)/ 2! (x – n)2 +

….+   f ”’ (n) / 3! (x – n) …..+ n+1 (n)/ (n +1)! [(x- n) n+1]

Use the Taylor series to 4th order (n = 4 or  P 4) to obtain the value of Ö 5


No comments: