Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python | Scipy integrate.romb() method

  • Last Updated : 23 Jan, 2020

With the help of scipy.integrate.romb() method, we can get the romberg integration using samples of a function from limit a to b by using scipy.integrate.romb() method.

Syntax : scipy.integrate.romb(y, dx, axis, show)
Return : Return the romberg integration of a sample.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

Example #1 :
In this example we can see that by using scipy.integrate.romb() method, we are able to get the romberg integration using samples of a function from limit a to b by using this method.






# import numpy and scipy.integrate
import numpy as np
from scipy import integrate
x = np.arange(3, 12)
  
# using scipy.integrate.romb() method
gfg = integrate.romb(x)
  
print(gfg)

Output :

56.0

Example #2 :




# import numpy and scipy.integrate
import numpy as np
from scipy import integrate
x = np.arange(3, 12)
y = np.cos(np.power(x, 3.5))
  
# using scipy.integrate.romb() method
gfg = integrate.romb(y)
  
print(gfg)

Output :

-3.5943771512643674

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!