Riemann积分有两个局限:一是积分区间[a, b]必须有限;二是被积函数f(x)在积分区间[a, b]上有界。而反常积分(Improper Integral)就是对Riemann积分这两个局限的扩展,前者扩展后被称为“无穷积分”,后者扩展后被称为“瑕积分”。
本节的内容属于“微积分的扩展”,课程中介绍的本就不太详细,主要讨论反常积分的“敛散性”我就不作扩展了,仅用Python辅助,展示课后练习和单元测试的解答。
#Exercise 7-7-1
from sympy import *
init_printing()
x = Symbol('x')
f = 1 / (1 + E ** x) ** 2
f, integrate(f, (x, 0, +oo))
(1(ex+1)2,−12+log(2))
#Exercise 7-7-2
x = Symbol('x')
f = 1 / (x ** 2 + 4 * x + 9)
f, integrate(f, (x, -oo, +oo))
(1x2+4x+9,5√π5)
#Exercise 7-7-3
x = Symbol('x')
f = log(x) / (1 + x) ** 2
f, integrate(f, (x, 0, +oo))
(log(x)(x+1)2,0)
#Exercise 7-7-4
x = Symbol('x')
f = 1 / sqrt(abs((1 - x)))
f1 = 1 / sqrt(1 - x)
f2 = 1 / sqrt(x - 1)
f, integrate(f1, (x, 0, 1)), integrate(f2, (x, 1, 2))
(1|x−1|−−−−−√,2,2)
#Exercise 7-7-4
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
#x = np.array(filter(lambda t:t != 1, np.linspace(0, 2))).flatten()
x = np.linspace(0, 2)
t = np.asarray([1]).repeat(x.size)
y = 1 / np.sqrt(np.abs((t - x)))
plt.plot(x,y)
plt.show()
Exercise 7-7-5
∫10x1−x−−−−−√dx=?
解:本题直接用sympy计算不出来,观察它的被积函数,其中含有2次根号,很容易相等“三角函数平方和/差公式”,令 x=sin2(t) ,得:
∫10x1−x−−−−−√dx=∫π20tan(t)d[sin2(t)]=2∫π20sin2(t)dt
#Exercise 7-7-3
x = Symbol('x')
f = sin(x) ** 2
2 * integrate(f, (x, 0, pi / 2))
π2
Exercise 7-7-6
∫+∞0dx(x+1)x2+1−−−−−√=?
解:同样地,用三角函数换元法
∫+∞0dx(x+1)x2+1−−−−−√=∫π20cos2(t)d[tan(t)]sin(t)+cos(t)=∫π20dtsin(t)+cos(t)=∫π20dt2√sin(t+π4)
#Exercise 7-7-6
x = Symbol('x')
f = 1 / (sqrt(2) * sin(x + pi / 4))
integrate(f, (x, 0, pi / 2))
2√2log(2√(2√2+1))−2√2log(2√(−2√2+1))
Exercise 7-7-1b
∫+∞2dxxlnp(x)
若上式收敛,求p的范围
解:运用“比阶判别法的极限形式”
limx→+∞xqf(x)=limx→+∞xq−1lnp(x)
要是这个极限存在,则 p≥q−1>1−1=0
Exercise 7-7-2b
∫+∞2dxx+x2+2−−−−−√
解:先看被积函数的性质
f(x)=1x+x2+2−−−−−√=12(x2+2−−−−−√−x)
f′(x)=12(xx2+2−−−−−√−1)=x−x2+2−−−−−√2x2+2−−−