2017-10-18

Oct 18 In-Class Exercise.

Post your solutions to the Oct 18 In-Class Exercise to this thread.
Best,
Chris
Post your solutions to the Oct 18 In-Class Exercise to this thread. Best, Chris

-- Oct 18 In-Class Exercise
Resource Description for IMG_4341.jpg
((resource:IMG_4341.jpg|Resource Description for IMG_4341.jpg))

-- Oct 18 In-Class Exercise
Xn+1 = Xn - f(xn)/f'(xn)
f'(xn) = 2*(x-2)*(x-3)^2 + 2*(x-2)^2*(x-3)
x1, where x0=5, => 5- 3^2*2^2 / (60) = 4.4
    xs = [5]
    def f(x):
        return ((x-2)**2)*(x-3)**2
     def f_prime(x):
        return (2*(x-2))*(x-3)**2 + 2*((x-2)**2)*(x-3)
    print "x0", xs[0]
    for i in range(0,4):
        temp = xs[i] - f(xs[i])*1.0 /f_prime(xs[i])
        print "x" + str(i+1), temp
        xs.append(temp)
  • x0 5
  • x1 4.4
  • x2 3.95789473684
  • x3 3.63629108873
  • x4 3.40722182808
(Edited: 2017-10-18)
Xn+1 = Xn - f(xn)/f'(xn) f'(xn) = 2*(x-2)*(x-3)^2 + 2*(x-2)^2*(x-3) x1, where x0=5, => 5- 3^2*2^2 / (60) = 4.4 xs = [5] def f(x): return ((x-2)**2)*(x-3)**2 def f_prime(x): return (2*(x-2))*(x-3)**2 + 2*((x-2)**2)*(x-3) print "x0", xs[0] for i in range(0,4): temp = xs[i] - f(xs[i])*1.0 /f_prime(xs[i]) print "x" + str(i+1), temp xs.append(temp) *x0 5 *x1 4.4 *x2 3.95789473684 *x3 3.63629108873 *x4 3.40722182808

-- Oct 18 In-Class Exercise
 
 X0 = 5
 X1 = 4.4
 X2 = 3.95
 X3 = 3.63
 X4 = 3.40
(Edited: 2017-10-18)
X0 = 5 X1 = 4.4 X2 = 3.95 X3 = 3.63 X4 = 3.40

-- Oct 18 In-Class Exercise
The values are [4.4, 3.9578947368421056, 3.636291088732662, 3.4072218280790185, 3.2493080115220376]
Used the program :
def fun_diff(x):
    prod_1 = (x-2)*((x-3)**2)
    prod_2 = (((x-2)**2)*(x-3))
    return 2*(prod_1 + prod_2)
def fun_val(x):
    val_1 = (x-2)**2
    val_2 = (x-3)**2
    return val_1*val_2
def update_val(x):
    frac = fun_val(x)/fun_diff(x)
    return x-frac
if __name__ == "__main__":
   x = 5
   count = 5
   output = []
   while count > 0:
         val = update_val(x)
         output.append(val)
         x = val
         count -= 1
   print (" values are : ",output)
(Edited: 2017-10-18)
The values are [4.4, 3.9578947368421056, 3.636291088732662, 3.4072218280790185, 3.2493080115220376] Used the program : def fun_diff(x): prod_1 = (x-2)*((x-3)**2) prod_2 = (((x-2)**2)*(x-3)) return 2*(prod_1 + prod_2) def fun_val(x): val_1 = (x-2)**2 val_2 = (x-3)**2 return val_1*val_2 def update_val(x): frac = fun_val(x)/fun_diff(x) return x-frac if __name__ == "__main__": x = 5 count = 5 output = [] while count > 0: val = update_val(x) output.append(val) x = val count -= 1 print (" values are : ",output)

-- Oct 18 In-Class Exercise
 X1 = X0 - f(X0)/f'(X0)
 X1 = 4.4
 X2 = 3.95
 X3 = 3.63
 X4 = 3.40
X1 = X0 - f(X0)/f'(X0) X1 = 4.4 X2 = 3.95 X3 = 3.63 X4 = 3.40

-- Oct 18 In-Class Exercise
f' = 4x^3 -30x^2 + 72x -72
f/f' = 1/4x-5/8 with a remainder of 1/4x2-9x-9
for x0 = 5.0 x1 = 4.4
f' = 4x^3 -30x^2 + 72x -72 f/f' = 1/4x-5/8 with a remainder of 1/4x2-9x-9 for x0 = 5.0 x1 = 4.4

-- Oct 18 In-Class Exercise
  • f(x)' = 2(x-2) . (x-3)^2 2(x-3) . (x02)^2 xn+1 = xn - f(x)/f'(x) x1 = 5 - 36/60 = 4.4 x2 = 3.96 x3 = 3.96 - 3.53/10.9 = 0.33
* f(x)' = 2(x-2) . (x-3)^2 2(x-3) . (x02)^2 xn+1 = xn - f(x)/f'(x) x1 = 5 - 36/60 = 4.4 x2 = 3.96 x3 = 3.96 - 3.53/10.9 = 0.33

-- Oct 18 In-Class Exercise
f(x) = (x-2)**2 * (x - 3)**2
f'(x) = 2*((x-3)**2)*(x-2)+2*(x-3)*((x-2)**2)
using xn+1 = xn + f(x) / f'(x)
x1 = 4.4
x2 = 3.95
x3 = 3.63
x4 = 3.40
(Edited: 2017-10-18)
f(x) = (x-2)**2 * (x - 3)**2 f'(x) = 2*((x-3)**2)*(x-2)+2*(x-3)*((x-2)**2) using xn+1 = xn + f(x) / f'(x) x1 = 4.4 x2 = 3.95 x3 = 3.63 x4 = 3.40

-- Oct 18 In-Class Exercise
x0 = 5
f(x) = ((x-3)**2 ) * ((x-2)**2)
f'(x) = 2*(x-2) * (x-3) * (2x-5)
x1 = 4.4
x2 = 3.958
x3 = 3.636
x4 = 3.407
(Edited: 2017-10-18)
x0 = 5 f(x) = ((x-3)**2 ) * ((x-2)**2) f'(x) = 2*(x-2) * (x-3) * (2x-5) x1 = 4.4 x2 = 3.958 x3 = 3.636 x4 = 3.407
[ Next ]
X