Question
using python without using any powerful functions in pycharm besides the math and copy functions. Write a function defined as: def Secant(fcn, x0, x1, maxiter=10,
using python without using any powerful functions in pycharm besides the math and copy functions.
Write a function defined as: def Secant(fcn, x0, x1, maxiter=10, xtol=1e-5):
Purpose: use the Secant Method to find the root of fcn (x), in the neighborhood of x0 and x1.
fcn: the function for which we want to find the root
x0 and x1: two x values in the neighborhood of the root
xtol: exit if the |xnewest - xprevious| < xtol
maxiter: exit if the number of iterations (new x values) equals this number
return value: the final estimate of the root (most recent new x value)
Write and call a main () function that uses your Secant function to estimate and print the solution of:
x-3cos(x)=3: with x0=1, x1=2, maxiter= 5 and xtol= 1e-4
cos(2x)(x^3)= 0: with x0= 1, x1=2, maxiter=15 and xtol= 1e-8
cos(2x)(x^3)= 0: with x0= 1, x1=2, maxiter=3 and xtol= 1e-8
3cos
0
xx
;
with x0=1, x1= 2, maxiter
= 5 and xtol = 1e
-
4
3
cos 2
0
xx
;
with x0=1, x1= 2, maxiter = 15 and xtol = 1e
-
8
3
cos 2
0
xx
with x0=1, x1= 2, maxiter = 3 and xtol = 1e
-
8
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started