Nov-28-2016, 05:29 PM
(This post was last modified: Nov-28-2016, 05:35 PM by Linamellannamn.)
Hi! Can someone help me with this question? I dont understand how to do it and our teachers just say "google it" and I cant find something helpful...
Write a function ctrapezoidal(f, a, b, n) which implements the trape- zoidal approximation. Test this function for different n and compare your result to the exact integral. (Choose a simple function f that you can integrate by hand, e.g. ex. However, don’t make it too simple.)
I found a formula on google when I googled trapezoidal rule so I think that I should use it but I dont know how to do it in python :(
Write a function ctrapezoidal(f, a, b, n) which implements the trape- zoidal approximation. Test this function for different n and compare your result to the exact integral. (Choose a simple function f that you can integrate by hand, e.g. ex. However, don’t make it too simple.)
I found a formula on google when I googled trapezoidal rule so I think that I should use it but I dont know how to do it in python :(