A non-iterative method for solving non-linear ... - Semantic Scholar

Report 0 Downloads 122 Views
Available online at www.sciencedirect.com

Applied Mathematics and Computation 198 (2008) 691–699 www.elsevier.com/locate/amc

A non-iterative method for solving non-linear equations

q

Beong In Yun School of Mathematics, Informatics and Statistics, Kunsan National University, 573-701, South Korea

Abstract In this paper, using a hyperbolic tangent function tanhðbxÞ, b > 0, we develop a non-iterative method to estimate a root of an equation f(x) = 0. The problem of finding root is transformed to evaluating an integral, and thus we need not take account of choosing initial guess. The larger the value of b, the better the approximation to the root. Alternatively we employ the signum function sgnðxÞ instead of the hyperbolic tangent function, which results in an exact formula for the root. Availability of the present method is shown by some numerical examples for which the traditional Newton’s method is not appropriate.  2007 Elsevier Inc. All rights reserved. Keywords: Newton’s method; Hyperbolic tangent function; Signum function; Non-linear equation

1. Introduction Newton’s method is known to be the best procedure for finding a root of an equation f(x) = 0 due to its formal simplicity and its fast convergence rate. It has been generalized in may ways for the solution of non-linear problems, for example, systems of non-linear equations and non-linear differential equations [1,2]. However, though the Newton’s method converges very rapidly once an iteration is fairly close to the root, one cannot expect good convergence when an initial guess is not properly chosen or when the slope of f(x) is extremely flat near the root. Another drawback of the Newton’s method is the necessity of knowing the first derivative f 0 (x) explicitly. Recently, a lot of iterative methods [3–11] based on the Newton’s method for solving non-linear equations were developed. Noticeable comments, with comparison, on these methods are given in [12]. In this paper we present a non-iterative procedure to approximate a root p* of an equation f(x) = 0 using two kinds of transforms based on a hyperbolic tangent function, tanhðbxÞ and a signum function, sgnðxÞ, respectively. In the result, the problem of solving an equation is reduced to evaluating an integral of a transformed function, say, f~ ðxÞ of f(x). The integral of f~ ðxÞ implicitly contains an information for the location of the root p* which is invariant under the transform. q This work was supported by the Korea Research Foundation Grant funded by the Korean Government (MOEHRD, Basic Research Promotion Fund) (KRF-2007-521-C00034). E-mail address: [email protected]

0096-3003/$ - see front matter  2007 Elsevier Inc. All rights reserved. doi:10.1016/j.amc.2007.09.006

692

B.I. Yun / Applied Mathematics and Computation 198 (2008) 691–699

Basically the present method requires neither any knowledge of the derivative f 0 (x) nor any iteration process. In addition, if the resultant estimate q of the root p* is not satisfactory one may apply the Newton’s method for the equation f(x) = 0 taking q as an initial guess. We can find that the present method is useful even for a function having a bad oscillation near the root or an extreme slope on the interval. 2. Approximate solution based on a sigmoid transform For any b > 0 we introduce a hyperbolic tangent function such as tanhðbxÞ ¼

e2bx  1 ; e2bx þ 1

1 < x < 1;

ð1Þ

which is strictly increasing from 1 to 1 producing a sigmoid curve. As b increases, tanh(bx) becomes steeper near its zero and it approaches a step function as shown in Fig. 1. Note that tanhðbxÞ is a sigmoid function [13,14], a kind of the so-called logistic function which is used for mathematical modelling in sociology or biology, for instance a model of non-sinusoidal circadian rhythms [15]. In this paper, employing the sigmoid function tanhðbxÞ, we aim to develop an efficient method to approximate a solution of an equation f(x) = 0 under the assumption that f(x) is a continuous function having a unique zero p* on an interval [a, b] with f(a) Æ f(b) < 0. First, we transform f(x) via tanhðbxÞ such as f ½b ðxÞ :¼ tanhðb  f ðxÞÞ; We call f

[b]

ð2Þ

a 6 x 6 b:

(x) a sigmoid transform of f(x). The present work is motivated by the following observations:

(i) The zero of the original function f(x) is invariant under the sigmoid transform f ½b ðxÞ. (ii) The graph of f ½b ðxÞ converges to that of sgn(f(x)) as b goes to the infinity (see Fig. 2), where sgn(t) is the signum function defined by 8 t>0 > < 1; sgnðtÞ :¼ 0; t¼0 ð3Þ > : 1; t < 0: That is, for b large enough the transformed function f [b](x) moves within a limited interval [1, 1] clustering almost every points toward the limits ±1 and its slope near the root is very steep.

