Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question is based on a numerical method called Newton's method. Newton's method is an algorithm to find the roots (or zeroes) of a real-valued

image text in transcribed
This question is based on a numerical method called Newton's method. Newton's method is an algorithm to find the roots (or zeroes) of a real-valued function. Suppose that a differentiable function f:(a,b)R defined on an interval (a,b) is given and we want to find a good approximate solution for the following equation: f(x)=0 First, we start with a random number x0. Then try to obtain a better approximate value for the root of equation (1) with each iteration : xn=xn1f(xn1)f(xn1) where n is a nonegative integer. Here, n is called the iteration number. Define a function called newton which takes four inputs: an initial point x0, a function f, a function Df representing the derivative of f and an iteration number n. The output should be xn calculated by equation (2) for the given n in the input. To avoid division by zero if f(xi) becomes zero the iteration should stop, print a warning that is given in the answer box, and return the last calculated value if there is any. Note that, to stop the iteration we use the command "break". For example, the following example test calculates an approximate value for sqrt(2), i.e. finds a positive approximate solution for x22=0. For example

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems On GPUs In Databases

Authors: Johns Paul ,Shengliang Lu ,Bingsheng He

1st Edition

1680838482, 978-1680838480

More Books

Students also viewed these Databases questions

Question

Identify three ways to manage an intergenerational workforce.

Answered: 1 week ago

Question

Prepare a Porters Five Forces analysis.

Answered: 1 week ago

Question

Analyze the impact of mergers and acquisitions on employees.

Answered: 1 week ago