python
Dashboard
My Repos
Compilers
Python Online
Node JS Online
Golang Online
codepy
Login
My Repos
Sign Out
Online Python Interpreter
Stop
Run
import math def y( x ): return (math.sin(2*x)+x**2) def trapezodial (a, b, n): h =(b -a) / n s=(y(a) + y(b)) i = 1 while i < n: s += 2 * y(a + i * h) i += 1 return ((h / 2) * s) x0 =1 xn =8 n =6 print("value of integral is", "%,4f"%trapezoidal(x0, xn, n))
Share this code with others
Public
Clear
My Repos
Repo
Lang
Login
Register
Login
Create a free account. No Credit card info required.
I agree with the Codepy
Term of Service
Sign Up