import numpy as np
def func(x):
    return np.cos(x)-x**2-x
 
def derivFunc( x ):
    return -np.sin(x)-2*x-1
 
def newtonRaphson( x ):
    h = func(x) / derivFunc(x)
    while abs(h) >= 0.0001:
        h = func(x)/derivFunc(x)
        x = x - h
    print("The value of the root is : ",
                             "%.4f"% x)
 
# Driver program to test above
x0 = -20 # Initial values assumed
newtonRaphson(x0)

8911e899c25f745448ee777aa0d0cf5947afe23b
<mask token>


def func(x):
    return np.cos(x) - x ** 2 - x


<mask token>


def newtonRaphson(x):
    h = func(x) / derivFunc(x)
    while abs(h) >= 0.0001:
        h = func(x) / derivFunc(x)
        x = x - h
    print('The value of the root is : ', '%.4f' % x)


<mask token>

<mask token>


def func(x):
    return np.cos(x) - x ** 2 - x


def derivFunc(x):
    return -np.sin(x) - 2 * x - 1


def newtonRaphson(x):
    h = func(x) / derivFunc(x)
    while abs(h) >= 0.0001:
        h = func(x) / derivFunc(x)
        x = x - h
    print('The value of the root is : ', '%.4f' % x)


<mask token>
newtonRaphson(x0)

<mask token>


def func(x):
    return np.cos(x) - x ** 2 - x


def derivFunc(x):
    return -np.sin(x) - 2 * x - 1


def newtonRaphson(x):
    h = func(x) / derivFunc(x)
    while abs(h) >= 0.0001:
        h = func(x) / derivFunc(x)
        x = x - h
    print('The value of the root is : ', '%.4f' % x)


x0 = -20
newtonRaphson(x0)

import numpy as np


def func(x):
    return np.cos(x) - x ** 2 - x


def derivFunc(x):
    return -np.sin(x) - 2 * x - 1


def newtonRaphson(x):
    h = func(x) / derivFunc(x)
    while abs(h) >= 0.0001:
        h = func(x) / derivFunc(x)
        x = x - h
    print('The value of the root is : ', '%.4f' % x)


x0 = -20
newtonRaphson(x0)

import numpy as np
def func(x):
    return np.cos(x)-x**2-x
 
def derivFunc( x ):
    return -np.sin(x)-2*x-1
 
def newtonRaphson( x ):
    h = func(x) / derivFunc(x)
    while abs(h) >= 0.0001:
        h = func(x)/derivFunc(x)
        x = x - h
    print("The value of the root is : ",
                             "%.4f"% x)
 
# Driver program to test above
x0 = -20 # Initial values assumed
newtonRaphson(x0)
