Python  1.0
Functions
_04b_xx_eq_sinx Namespace Reference

Finding roots (or zeroes) of a real-valued function, by using Newton's Method. More...

Functions

def xx_eq_sinx ()
 Solves the equation \(x^{2} = sin (x)\). More...
 
def main (argv=None)
 

Detailed Description

Finding roots (or zeroes) of a real-valued function, by using Newton's Method.

\[x_{n+1} = x_n - \frac {f(x_n)} {f'(x_n)}.\]

Consider \(x^{2} - sin(x) = 0\), which gives us the following recursive formula:

\begin{eqnarray*} x_{k+1} &=& x_k - \frac {(x_k²-sin(x_k))}{(2*x_k - cos(x_k))}, k >= 0, x_0 > 0 \\ &=& \frac {(x_k² - x_k*cos(x_k) + sin(x_k))}{(2*x_k - cos(x_k))}, \\ x_0 &=& 1. \end{eqnarray*}

Stopping condition: \( | x_{k+1} - x_k | < \epsilon \)

Alternative way, by using the first two terms of the Mclaurin series for sin(x):

\[x^{2} - (x - \frac{x^{3}}{3!}) = 0\]

or

\[6x^{2} - 6x + x^{3} = 0 => x^{2} + 6x - 6 = 0\]

\[x = \sqrt{15} - 3 = 0.872983346\]

Remainder \(< \frac {x^{5}}{5!} < \frac {1}{200} = 0.005\)

Author
Paulo Roma
Since
29/10/2012
See also
http://www.duke.edu/~dga2/cps149s/
http://en.wikipedia.org/wiki/Integer_square_root
http://en.wikipedia.org/wiki/Newton's_method

Function Documentation

◆ main()

def _04b_xx_eq_sinx.main (   argv = None)

References xx_eq_sinx().

◆ xx_eq_sinx()

def _04b_xx_eq_sinx.xx_eq_sinx ( )

Solves the equation \(x^{2} = sin (x)\).

Returns
solution for the equation.

Referenced by main().