Question: Consider using Newton's method to find the roots of the following function: f ( x ) = x 3 + 6 x 2 + 7
Consider using Newton's method to find the roots of the following function:
fxxxx
Fill in the gaps in the answer box below with Python lambda functions to represent the functions fx and fx that can be used with the Python function newtonrootfinder shown in the course material to find a root of this function.
Also fill in the gap in the line defining the numpy array xarray with suitable initial values to use to find each of the roots of the function in order lowest to highest to decimal places using at most iterations of Newton's method.
Hint: Plotting the function using Python or Desmos will help you to find suitable initial values for each root. These do not need to be exact! Initial values to only one decimal place are sufficient.
Your code will be tested by checking what root is found by each of your initial values.
For example if the code is tested with this test code:
x xarray
root newtonrootfinderf
fprime,
x
tol,
maxiterations
printThe first root"
printfis root:f dps
the result should give the value of the first lowest root of the function.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
