Symbolic integration is done through the following steps:
- The definite integral of a polynomial function on a finite domain [a,b] can be computed very accurately via the fundamental theorem of calculus, using the numpy.polynomial module. For instance, to calculate the integral of the polynomial p(x)=x5 on the interval [-1,1].
- We could issue the following part integrating both parts.
- You need to do the following:
In [1]: import numpy as npIn [2]: p = np.poly1d([1,0,0,0,0,0]); \ ...: print (p) ...: print (p.integ()) 51 x 60.1667 xIn [3]: p.integ()(1.0) - p.integ()(-1.0)Out[3]: 0.0
- In general, obtaining exact values for a definite integral of a generic function is hard and computationally inefficient. This is possible in some ...