Page 77 - Applied Numerical Methods Using MATLAB
P. 77

66    MATLAB USAGE AND COMPUTATIONAL ERRORS
                (f) Make a routine which computes the sum

                               K  k
                                 λ  −λ
                       S(K) =      e      for λ = 100 and an integer K  (P1.20.6)
                                 k!
                              k=0
                   and then, use the routine to find the value of S(155).

           1.21 Recursive Routines for Efficient Computation
                (a) The Hermite Polynomial [K-1]
                   Consider the Hermite polynomial defined as

                                                        2 d N  −x 2
                                                    N x
                          H 0 (x) = 1,  H N (x) = (−1) e    e          (P1.21.1)
                                                         dx N
                    (i) Show that the derivative of this polynomial function can be writ-
                       ten as
                                             2 d N  −x 2    N x 2 d N+1  −x  2
                                        N
                                             x

                            H (x) = (−1) 2xe      e   + (−1) e        e
                             N
                                              dx N              dx N+1
                                  = 2xH N (x) − H N+1 (x)              (P1.21.2)
                       and so the (N + 1)th-degree Hermite polynomial can be obtained
                       recursively from the Nth-degree Hermite polynomial as

                                  H N+1 (x) = 2xH N (x) − H (x)        (P1.21.3)
                                                        N
                   (ii) Make a MATLAB routine “Hermitp(N)” which uses Eq. (P1.21.3)
                       to generate the Nth-degree Hermite polynomial H N (x).
                (b) The Bessel Function of the First Kind [K-1]
                   Consider the Bessel function of the first kind of order k defined as
                                  1     π
                           J k (β) =    cos(kδ − β sin δ)dδ           (P1.21.4a)
                                  π  0
                                       k ∞       m 2m
                                    β        (−1) β           k
                                =                       ≡ (−1) J −k (β) (P1.21.4b)
                                            m
                                    2      4 m!(m + k)!
                                        m=0
                     (i) Define the integrand of (P1.21.4a) in the name of ‘Bessel_inte-
                        grand(x,beta,k)’ and store it in an M-file named “Bessel_
                        integrand.m”.
                    (ii) Complete the following routine “Jkb(K,beta)”, which uses
                        (P1.21.4b) in a recursive way to compute J k (β) of order k =
                        1:K for given K and β (beta).
                   (iii) Run the following program nm1p21b which uses Eqs. (P1.21.4a)
                        and (P1.21.4b) to get J 15 (β) for β = 0:0.05:15. What is the norm
   72   73   74   75   76   77   78   79   80   81   82