Question: Convert the following code into python coding. (Code written for adaptive Simpsons method) # Written by Leon Brin # Purpose: Implementation of adaptive Simpson's #
# Written by Leon Brin # Purpose: Implementation of adaptive Simpson's # rule # INPUT : function f, interval endpoints a and b, # 15 May 2014 # desired accuracy TOL. # OUTPUT: approximate integral of f(x) from a to b # within TOL of actual function adaptSimp(f,a,b,TOL) res = h (b-a)/4; fo = f (a); f1 = f (a+h); f2 = f (a+2*h); f4 = f (b); error = abs (h* (f0-4*(f1+f3)+6xf2+14))/45 ; if (error
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
