Create definiteIntegralFunc.py

Created Definite Integral function within limits 0 to 1.
This commit is contained in:
helplessThor
2020-10-20 12:07:00 +05:30
committed by GitHub
parent 238a825874
commit fbd8849259

View File

@@ -0,0 +1,22 @@
from .__init__ import *
from ..__init__ import Generator
from scipy.integrate import quad
def definiteIntegralFunc(max_coeff=100):
def integrand(x, a, b, c):
return a*x**2 + b*x + c
a = random.randint(0, max_coeff)
b = random.randint(0, max_coeff)
c = random.randint(0, max_coeff)
I = quad(integrand, 0, 1, args=(a, b, c))[0]
I = round(I, 4)
problem = "The definite integral within limits 0 to 1 of the equation "+ str(a) +"x^2 + "+ str(b) +"x + "+ str(c) +" is = "
solution = str(I)
return problem, solution