• Sonuç bulunamadı

Numerical computation of the p-th derivative of a function

N/A
N/A
Protected

Academic year: 2021

Share "Numerical computation of the p-th derivative of a function"

Copied!
11
0
0

Yükleniyor.... (view fulltext now)

Tam metin

(1)

Selçuk J. Appl. Math. Selçuk Journal of Vol. 12. No. 1. pp. 31-41, 2011 Applied Mathematics

Numerical Computation of the p-th Derivative of a Function Bülent Yılmaz1, Sadi Kartal2

1Depart. of Math, Faculty of Science and Letters, Marmara Univ., Göztepe Kampüsü,

34722, Kadiköy, Istanbul, Turkiye e-mail: bulentyilm az@ m arm ara.edu.tr

2Pertevniyal High School, Fatih, Istanbul, Turkiye

e-mail:kartalsadi@ yaho o.com .tr

Received Date: December 10, 2009 Accepted Date: December 14, 2010

Abstract. Recently efforts have been made to compute first and second deriva-tives of a function numerically when it’s values are known in a specific interval. In the derivation mainly Chebyshev polynomials and Lagrange interpolation were used by M.T.Rashed. In this study, a generalized form is reached for the p-th derivative of a function. Thus encoding of the method on personal com-puter and finding solutions can be easily done. Method is applied to different examples are made and advantages and disadvantages are indicated.

Key words: Interpolation; derivatives.

2000 Mathematics Subject Classification: 26D25. 1. Introduction

It is not always possible to calculate the derivative of a function exactly. In this work the generalization of a numerical scheme is developed for the p-th derivative of a function using the technique already utilized to approximate the first and second derivatives at the endpoints of the subintervals obtained by dividing the interval [A,B] into n equally spaced parts.

As is well known, Lagrange interpolation is frequently used in approximating a function if its values are known at (n+1) distinct points. Lagrange interpolation is also used in this work where we attempt to approximate the p-th derivative of a function. Equation systems related to first, second and third order derivatives were obtained and expressed in matrix form and generalization of the p-th order derivative was made. Computer programmes were made to evaluate and to analyse the numerical results and to see the positive and negative aspects of the proposed method. To this end four functions each of different structure were

(2)

chosen and the numerical results up to their fourth derivatives are tabulated for comparison purposes. Approximate results are also compared on graphs with the exact values in order give a detailed account of the method.

Results at the interior points seem to be highly satisfactory portraying errors at minimum level. It was observed that order of derivative, type of function, interval size, number of subintervals all seem to effect the relevant errors. In cases where the interval length is not too long the method gives good results up to the fourth order derivatives. Another positive aspect of the proposed method is the ease by which the algorithm can be transferred to computation media. The paper is organized as follows. The formulation of the first derivative of a function in section 2. In section 3 the p-th derivative of a function is given. In section 4 some examples are given as some concluding remarks.

2. First derivative of a function

Lagrange interpolation of a function 0() is given by (for further reading, see Refs. [1-4]) (2.1) 0() ≈  X =0 0() ()   ≤  ≤  where () =  Y =0 6= µ  −  −  ¶   =  +   =  −   for  = 0 1     

Integrating both side of (2.1) from A to x

(2.2)  () −  () ≈  X =0 () 0() where () =  Z   Y =0 6= µ  −  −  ¶ 

when suitable transformations are made

(2.3) () =  −  2 1 Z −1  Y =0 6= ⎛ ⎜ ⎝  −  2  +  +  2 −  −  ⎞ ⎟ ⎠ 

(3)

is obtained. This integration can be approximately computed using chebyshev polynomials. The infinite sum in chebyshev series is converted to a finite sum by choosing a naturel number N.

(2.3a) () ≈  −  2  X =0   Y =0 6= ⎛ ⎜ ⎝  −  2  +  +  2 −  −  ⎞ ⎟ ⎠ where = 2  00 X =0 cos µ   ¶   = ⎧ ⎨ ⎩ 2  = 0 0  is odd 2 1−2  is even ⎫ ⎬ ⎭ = ½ 05  = 0  1 0     ¾  = cos   for  = 0 1     

The double prime on the N indicates that in forming the sum, the terms with subscripts = 0 and  =  are to be halved. In (2.2) if  =  is chosen, (0) = 0 ∀ If we choose  by =−2 cos µ ( − 045)  ¶ ++2 , is reached  6= (∀). Hence, Eq. (2.2) becomes

(2.4)  () −  () ≈  X  =0

() 0()   = 0 (1) 

