Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in this code the equation is hard coded i want this code to be change in like user can give any kind of equation. (Additional

image text in transcribed

in this code the equation is hard coded i want this code to be change in like user can give any kind of equation.

(Additional info this is the code of bisection method) written form of code:

import math N=int(input("Enter the no. Of Iterations :")) TOL=float(input("Enter the Error Tolerance :")) a=input("Enter the left endpoint of the interval:") a=int(a) b=input("Enter the right endpoint of the interval:") b=int(b) #------------------------Processing Section-----------------# xn=b x0=a x1=b fx0=4*x0 + math.sin(x0) - math.exp(x0) fx1=4*x1 + math.sin(x1) - math.exp(x1) for k in range(2,N+2): xp=xn xn=x0 + (x1-x0)/2 fxn=4*xn + math.sin(xn) - math.exp(xn) err = abs(xn-xp)/abs(xn) print("After",k-1,"iteration the approximate root=",xn) print("f(x)=",fxn," Error=",err) if(fxn

if(err

# import math N=int(input("Enter the no. Of Iterations :") TOL=float(input("Enter the Error Tolerance :")) a=input("Enter the left endpoint of the interval:") a=int(a) b=input("Enter the right endpoint of the interval:") b=int(b) -Processing Section-- xn=b xora x1=b fx@=4*xo + math.sin(x0) math.exp(x0) fx1=4*x1 + math.sin(x1) math.exp(x1) for k in range(2,N+2): xp=xn xn=x + (x1-xo)/2 fxn=4*xn + math.sin(xn) - math.exp(xn) abs(xn-xp)/abs(xn) print("After", k-1, "iteration the approximate root=",xn) print("f(x)=",fxn," Error=",err) if(fxn

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

Students also viewed these Databases questions

Question

5. Develop a self-management module for a training program.

Answered: 1 week ago