Question: PYTHON CODE: Consider the equation X 4 = X 3 +10. [a,b]= [2,3] Write a PYTHON code to find the number of steps of Bisection

PYTHON CODE: Consider the equation X4= X3+10.

[a,b]= [2,3]

Write a PYTHON code to find the number of steps of Bisection method are required to calculate the solution within 10-10. Use a for loop.

CODE SO FAR: (not right):

#!/usr/bin/python import math

#Interval is [2,3] # tolerance is 10^-10 = 0.0000000001 # f(x) is x^4-x^3 - 10

a=2.0 b=3.0 y = 0.0 c = 0.0 count = 1 for i in range(10000000): count = count+1 c = (a+b)/2.0 y = (math.pow(a,4)-math.pow(a,3) - 10) * (math.pow(c,4)-math.pow(c,3) - 10) print(y) if abs(y) < 0.0000000001: break if y > 0: a = c if y < 0: b = c

print(count)

(answer should be 33 or 34)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!