Eq. (2.4) gives the first derivative of the function () at points =  +   =  − 

  for  = 0 1      Similarly, we can find the second derivative of a function, as in [4]. 3. P-th derivative of a function

Consider the Lagrange interpolation of the −th derivative of a function ()()

()() ≈  X =0

()() ()   ≤  ≤  Integrating p times from  to 

(−1)() − (−1)() ≈  X =0

(4)

(−2)() − (−2)() − ( − ) (−1)() ≈  X =0 ()() 2() (−3)() − (−3)() − ( − ) (−2)() −( − ) 2 2  (−1)() ≈  X =0 ()() 3() .. . (3.1)  () −  () − −1 X =1 ( − ) !  () () ≈  X =0 ()() () where () =  Z     ()     Z  () | {z } =  Z  ( − )−1 ( − 1)! ()  When suitable transformations are made

() =  −  2 1 Z −1 ∙  − −  2  −  +  2 ¸(−1) ( − 1)!  µ  −  2  +  +  2 ¶ 

is formed. This integration can approximately be computed using Chebyshev polynomials () ≈  −  2  X =0  ∙  −  − 2 −  +  2 ¸(−1) ( − 1)!  Y =0 6= ⎛ ⎜ ⎝  −  2 +  +  2 −  −  ⎞ ⎟ ⎠ Let  =  in (3.1)

(5)

(−1)() ( − 1)! = (3.2) = 1 ( − )−1 ⎡ ⎣ () −  () − −2 X =1 ( − ) !  () () −  X =0 ()() () ⎤ ⎦ Substitute (3.2) in to (3.1)  () −  () − −2 X =1 ( − ) !  () () − ( − )−1 ( − )−1 ⎡ ⎣ () −  () − −2 X =1 ( − ) !  () () −  X =0 ()() () ⎤ ⎦ =  X =0 ()() ()

When, suitable arrangements are done we reach at the generalized form  () −  () − ( − ) (−1) ( − )(−1)[ () −  ()] − −2 X =1 ()() ! " ( − )− ( − ) (−1) ( − )(−−1) # (3.3)  X =0 Ã" () − ( − ) (−1) ( − )(−1)() # ()() !

Equation (3.3) may be written in the form  = −1 . Where

1 =  (0) − () − (0− )(−1)[ () −  ()] ( − )(−1) 2 =  (1) − () − (1− )(−1)[ () −  ()] ( − )(−1) .. .  =  () − () − (− )(−1)[ () −  ()] ( − )(−1)

(6)

 = ⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ 1− P−2 =1 ()() " (0− )− (0− )(−1) ( − )(−−1) # ! 2− P−2 =1 ()() " (1− )− (1− )(−1) ( − )(−−1) # ! .. . − P−2 =1 ()() " (− )− (− )(−1) ( − )(−−1) # ! ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦  = ⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ (0) − (0− )(−1) ( − )(−1)() (1) − (1− )(−1) ( − )(−1)() .. . () − (− )(−1) ( − )(−1)() ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦ and  = ⎡ ⎢ ⎢ ⎢ ⎣ ()( 0) ()( 1) .. . ()() ⎤ ⎥ ⎥ ⎥ ⎦

The problem in using (3.1) is (0) = 0 ∀ To remove that problem we may choose  as =  −  2 cos ∙ ( − 045)   ¸ + +  2   = 0 (1) . 4. Numerical Examples

In order to work on the numerical differentiations results made in our study some example functions were used. These functions are given below and the results obtained are tabulated in Table 4.1. The error values associated with the first, second, third and fourth derivatives of the functions in question, are shown with the symbol ( ). Taking ( ) as the difference between the calculated and the exact values. (= − )  is calculated utilizing the formula.

= ⎡ ⎣  X =0 2()  ⎤ ⎦ 12 ≈ ⎡ ⎣  Z  2()  ⎤ ⎦ 12

(7)