1

0

β =1 β =4 β =20 -1 -5

-3

-1

1

3

Fig. 1. Graphs of tanh(bx) with respect to b.

5

B.I. Yun / Applied Mathematics and Computation 198 (2008) 691–699 8

1

0

-8

693

0

β =2 β =10 β =40

-1 -1

0

p*

2

(a) f(x)

-1

0

p*

2

(b) f [β ](x)

Fig. 2. Sigmoid transforms f[b](x), b ¼ 2; 10; 40, for a function f ðxÞ ¼ ðx  1Þesinð6xÞ þ 0:35.

Referring to the remarks mentioned above, we may consider an approximation formula Z b f ½b ðxÞdx  sgnðf ðaÞÞfðp  aÞ  ðb  p Þg

ð4Þ

a

for b largeR enough. The graphs in Fig. 2 are helpful in understanding the construction of this formula. Setting b Iðf ½b Þ :¼ a f ½b ðxÞdx in (4), we have 1 p  fa þ b þ sgnðf ðaÞÞ  Iðf ½b Þg: ð5Þ 2 The integral I(f [b] ) in (5) implicitly contains an information of the root p* which is invariant under the sigmoid transform. Replacing I(f [b] ) by its numerical evaluation eI ðf ½b Þ and denoting by q(b) the related approximation to p* in (5), we have a formula 1 ð6Þ qðbÞ ¼ fa þ b þ sgnðf ðaÞÞ  ~Iðf ½b Þg: 2 Since the transformed function f [b](x) with large b has a simple shape, one may obtain a good approximation eI ðf ½b Þ by any standard numerical integration rule. Thus, we can expect an excellent approximation q(b) to q* for any function having an improper behavior such as bad oscillation, flat or blowup. Furthermore, the evaluation of q(b) is useful even for a function which is not differentiable. When the approximation q(b) obtained by (6) is not sufficient one may additionally apply the Newton’s method, with an initial guess q0 = q(b), such as qnþ1 ¼ qn 

f ½b ðqn Þ ; 0 f ½b ðqn Þ

n ¼ 0; 1; 2; . . .

ð7Þ

as long as the first derivative of f(x) in the vicinity of the root p* is available. If b Æ f(q0) is small enough for some b, the iteration (7) can be replaced by f ðq Þ qnþ1 ¼ qn  0 n ; n ¼ 0; 1; 2; . . . ð8Þ f ðqn Þ because f ½b ðq0 Þ tanhðbf ðq0 ÞÞ f ðq Þ  0 0 : ¼ 0 2 ½b 0 f ðq0 Þ bf ðq0 Þsech ðbf ðq0 ÞÞ f ðq0 Þ 3. Solving an equation using a signum function Noting that the sigmoid transform f [b] (x) converges to sgn(f(x)) as b ! 1 in (4), we have an exact equation Z b sgnðf ðxÞÞdx ¼ sgnðf ðaÞÞfðp  aÞ  ðb  p Þg; ð9Þ a

694

B.I. Yun / Applied Mathematics and Computation 198 (2008) 691–699

which implies, for Iðsgnðf ÞÞ :¼

Rb a

sgnðf ðxÞÞdx,

1 ð10Þ p ¼ fa þ b þ sgnðf ðaÞÞ  Iðsgnðf ÞÞg: 2 Replacing the integral I(sgn(f)) by its numerical evaluation eI ðsgnðf ÞÞ and denoting by ~p the related approximation to p*, we have 1 ~ p ¼ fa þ b þ sgnðf ðaÞÞ  ~Iðsgnðf ÞÞg: 2

ð11Þ

In practical computation there are problems that the integrand sgn(f) in (11) is a logical function and that it is a discontinuous function, and thus basic numerical quadrature rules do not result in excellent estimation in general. Once, nevertheless, a good estimation eI ðsgnðf ÞÞ of I(sgn(f)) is possible in (11), we may obtain an accurate approximation to the root p*. On the other hand, suppose that g(x) is a continuous function having two simple zeros p1 and p2 in (a, b) with p1 < p2 . For a midpoint c = (a + b)/2 and any even integer m P 0, set Z b I m ðsgnðgÞÞ :¼ ðx  cÞm sgnðgðxÞÞdx: ð12Þ a

