Jul-12-2020, 07:27 PM
Hey guys,
I am trying this code out for an assignment and keep getting "SyntaxError: invalid syntax" on the print function.
Appreciate the help.
I am trying this code out for an assignment and keep getting "SyntaxError: invalid syntax" on the print function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
def f(x): return 2 * x * x * x - 11.7 * x * x + 17.7 * x - 5 x0 = 3 xold = 0 def modifiedsecant(x0): lamda = 0.01 i = 0 while (i < 4 ): xold = x0 i = i + 1 x0 = x0 - ((lamda * x0 * f(x0)) / (f(x0 + (lamda * x0)) - f(x0)) print (x0) modifiedsecant(x0) |