(1)  () = ( + 2)log(+5) (2)  () =  · log( + 3) (3)  () = sin  (4)  () = 1[5 + sin³ 2 ´ ]  0() 00() (3)() (4)() 2 6.1D-03 3.1D-03 3.4D-01 25.2 3 9.8D-05 3.0D-05 1.8D-02 2.7D+00 4 6.1D-07 3.3D-06 1.9D-04 6.9D-02 5 4.8D-08 2.6D-07 3.9D-05 1.2D-02 6 3.3D-09 2.4D-08 4.1D-06 1.7D-03 7 2.8D-10 2.2D-09 4.9D-07 2.9D-04 8 2.2D-11 2.1D-10 5.4D-08 4.1D-05 9 1.6D-12 2.0D-10 1.1D-08 8.2D-06 10 3.2D-13 1.2D-10 8.6D-10 1.2D-05 12 4.8D-13 2.3D-10 2.0D-08 2.8D-05 15 7.0D-12 7.0D-10 1.9D-07 2.5D-04 20 7.4D-11 7.0D-08 1.2D-05 1.6D-01 Table 4.1:  () = ( + 2)ln(+5)  for  = 0  = 10  0() 00() (3)() (4)() 2 6.8D-04 3.8D-04 1.6D-01 22.6 3 5.9D-06 7.1D-07 4.4D-03 1.3D+00 4 8.1D-09 1.6D-07 7.5D-06 7.6D-03 5 1.2D-09 7.6D-09 3.7D-06 2.5D-03 6 5.0D-11 3.8D-10 2.2D-07 2.2D-04 7 2.2D-12 5.4D-11 1.5D-08 1.4D-05 8 3.4D-13 2.4D-10 2.2D-08 4.4D-05 9 3.5D-13 3.1D-10 2.4D-08 8.6D-05 10 1.8D-13 3.9D-10 2.8D-08 1.3D-04 12 8.6D-13 3.3D-10 6.4D-08 1.4D-04 15 4.7D-12 8.9D-10 2.8D-07 1.7D-03 20 2.2D-10 6.6D-08 1.2D-05 5.6D-01 Table 4.2:  () = ( + 2)ln(+5)  for  = 0  = 05

(8)

 0()  00 () (3)() (4)() 2 1.5D-03 2.4D-03 1.1D-01 6.0 3 6.7D-05 2.3D-04 1.5D-02 1.8 4 4.0D-06 2.0D-05 2.0D-03 3.9D-01 5 2.8D-07 1.6D-06 2.3D-04 7.1D-02 6 2.1D-08 1.3D-07 2.5D-05 1.1D-02 7 1.5D-09 1.0D-08 2.6D-06 1.6D-03 8 1.1D-10 8.2D-10 2.5D-07 2.0D-04 9 7.1D-12 5.4D-11 2.4D-08 2.6D-05 10 5.4D-13 1.1D-11 2.5D-09 2.1D-06 12 2.6D-13 2.2D-11 1.9D-09 4.3D-06 15 2.5D-12 2.8D-10 1.2D-08 1.4D-04 20 2.4D-11 1.4D-08 2.0D-06 3.2D-02 Table 4.3:  () =  · ln ( + 3)   for  = 0  = 10  0() 00() (3)() (4)() 2 3.2D-03 3.8D-03 6.4D-02 1.6 3 2.0D-04 4.8D-04 1.2D-02 6.5D-01 4 1.6D-05 5.8D-05 2.2D-03 2.0D-01 5 1.6D-06 6.7D-06 3.6D-04 5.0D-02 6 1.7D-07 7.6D-07 5.4D-05 1.1D-02 7 1.7D-08 8.4D-08 7.8D-06 2.1D-03 8 1.7D-09 9.3D-09 1.1D-06 3.9D-04 9 1.6D-10 1.0D-09 1.4D-07 6.6D-05 10 1.5D-11 1.1D-10 1.8D-08 1.1D-05 12 2.4D-13 1.1D-11 5.0D-10 8.4D-07 15 1.2D-13 2.7D-10 1.5D-08 2.2D-05 20 5.9D-11 5.9D-09 5.7D-07 2.0D-03 Table 4.4:  () =  · ln ( + 3)   for  = 10  = 30

(9)

 0()  00 () (3)() (4)() 2 4.4D-02 3.3D-02 2.9D+00 190.1 3 1.9D-03 3.4D-02 9.9D-02 52.6 4 6.9D-04 3.3D-03 2.3D-01 77.0 5 4.8D-05 5.1D-04 4.1D-02 10.3 6 7.5D-06 1.1D-04 4.5D-03 5.4 7 1.4D-06 8.4D-07 1.9D-03 1.6 8 1.7D-08 1.8D-06 7.1D-04 5.6D-02 9 1.6D-08 1.4D-07 3.9D-05 6.9D-02 10 1.1D-09 1.5D-08 4.9D-06 5.9D-03 12 1.7D-11 1.0D-10 1.1D-07 3.0D-04 15 2.6D-12 8.6D-11 4.5D-08 6.3D-05 20 2.4D-11 1.3D-08 1.8D-05 2.5D-02