Taking m = 0 and m = 2 to determine the roots p1 and p2 , we have I 0 ðsgnðgÞÞ ¼ sgnðgðaÞÞf2ðp1  p2 Þ  ða  bÞg   sgnðgðaÞÞ 1 3 3 3 2½ðp1  cÞ  ðp2  cÞ   ða  bÞ : I 2 ðsgnðgÞÞ ¼ 3 4 Then it follows that pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi A4 þ 4AB A  pffiffiffi p1 ¼ c þ þ ; 2 2 3A

p2 ¼ p1  A;

ð13Þ

ð14Þ

where 1 A ¼ fa  b þ sgnðgðaÞÞ  I 0 ðsgnðgÞÞg; 2  1 1 3 ða  bÞ þ 3sgnðgðaÞÞ  I 2 ðsgnðgÞÞ : B¼ 2 4

ð15Þ

Substituting I0(sgn(g)) and I2(sgn(g)) in (14) by numerical estimations eI 0 ðsgnðgÞÞ and eI 2 ðsgnðgÞÞ, respectively, we have approximate roots, say, ~ p1 and ~ p2 . Consequently, we only have to evaluate two integrals I 0 ðsgnðgÞÞ and I 2 ðsgnðgÞÞ in (15) to find the roots p1 and p2 simultaneously. 4. Error analysis The following theorem provides an upper bound of an error of the present approximation q(b) given in the formula (6). Theorem 1. Suppose a continuous function f(x) has a unique zero p* on an interval (a, b) with f(a)f(b) < 0 and its first derivative exists on (a, b). Then for some d > 0, q(b) defined in (6) satisfies d2 fsmax ðbÞ  smin ðbÞg þ Ce2b þ jIðf ½b Þ  ~Iðf ½b Þj; 2 where C > 0 is a constant,  ¼ inf jxp j>d jf ðxÞj and jp  qðbÞj 6

smax ðbÞ ¼

max F ðb; gÞ;

0<jgp j , and thus we have jsgnðf ðxÞÞ  f ½b ðxÞj ¼ j1  tanhðbf ðxÞÞj ¼

2 6 2e2b : e2bf ðxÞ þ 1

Similarly, for x < p  d, f ðxÞ <  so that jsgnðf ðxÞÞ  f ½b ðxÞj ¼ j  1  tanhðbf ðxÞÞj ¼ Therefore, Z    

jxp j>d

2e2bf ðxÞ 6 2e2b : e2bf ðxÞ þ 1

  ðsgnðf ðxÞÞ  f ½b ðxÞÞdx 6 Ce2b

for some constant C > 0, and the proof is completed.

h

Theorem 1 implies that for sufficiently large b the error of q(b) depends on an error of the numerical integration, eI ðf ½b Þ of the sigmoid transform f [b]. That is, we may obtain an excellent approximation q(b) to the root p* as long as sufficiently accurate evaluation of eI ðf ½b Þ is possible for b large enough. For b not large enough, however, the upper bound of the error in (16) depends mainly on a deviation of the function 0 F ðb; xÞ ¼ f ½b ðxÞ over the interval 0 < jx  p j < d. 5. Numerical examples In this section we take three examples, fi(x) = 0, i = 1, 2, 3, for which the traditional Newton’s method is not available due to the existence of the extreme slope or bad oscillation. The graphs of each function fi and its ½b sigmoid transform fi needed in the present method are illustrated in Fig. 3. We have used the Mathematica V.5 with 25 digits of precision in fulfillment of the required numerical integrations. Example 1 f1 ðxÞ ¼ ð1  xÞ log x þ 2 ¼ 0;

06x61

whose root is  0.1066027644557068. Since f10 ðxÞ ¼ Oð1=xÞ near x = 0 and f10 ð1Þ ¼ 0, any endpoint of the interval (0,1) is not suitable for an initial guess of the Newton’s method. However, this situation is not a troublesome in applying the present method which does not require any information of the derivative. The second column in Table 1 shows absolute errors of the present approximation q(b) given in (6) for various values of b. p*

696

B.I. Yun / Applied Mathematics and Computation 198 (2008) 691–699 3

4

1

0 0 2

0

-9 0

0.5

1

-1

0

1

-2

1

1

