# Computer Quiz 2

This is an example problem that illustrates the type of question
that will appear on the computer quiz. Note this particular
example covers Newton's method, whereas only the secant method is
included in the actual list of study questions.
## Example Problem

Either create a new program or add the missing code and data
to the program
# Find 9 iterations of Newton's method for x0=1 and the
# polynomial p(x)=x^5-3x^3-5x^2+15.
println("This is the example problem for Quiz 2.")
xn=[1.57142857142857, 1.65117170652226,
1.68628082475969, 1.70211084458455,
1.70837387112583, 1.70987638821569,
1.7099755102779, 1.70997594666823,
1.7099759466767 ]
function newton(x)
# Please fix this function
return x
end
# Please fix the definition of x
x=3.0
wrong=9
for i=1:9
global wrong,x
x=newton(x);
println("x_$i = $x")
if abs(x-xn[i])<1e-7
wrong-=1
end
end
if wrong>0
println("Please try again. Your answer is incorrect.")
else
println("Congratulations! Your answer is correct!")
end

to approximate a solution to p(x)=0 using 9
iterations of Newton's method
where
p(x)=x^{5}-3x^{3}-5x^{2}+15
and x_{0}=1.
Note that the correct answer is

x_{1} ≈ 1.57142857142857,
x_{2} ≈ 1.65117170652226,
x_{3} ≈ 1.68628082475969,
x_{4} ≈ 1.70211084458455,

x_{5} ≈ 1.70837387112583,
x_{6} ≈ 1.70987638821569,

x_{7} ≈ 1.7099755102779,
x_{8} ≈ 1.70997594666823,

x_{9} ≈ 1.7099759466767.