Table 4.5:  () = sin   for  = 0  = 10

 0()  00 () (3)() (4)() 2 7.6D-04 4.9D-03 8.5D-02 2.8 3 1.3D-04 6.6D-04 3.2D-02 3.3 4 1.3D-05 2.7D-05 4.7D-03 1.4 5 3.5D-07 1.9D-05 6.2D-04 1.3D-02 6 2.4D-07 4.2D-06 3.5D-04 9.8D-02 7 4.9D-08 3.9D-07 8.4D-05 4.9D-02 8 4.2D-09 7.9D-09 7.8D-06 8.9D-03 9 6.0D-11 9.6D-09 6.6D-07 2.7D-04 10 6.8D-11 1.8D-09 3.9D-07 3.4D-04 12 1.0D-12 2.7D-12 6.2D-09 1.6D-05 15 6.0D-14 4.8D-11 2.7D-09 2.4D-05 20 2.4D-13 1.8D-09 1.4D-07 3.2D-03 Table 4.6:  () = 1³sinh  2 i + 5´  for  = 0  = 10

(10)

 0()  00 () (3)() (4)() 2 2.2D-04 8.6D-04 6.7D-02 7.2D+00 3 1.3D-05 2.0D-05 1.0D-02 2.8D+00 4 2.5D-07 6.6D-06 1.6D-04 2.3D-01 5 4.6D-08 8.8D-07 1.6D-04 8.7D-02 6 5.7D-09 5.0D-08 2.6D-05 2.5D-02 7 3.0D-10 8.5D-10 1.7D-06 2.8D-03 8 3.9D-12 4.0D-10 6.6D-08 1.7D-05 9 1.7D-12 3.4D-11 2.4D-08 4.8D-05 10 1.3D-13 5.9D-12 2.4D-09 9.3D-06 12 1.1D-15 1.1D-11 2.4D-09 7.9D-06 15 9.4D-14 7.2D-12 1.1D-08 5.5D-06 20 3.1D-12 1.7D-09 4.9D-07 1.5D-02 Table 4.7:  () = 1³sinh  2 i + 5´  for  = 0  = 05 5. Conclusion

The method calculates the −th derivative of a function defined in the interval [A, B] at the points =  +  for

 = 0 1      where  =−  .

In calculating the − th derivative; the derivatives up to order ( − 2) at A are required. In order words these values are to be calculated at previous steps. In utilizing the method at the ( + 1)-th step following the -th step all cal-culations have to be redone. On the other hand matrix coefficients are not dependent on the function. They are uniquely determined for specific    and  values, Hence once the coefficient matrix is calculated it is re utilizable for different functions over and over again.

The method can be easily encoded on personal computers. Although increasing in valves generally makes positive contributions to the results, beyond a certain specific n value error values start growing.

The increase in the order of the derivative increases the error. Especially, fifth and higher order derivatives do not give good values. It is observed in the relevant tables that especially at the two end points  and  for high order derivatives serious diversions occur.

As a conclusion, it will be fair to state that when the derivative values for a function is known at ( + 1) points this method is capable of approximating the derivatives of order at equally spaced points ‘s quite well.

(11)

References

1.Berezin ,I.S. ZhidkorN.P.(1965): Computing Methods, vol. 1, Pergamon Press. Ox-ford,

2. Feuilebcis,F. (1990):Precise calculation of numerical derivatives using Lagrange and Hermite interpolation, Comput. Math. Appl. 19(5)1-11.

3.Kopal, Z. (1955):Numerical Analysis, Wiley, New York,.

4. Rashed, M.T.(2004):Lagrange interpolation to compute the derivatives of a func-tion, Appl. Math. Comput. 156 499-505.

Referanslar

Benzer Belgeler

In restricted form of ADEs we are used different order of Runge-Kutte Methods the results are close with smaller step size h, then here we use Runge-Kutta method of order four with

The T-test results show significant differences between successful and unsuccessful students in the frequency of using the six categories of strategies except

 Accessory fruit can be simple, aggregate, or multiple, i.e., they can include one or more pistils and other parts from the same flower, or the pistils and other parts of

The normal line is perpendicular to the tangent.. If the tangent has slope m, then the normal line has slope −

If f is differentiable at a, then f is continuous at a.. The proof is in

Mesleksel veya çevresel olarak bir kimyasal maddeye maruz kalan bir popülasyonda meydana gelebilecek genotoksik etkilerin izlenmesidir ve genetik toksikoloji metotları

We define here the delta (or Hilger) derivative in the integer group ring of an arbitrary group and we present a generalization of the Alexander polynomial of knots and links in S

But for the solutions of the SIS model expressed in terms of generalized logistic growth fun- ctions, we could express the location of the critical point in terms of the parameters