1

0

0

0

-1 0

0.5

1

[β ]

(a) f1

(x)

-1 -1

1

1.5

2

1

1.5

2

-1 0

(b)

1

[β ] f2 (x)

(c) f3

[β ]

(x)

½b

Fig. 3. Sigmoid transforms fi ðxÞ of the examples fi(x), i = 1, 2, 3, for b = 4 (red line) and for b = 80 (blue line). (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

Table 1 ½b Numerical results of the present method (6) using the sigmoid transforms fi for the functions fi, i ¼ 1; 2; 3 b

20 40 80 120 400

Absolute errors jp  qðbÞj f1

f2

f3

8:4  105 2:1  105 5:2  106 2:3  106 2:1  107

4:3  104 3:0  106 2:7  1010 3:2  1014 1:1  1016

4:4  106 7:1  109 8:6  1010 1:7  109 1:1  109

It is suspected that the slow convergence rate of q(b), with respect to b, is due to a relatively large deviation of a function F 1 ðb; gÞ ¼ bf10 ðgÞsech2 ðbf1 ðgÞÞ, in Theorem 1, in the neighborhood of the root p*. To improve the error of q(b), the Newton’s method can be applied with an initial guess q0 = q(b) as given in (7) or (8). Numerical results are included in Table 2 compared with those of the traditional Newton’s method Table 2 Comparison of the roots pk’s of the traditional Newton’s method with the roots qk’s of the presented iteration (8) for f1 k

0 1 2 3 4 5

jp*  pkj

jp*  qkj

With p0 = 0.001

With q0 = q(10)

1

1:1  10 1:0  101 8:3  102 4:6  102 1:1  102 6:2  104

4

3:4  10 8:0  107 2:9  1012 0 0 0

With q0 = q(80) 5:2  106 1:9  1010 0 0 0 0

B.I. Yun / Applied Mathematics and Computation 198 (2008) 691–699

697

with an initial guess p0 = 0.001. Therein all the real numbers with magnitude less than 1 · 1018 in the computation were replaced by 0. Example 2  p 3 f2 ðxÞ ¼  x  ¼ 0; 6

1 6 x 6 1;

which has a multiple root p* = p/6 and it has an extremely small slope near the root. 2

Since f20 ðgÞ ¼ 3ðg  p Þ , a deviation of F 2 ðb; gÞ ¼ bf20 ðgÞsech2 ðbf2 ðgÞÞ in Theorem 1 is small near the root Therefore we can expect better approximations q(b) than those in the case of Example 1. Numerical results of the present approximation q(b) are given in the third column of Table 1. p*.

Example 3

pffiffiffi pffiffiffi pffiffiffi 2Þ sin½1=ðx  2Þ  2x þ 2 2 ¼ 0; 1 6 x 6 2 pffiffiffi whose exact root is p ¼ 2. We note that f3(x) is constantly oscillating in the neighborhood of the root p* and the first derivative satisfies limx!p f30 ðxÞ ¼ 1. Thus any iterative method like the Newton’s method is not available in this case, however close to p* an initial guess is. f3 ðxÞ ¼ ðx 

Based on Theorem 1, unfortunately, we are not confident of a good approximation to p* by the present method because the derivative f30 ðxÞ oscillates between 0 and 1. Nevertheless the present method produces satisfactory results as given the fourth column in Table 1. And a halt of convergence for b > 80 seems to ½b ½b be due to an error of the numerical integration ~Iðf3 Þ for f3 which has lasting wiggles near the root. In addition, we consider an example with two simple roots: Example 4 gðxÞ ¼

x

1 fesin½10ðxpÞ þ 4ðx  pÞ  1g ¼ 0; 2

06x64

which has two roots, p1 ¼ 12 and p2 ¼ p. Fig. 4 shows the graphs of g(x) and its sigmoid transforms g[b](x) for b = 1, 40. Replacing sgn(g) by g[b] in the formulas (12)–(15), we have approximate roots q1(b) and q2(b) for p1 and p2 , respectively, as below. pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi A4 þ 4AB A pffiffiffi q1 ðbÞ ¼ c þ þ ð17Þ ; q2 ðbÞ ¼ q1 ðbÞ  A; 2 2 3A

20

1

β =1 β =40

10 0 0

-10 0

-1 2

(a) g (x)

4

0

2

(b) g[β ](x)

Fig. 4. Sigmoid transforms g½b ðxÞ, b = 1, 40, for g(x) in Example 4.

4

698

B.I. Yun / Applied Mathematics and Computation 198 (2008) 691–699

Table 3 Numerical results of the present method (17) using the sigmoid transforms g[b] for the function g in Example 4 jp1  q1 ðbÞj

b

6

1:6  10 4:0  107 2:5  108 6:3  109 4:5  1011

50 100 400 800 4000

jp2  q2 ðbÞj 2:6  106 6:4  107 4:0  108 1:0  108 1:9  1010

where 1 A ¼ fa  b þ sgnðgðaÞÞ  I 0 ðg½b Þg; 2  1 1 3 ða  bÞ þ 3sgnðgðaÞÞ  I 2 ðg½b Þ B¼ 2 4

ð18Þ

and I m ðg½b Þ ¼

Z

b

ðx  cÞm g½b ðxÞdx;

m ¼ 0; 2:

ð19Þ

a

Numerical results of absolute errors, jp1  q1 ðbÞj and jp2  q2 ðbÞj are given in Table 3. It is noted that relatively large values of b are required to enhance the accuracy. 6. Conclusions In this paper, we have proposed a non-iterative method to estimate a solution p* of a non-linear equation f(x) = 0. Using the so-called sigmoid transform f ½b ðxÞ ¼ tanhðbf ðxÞÞ, we have derived the formula (6) for qðbÞ  p where only a numerical integration of f [b] (x) is required. Conclusive remarks on the present method are summarized as follows. (i) Once an accurate numerical integration of f [b](x) is possible, we can expect an excellent approximation q(b) for large b. (ii) The present method is always useful regardless of the condition of the derivative f 0 (x). (iii) If the present approximation q(b) in (6) is not sufficient, we may additionally apply an iterative method with an initial guess q0 = q(b) to obtain further accurate result. That is, the present method provides a good initial guess of an iterative method without any constraint. Additionally, we have derived another formula (11) using a signum function. As mentioned in Section 3 partially, we may extend this idea to find a finite number of solutions simultaneously. References [1] K.E. Atkinson, An Introduction to Numerical Analysis, John Wiley & Sons, Singapore, 1989. [2] C.T. Kelley, Iterative Method for Linear and Nonlinear Equations, SIAM, Philadelphia, 1995. [3] M. Basto, V. Semiao, F.L. Calheiros, A new iterative method to compute nonlinear equations, Appl. Math. Comput. 173 (2006) 468– 483. [4] J. Chen, New modified regula falsi method for nonlinear equations, Appl. Math. Comput. 184 (2007) 965–971. [5] H.H.H. Homeier, A modified Newton method with third-order convergence, J. Comput. Appl. Math. 157 (2003) 227–230. [6] J. Kou, Y. Li, A. Wang, A modification of Newton method with third-order convergence, Appl. Math. Comput. 181 (2006) 1106– 1111. [7] M.A. Noor, F. Ahmad, Numerical comparison of iterative methods for solving nonlinear equations, Appl. Math. Comput. 180 (2006) 167–172. [8] M.A. Noor, F. Ahmad, S. Javeed, Two-step iterative methods for nonlinear equations, Appl. Math. Comput. 181 (2006) 1068–1075. [9] M.A. Noor, New iterative methods for nonlinear equations, Appl. Math. Comput., doi:10.1016/j.amc.2006.05.146. [10] L.D. Petkovic´, D. Herceg, On rediscovered iteration methods for solving equations, J. Comput. Appl. Math. 107 (1999) 275–284.

B.I. Yun / Applied Mathematics and Computation 198 (2008) 691–699

699

[11] N. Ujevic´, A method for solving nonlinear equations, Appl. Math. Comput. 174 (2006) 1416–1426. [12] L.D. Petkovic´, M.S. Petkovic´, A note on some recent methods for solving nonlinear equations, Appl. Math. Comput. 185 (2007) 368– 374. [13] http://en.wikipedia.org/wiki/Logistic_function. [14] S.E. Kingsland, Modeling Nature, University of Chicago Press, 1995. [15] M.R. Marler, P. Gehrman, J.L. Martin, S. Ancoli-Israel, The sigmoidally transformed cosine curve: a mathematical model for circadian rhythms with symmetric non-sinusoidal shapes, Statist. Med. 25 (2006) 3893–3904.