Methods2023 Exam 2 Section A · Q13CAS active1 mark
Newton's method algorithm with a For loop
The following algorithm applies Newton’s method using a For loop with 3 iterations.
Inputs: f(x), a function of x
df(x), the derivative of f(x)
x0, an initial estimate
Define newton(f(x), df(x), x0)
For i from 1 to 3
If df(x0) = 0 Then
Return “Error: Division by zero”
Else
x0 ← x0 − f(x0) ÷ df(x0)
EndFor
Return x0
The Return value of the function newton(x³ + 3x − 3, 3x² + 3, 1) is closest to
Hints, answer checking and worked solutions come with a Season Pass.