CS & Math/Mathematics

[수학][미적분학] 5.7 연습문제_미완

wintertreey 2025. 11. 27. 16:13

1. 함수의 부정적분 구하기
 
++ 에러문 
ModuleNotFoundError: No module named 'sympy'
 
cmd창에서 sympy 설치하기

pip install sympy

 

import sympy as sp

# a. 
x = sp.Symbol('x')
f = x**2+3*x+2
F = sp.integrate(f,x)
print(F)
# F = sp.integrate(f, x) + sp.Symbol('C')   # 적분상수 C 추가

# b.
f = sp.exp(x) - 1/x
F = sp.integrate(f,x)
print(F)

# c.
f = (x+1)**2 * (x-2)
F = sp.integrate(f,x)
print(F)

# d.
f = (3**x - 1)**2
F = sp.integrate(f,x)
print(F)

# e.
f = sp.sin(x)**3
F = sp.integrate(f,x)
print(F)

# f.
f = x**2 * sp.log(x)
F = sp.integrate(f,x)
print(F)
x**3/3 + 3*x**2/2 + 2*x
exp(x) - log(x)
x**4/4 - 3*x**2/2 - 2*x
x + (3**(2*x)*log(3) - 4*3**x*log(3))/(2*log(3)**2)
cos(x)**3/3 - cos(x)
x**3*log(x)/3 - x**3/9

 
 

 
4. 함수의 부정적분 구하기

# a.
x = sp.Symbol('x')
f = 1/(x*(x+1))
F = sp.integrate(f,x)
print(F)
# log(x) - log(x + 1)
# b.
f = (2*x-3) / (x**2 - 3*x + 2)
F = sp.integrate(f,x)
print(F)
# log(x**2 - 3*x + 2)