<jupyter_start><jupyter_text>---   indefinite integral= anti derivative$$ \dfrac{dF(x)}{dx} = f(x)  \;\;\leftrightarrow \;\; F(x) = \int f(x)dx + C $$- ex$$ \int 3x^2 dx= x^3 + c$$$$ \int (3x^2-6x+1)dx = x^3 -3x^2 + x + c $$$$\int(2 + 6x+ 4\exp(x) + \dfrac{5}{x})dx = 2x + 3x^2 + 4\exp (x) + 5\log x + c$$$$ \int \dfrac{2x}{x^2-1}dx = \log (x^2-1) + c$$ ---  derivative of partial differentiation$$ \dfrac{\partial F_1(x, y)}{\partial x} = f(x, y) \;\; \leftrightarrow \;\; F_1(x, y) = \int f(x, y)dx + C(y) $$$$ \dfrac{\partial F_2(x, y)}{\partial x} = f(x, y) \;\; \leftrightarrow \;\; F_2(x, y) = \int f(x, y)dy + C(x) $$- ex$$ \int (1+ xy)dx = x + \dfrac{1}{2}x^2y + C(y)$$$$ \int xy\exp(x^2+y^2)dx = \dfrac{1}{2}y\exp(x^2+y^2) + C(y) $$ ---  $n$th derivative, multiple integration- also called higher derivative$$ \dfrac{\partial^2 F_3(x)}{\partial x\partial y} = f(x, y) \;\;\leftrightarrow \;\;F_3(x, y) = \iint f(x, y)dxdy $$- ex$$\iint xy \exp({x^2 + y^2}) dxdy\;\; = \dfrac{1}{4}\exp(x^2+y^2)$$ ---  integration by SymPy<jupyter_code>import sympy
sympy.init_printing(use_latex='mathjax')
x, y = sympy.symbols('x y')
f = x*y*sympy.exp(x**2+y**2)
f
F_x = sympy.integrate(f, x)
F_x
sympy.integrate(F_x, y)<jupyter_output><empty_output><jupyter_text>---  definite integral$$ \int_{a}^{b} f(x)dx $$- Fundamental Theorem of Calculus$$ \int_{a}^{b} f(x)dx = F(b) - F(a) $$ - practice (with sympy)$$ \int_{0}^{2} (x^3 -3x^2+ x +6)dx $$<jupyter_code>f = x **3 - 3*x**2 + x + 6
f
# indefinite integration
F = sympy.integrate(f)
F
# Fundamental Theorem
(F.subs(x, 2) - F.subs(x, 0)).evalf() 
# numuerical integration
def f(x):
    return x **3 - 3*x**2 + x + 6
sp.integrate.quad(f, 0, 2) # ( ans, error)<jupyter_output><empty_output><jupyter_text>---  multiple integral- double integral$$ volume = \int_{y=c}^{y=d} \int_{x=a}^{x=b} f(x, y)dxdy $$- integral    - f(x, y) is 2-dimensional function, but choose one variable and take the other one to constant(or think that fix y)    - ex     $$ f(x, y) = 4x^2 + 4xy + y^2 $$     $$ f(x; y) = 4x^2 + (4y)x + (y^2) $$ - practice$$ \int_{-1}^1\int_{-1}^1 \left(1+xy\right) dxdy $$ - Fundamental Theorem<jupyter_code>import sympy
from sympy import Matrix
x1, x2 = sympy.symbols('x1 x2')
X = Matrix([sympy.log(x1-1), x2**3])
X
X2= Matrix([2*x1**2, sympy.exp(x2-1)])
X2
Y = Matrix([[x1], [x2]])
print(X, Y)
X.jacobian(Y)
x, y = sympy.symbols('x y')
f = 1 + x*y
F_x = sympy.integrate(f, x) # x integrate 
X = (F_x.subs(x, 1) - F_x.subs(x, -1)).evalf()

F_xy = sympy.integrate(X, y) # y integrate
Y = (F_xy.subs(y, 1) - F_xy.subs(y, -1)).evalf()
X
Y<jupyter_output><empty_output><jupyter_text>- numerical integration<jupyter_code>def f(x, y):
    return  1 + x*y

sp.integrate.nquad(f, [[-1, 1], [-1, 1]])
def f(x, y):
    return np.exp(-x*y) / y**2

print(sp.integrate.dblquad(f, 1, np.inf, lambda x:0, lambda x: np.inf))
sp.integrate.nquad(f, [[0, np.inf], [1, np.inf]])<jupyter_output>(0.4999999999999961, 1.0684538743333441e-08)
{'fraction_non_alphanumeric': 0.24848484848484848, 'fraction_numerical': 0.05016835016835017, 'mean_word_length': 3.9107438016528926, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '30465', 'license': 'MIT', 'n_tokens_mistral': 1486, 'n_tokens_neox': 1392, 'n_words': 309, 'path': 'Past/DSS/Math/180128_1_integral.ipynb', 'repo_name': 'Moons08/TIL', 'size': '2970'}