Numerical Methods for Engineers (7th Edition) by steven chapra. I need a sloutio
ID: 3847455 • Letter: N
Question
Numerical Methods for Engineers (7th Edition) by steven chapra. I need a sloution for problem exercie 4.10 and 4.12 using python
Using series.py while solving the questions using python
Python Code for series.py is given below
Code starts from here:
import math
def taylor(dfdx, n, xi, h, start=0):
"computes the nth order taylor series of f(xi+h)"
#n: order
#xi: reference point
#h: step-size (h = x(i+1) - xi)
#dfdx(i,xi): ith derivative of f(xi) for i=0,1,..,n" [dfdx(0,xi) is f(xi)]
sum = .0
for i in range(start, n+1): #loop from i=start to n
sum += dfdx(i, xi) * h**i / math.factorial(i)
return sum
#end taylor()
Explanation / Answer
import math
def taylor(dfdx, n, xi, h, start=0):
"computes the nth order taylor series of f(xi+h)"
#n: order
#xi: reference point
#h: step-size (h = x(i+1) - xi)
#dfdx(i,xi): ith derivative of f(xi) for i=0,1,..,n" [dfdx(0,xi) is f(xi)]
sum = .0
for i in range(start, n+1): #loop from i=start to n
sum += dfdx(i, xi) * h**i / math.factorial(i)
return sum
#end taylor()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.