新 微分積分Ⅰ(改訂版)目次
第1章 微分法
- §1 関数の極限と導関数
- §2 いろいろな関数の導関数
第2章 微分の応用
- §1 関数の変動
- §2 いろいろな応用
第3章 積分法
- §1 不定積分と定積分
- §2 積分の計算
第4章 積分の応用
- §1 面積・曲線の長さ・体積
- §2 いろいろな応用
新 微分積分Ⅱ(改訂版)目次
第1章 関数の展開
- §1 関数の展開
第2章 偏微分
- §1 偏微分法
- §2 偏微分の応用
第3章 重積分
- §1 2重積分
- §2 変数の変換と重積分
第4章 微分方程式
- §1 1階微分方程式
- §2 2階微分方程式
新 微分積分Ⅰ 改訂版 ―
第1章 微分法
§1 関数の極限と導関数
平均変化率 → 微分係数
$$
\frac{f(x+h) - f(x)}{h} ;; \xrightarrow{h\to 0};; f'(x)
$$
-
数学的意味:瞬間の変化率(接線の傾き)
-
工学応用:
- 物理:速度 $v = s'(t)$、加速度 $a = v'(t) = s''(t)$
- AI:損失関数 $L$ の勾配 $dL/dw$ → 勾配降下法で最適化
- 制御工学:状態変数の時間変化(動的システムの記述)
接線の方程式
$$
y = f(a) + f'(a)(x-a)
$$
-
応用:
- ロボットの接触判定(局所直線近似)
- 信号波形の局所的な線形近似 → フィルタ設計や外れ値検出
§2 いろいろな関数の導関数
基本公式
$$
(x^n)' = nx^{n-1},\quad (e^x)' = e^x,\quad (\ln x)' = \frac{1}{x}
$$
$$
(\sin x)' = \cos x,\quad (\cos x)' = -\sin x
$$
積・商の微分
$$
(uv)' = u'v + uv',\quad \left(\frac{u}{v}\right)' = \frac{u'v - uv'}{v^2}
$$
合成関数(チェーンルール)
$$
(f \circ g)'(x) = f'(g(x))\cdot g'(x)
$$
-
工学応用:
- ニューラルネットの誤差逆伝播(Backpropagation)
- 振動波形や回路応答の解析
- 熱伝導・拡散方程式のモデリング
第2章 微分の応用
§1 関数の変動(増減・極値)
-
増減判定:
$$
f'(x) > 0 \Rightarrow \text{増加},\quad f'(x) < 0 \Rightarrow \text{減少}
$$ -
極値条件:
$$
f'(x)=0,;; f''(x)>0 \Rightarrow \text{極小},;; f''(x)<0 \Rightarrow \text{極大}
$$ -
工学応用:
- 最適化問題(コスト最小化・収益最大化)
- 強化学習:報酬関数の最大化
- 制御:PID制御の調整で「安定点」の探索
§2 いろいろな応用(平均値の定理など)
平均値の定理
$$
\exists c \in (a,b);;\text{s.t.};; f'(c) = \frac{f(b)-f(a)}{b-a}
$$
-
応用:
- 物理:平均速度の存在証明
- データ解析:傾向線の保証
- 信号処理:区間内に必ず「平均的な変化率」が存在
第3章 積分法
§1 不定積分と定積分
不定積分(原始関数)
$$
\int f(x),dx = F(x) + C
$$
定積分(面積・累積量)
$$
\int_a^b f(x),dx = F(b) - F(a)
$$
-
工学応用:
- 物理:距離=速度の積分、エネルギー=力の積分
- AI:累積誤差の評価、確率分布の正規化
- 信号処理:パワー計算(エネルギー積分)
§2 積分の計算(置換積分・部分積分)
置換積分
$$
\int f(g(x))g'(x),dx = \int f(u),du
$$
部分積分
$$
\int u,dv = uv - \int v,du
$$
-
工学応用:
- 変数変換によるシステム解析(フーリエ変換・ラプラス変換)
- 信号畳み込みの計算簡略化
- 物理量のモーメント(重心・慣性モーメント)の導出
第4章 積分の応用
§1 面積・曲線の長さ・体積
面積
$$
S = \int_a^b f(x),dx
$$
曲線の長さ
$$
L = \int_a^b \sqrt{1 + (f'(x))^2},dx
$$
回転体の体積(x軸回転)
$$
V = \pi \int_a^b [f(x)]^2 dx
$$
-
工学応用:
- 画像処理:オブジェクトの面積・形状解析
- CAD設計:部品の体積・表面積評価
- 医用工学:CT/MRIからの臓器容積推定
§2 いろいろな応用
-
物理量の累積評価:
仕事 $W = \int F dx$、電荷 $Q = \int I dt$ -
AI応用:
- ROC曲線のAUC(面積=性能評価)
- 損失関数の下側面積=モデル誤差の総和
-
確率論:
確率密度関数 $p(x)$ の積分 = 確率(1に正規化)
まとめ
「新 微分積分Ⅰ 改訂版」で学ぶ内容は、
- 微分 → 変化率と最適化(AI学習・制御)
- 積分 → 累積量と総和(信号・エネルギー・確率)
として 工学・AI・データサイエンスに直結しています。
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import quad
# =====================================================
# 1. Differentiation: slope and tangent line
# =====================================================
def f(x):
return x**2 # example function
def derivative(f, a, h=1e-5):
return (f(a+h) - f(a-h)) / (2*h)
a = 2
slope = derivative(f, a)
print("f'(2) ≈", slope)
x_vals = np.linspace(0, 4, 200)
tangent = f(a) + slope * (x_vals - a)
plt.figure(figsize=(6,4))
plt.plot(x_vals, f(x_vals), label="f(x)=x^2")
plt.plot(x_vals, tangent, "--", label=f"Tangent at x={a}")
plt.scatter([a], [f(a)], c="red")
plt.title("Derivative and Tangent Line")
plt.legend(); plt.grid(True); plt.show()
# =====================================================
# 2. Integration: area under curve
# =====================================================
integral_value, _ = quad(f, 0, 2)
print("∫_0^2 x^2 dx =", integral_value)
x_fill = np.linspace(0, 2, 200)
plt.figure(figsize=(6,4))
plt.plot(x_vals, f(x_vals), label="f(x)=x^2")
plt.fill_between(x_fill, f(x_fill), alpha=0.3, color="orange", label="Area (0→2)")
plt.title("Definite Integral as Area")
plt.legend(); plt.grid(True); plt.show()
# =====================================================
# 3. Curve length example
# y = sqrt(x) on [0,4], L = ∫ sqrt(1+(dy/dx)^2) dx
# =====================================================
def g(x):
return np.sqrt(x)
def dg(x, h=1e-5):
return (g(x+h) - g(x-h)) / (2*h)
def integrand_length(x):
return np.sqrt(1 + (dg(x))**2)
length, _ = quad(integrand_length, 0, 4)
print("Curve length y=√x from 0 to 4 ≈", length)
# =====================================================
# 4. Volume of revolution
# Example: y=x from 0 to 1 rotated around x-axis
# V = π ∫_0^1 [f(x)]^2 dx
# =====================================================
def h_func(x):
return x
volume, _ = quad(lambda x: np.pi*(h_func(x)**2), 0, 1)
print("Volume of rotation (y=x, 0→1) =", volume)
# =====================================================
# 5. Gradient Descent (AI application)
# =====================================================
def L(w):
return (w-3)**2
def dL(w):
return 2*(w-3)
w = -2.0
lr = 0.2
history = [w]
for _ in range(15):
w -= lr * dL(w)
history.append(w)
print("Optimized parameter ≈", w)
w_vals = np.linspace(-1, 5, 200)
plt.figure(figsize=(6,4))
plt.plot(w_vals, L(w_vals), label="Loss function L(w)")
plt.plot(history, [L(wi) for wi in history], "o-", label="Gradient Descent path")
plt.title("Gradient Descent Simulation")
plt.legend(); plt.grid(True); plt.show()
新 微分積分Ⅱ(改訂版)
第1章 関数の展開
§1 関数の展開(テイラー展開・マクローリン展開)
式:
$$
f(x) = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots
$$
- マクローリン展開(a=0の場合):
$$
f(x) = f(0) + f'(0)x + \frac{f''(0)}{2!}x^2 + \cdots
$$
✅ 工学応用
- 近似計算(非線形関数を多項式で近似)
- 制御工学:非線形システムを線形化
- AI:活性化関数(tanh, sigmoid)の近似展開
第2章 偏微分
§1 偏微分法
式:
$$
\frac{\partial f}{\partial x},\quad \frac{\partial f}{\partial y}
$$
例:
$$
f(x,y) = x^2 y + e^x y^3
\quad\Rightarrow\quad
\frac{\partial f}{\partial x} = 2xy + e^x y^3
,\quad
\frac{\partial f}{\partial y} = x^2 + 3e^x y^2
$$
§2 偏微分の応用
多変数関数の勾配:
$$
\nabla f(x,y) = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right)
$$
✅ 工学応用
- ニューラルネット:誤差逆伝播法(Backpropagation)
- 最適化:勾配降下法 (Gradient Descent)
- 物理:熱伝導方程式(∂u/∂t = k∇²u)
第3章 重積分
§1 2重積分
定義:
$$
\iint_D f(x,y),dx,dy
$$
- 座標変換(極座標):
$$
\iint_D f(x,y),dx,dy
= \int_{\theta_1}^{\theta_2}\int_{r_1}^{r_2} f(r\cos\theta, r\sin\theta), r,dr,d\theta
$$
§2 変数の変換と重積分
ヤコビアン:
$$
\iint_D f(x,y),dx,dy
= \iint_{D'} f(x(u,v), y(u,v)) , |J| ,du,dv
$$
ただし
$$
J = \det\begin{bmatrix}
\frac{\partial x}{\partial u} & \frac{\partial x}{\partial v}\
\frac{\partial y}{\partial u} & \frac{\partial y}{\partial v}
\end{bmatrix}
$$
✅ 工学応用
- CAD:図形領域の面積・体積
- AI:確率分布の変数変換(例:正規分布の変換)
- ロボット制御:座標系変換
第4章 微分方程式
§1 1階微分方程式
分離形:
$$
\frac{dy}{dx} = f(x)g(y)
\quad\Rightarrow\quad
\int \frac{1}{g(y)},dy = \int f(x),dx
$$
線形1階:
$$
\frac{dy}{dx} + P(x)y = Q(x)
$$
解:
$$
y = e^{-\int P(x),dx}\left(\int Q(x)e^{\int P(x),dx},dx + C\right)
$$
§2 2階微分方程式
同次線形:
$$
a y'' + b y' + c y = 0
$$
解:
$$
y = C_1 e^{r_1 x} + C_2 e^{r_2 x}, \quad (rは特性方程式の解)
$$
非同次線形:
$$
a y'' + b y' + c y = F(x)
$$
→ 特解 + 同次解の和
✅ 工学応用
-
振動解析(バネ・ダンパ系):
$$
m y'' + c y' + k y = 0
$$ -
電気回路(RLC回路の解析)
-
AI:ニューラルODEモデル
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import dblquad, solve_ivp
from sympy import symbols, series, exp, sin, diff
# =====================================================
# 1. Taylor / Maclaurin Series Expansion
# =====================================================
x = symbols('x')
f = exp(x) * sin(x)
taylor_expansion = series(f, x, 0, 6) # Maclaurin series up to x^5
print("Maclaurin expansion of e^x sin(x):")
print(taylor_expansion)
# Numerical comparison
x_vals = np.linspace(-2, 2, 200)
f_vals = np.exp(x_vals) * np.sin(x_vals)
approx_vals = [float(taylor_expansion.removeO().subs(x, xi)) for xi in x_vals]
plt.figure(figsize=(6,4))
plt.plot(x_vals, f_vals, label="f(x)=e^x sin(x)")
plt.plot(x_vals, approx_vals, "--", label="Taylor approx")
plt.title("Taylor Expansion Approximation")
plt.legend(); plt.grid(True); plt.show()
# =====================================================
# 2. Partial Derivatives
# =====================================================
x, y = symbols('x y')
f_xy = x**2 * y + exp(x) * y**3
fx = diff(f_xy, x)
fy = diff(f_xy, y)
print("∂f/∂x =", fx)
print("∂f/∂y =", fy)
# Gradient at a point
fx_val = fx.subs({x:1, y:2})
fy_val = fy.subs({x:1, y:2})
print("Gradient at (1,2) =", (fx_val, fy_val))
# =====================================================
# 3. Double Integral (Polar coordinates)
# =====================================================
# Example: ∫∫_D (x^2 + y^2) dxdy over unit circle
def f_cart(x,y):
return x**2 + y**2
# Polar transform: r from 0→1, θ from 0→2π
res, err = dblquad(lambda r, theta: (r*np.cos(theta))**2 + (r*np.sin(theta))**2,
0, 2*np.pi, lambda _: 0, lambda _: 1)
print("Double integral over unit circle =", res)
# =====================================================
# 4. Differential Equations
# =====================================================
# Example: damped oscillator y'' + 0.5 y' + 4 y = 0
def oscillator(t, y):
return [y[1], -0.5*y[1] - 4*y[0]]
t_span = (0, 20)
y0 = [1, 0] # initial displacement=1, velocity=0
sol = solve_ivp(oscillator, t_span, y0, t_eval=np.linspace(0,20,400))
plt.figure(figsize=(6,4))
plt.plot(sol.t, sol.y[0], label="y(t)")
plt.title("Solution of Damped Oscillator")
plt.xlabel("t"); plt.ylabel("y")
plt.grid(True); plt.legend(); plt.show()
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
# =====================================================
# 1. Separable ODE: dy/dx = ky
# Example: Population growth model
# =====================================================
def separable(x, y, k=0.5):
return k * y
x_span = (0, 10)
y0 = [1.0]
sol_sep = solve_ivp(separable, x_span, y0, t_eval=np.linspace(0, 10, 200))
plt.figure()
plt.plot(sol_sep.t, sol_sep.y[0], label="dy/dx = 0.5 y")
plt.title("Separable ODE (Exponential Growth)")
plt.xlabel("x"); plt.ylabel("y"); plt.grid(True); plt.legend()
# =====================================================
# 2. Linear First-order ODE: y' + P(x)y = Q(x)
# Example: Newton's Law of Cooling: y' + k y = k T_env
# =====================================================
T_env, k = 25, 0.1
def cooling(t, y):
return -k * (y - T_env)
sol_lin = solve_ivp(cooling, (0, 50), [90], t_eval=np.linspace(0, 50, 200))
plt.figure()
plt.plot(sol_lin.t, sol_lin.y[0], label="Newton Cooling")
plt.axhline(T_env, color="r", linestyle="--", label="Environment Temp")
plt.title("Linear First-order ODE")
plt.xlabel("time"); plt.ylabel("Temperature"); plt.grid(True); plt.legend()
# =====================================================
# 3. Second-order Homogeneous ODE: m y'' + c y' + k y = 0
# Example: Damped oscillator
# =====================================================
m, c, k = 1.0, 0.3, 4.0
def damped_oscillator(t, Y):
y, v = Y
dydt = v
dvdt = -(c/m)*v - (k/m)*y
return [dydt, dvdt]
sol_damp = solve_ivp(damped_oscillator, (0, 20), [1, 0], t_eval=np.linspace(0, 20, 400))
plt.figure()
plt.plot(sol_damp.t, sol_damp.y[0], label="Displacement y(t)")
plt.title("Second-order Homogeneous ODE (Damped Oscillator)")
plt.xlabel("time"); plt.ylabel("y"); plt.grid(True); plt.legend()
# =====================================================
# 4. Second-order Non-homogeneous ODE: m y'' + c y' + k y = F0 cos(ωt)
# Example: Forced oscillator
# =====================================================
m, c, k = 1.0, 0.2, 1.0
F0, omega = 1.0, 1.2
def forced_oscillator(t, Y):
y, v = Y
dydt = v
dvdt = (F0*np.cos(omega*t) - c*v - k*y)/m
return [dydt, dvdt]
sol_forced = solve_ivp(forced_oscillator, (0, 50), [0, 0], t_eval=np.linspace(0, 50, 500))
plt.figure()
plt.plot(sol_forced.t, sol_forced.y[0], label="Forced Oscillator")
plt.title("Second-order Non-homogeneous ODE")
plt.xlabel("time"); plt.ylabel("y"); plt.grid(True); plt.legend()
plt.show()
import numpy as np
import matplotlib.pyplot as plt
from sympy import symbols, exp, series, diff, integrate, cos, sin, Matrix
# ============================================
# 第1章:関数の展開(テイラー展開・マクローリン展開)
# ============================================
x = symbols("x")
# 例:exp(x) のマクローリン展開(0点展開、5次まで)
f = exp(x)
taylor_exp = series(f, x, 0, 6).removeO()
print("Maclaurin expansion of exp(x) up to 5th order:", taylor_exp)
# 数値比較:exp(x) と近似多項式
x_vals = np.linspace(-2, 2, 200)
f_true = np.exp(x_vals)
f_approx = 1 + x_vals + x_vals**2/2 + x_vals**3/6 + x_vals**4/24 + x_vals**5/120
plt.figure()
plt.plot(x_vals, f_true, label="exp(x)")
plt.plot(x_vals, f_approx, "--", label="Taylor Approx (5th order)")
plt.title("Taylor Expansion (Maclaurin) of exp(x)")
plt.xlabel("x"); plt.ylabel("y"); plt.legend(); plt.grid(True)
# ============================================
# 第2章:偏微分
# ============================================
x, y = symbols("x y")
f = x**2 * y + exp(x) * y**3
fx = diff(f, x)
fy = diff(f, y)
print("∂f/∂x =", fx)
print("∂f/∂y =", fy)
# 勾配ベクトル
grad_f = Matrix([fx, fy])
print("Gradient ∇f =", grad_f)
# ============================================
# 第3章:重積分
# ============================================
# 例1: 領域 D = [0,1]x[0,1] 上の f(x,y)=x+y の2重積分
f = x + y
res_rect = integrate(f, (x, 0, 1), (y, 0, 1))
print("∬_D (x+y) dxdy =", res_rect)
# 例2: 極座標変換による面積計算
# 単位円領域で f(x,y)=1 の積分 → π
r, theta = symbols("r theta")
f_polar = 1
res_circle = integrate(f_polar * r, (r, 0, 1), (theta, 0, 2*np.pi))
print("Area of unit circle via polar coordinates =", res_circle)
# ============================================
# 可視化:単位円と格子
# ============================================
theta_vals = np.linspace(0, 2*np.pi, 200)
circle_x = np.cos(theta_vals)
circle_y = np.sin(theta_vals)
plt.figure()
plt.fill(circle_x, circle_y, alpha=0.3, label="Unit Circle (r=1)")
plt.gca().set_aspect("equal", adjustable="box")
plt.title("Polar Coordinate Domain Example")
plt.xlabel("x"); plt.ylabel("y"); plt.legend(); plt.grid(True)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
from sympy import symbols, Function, dsolve, Eq, exp, sin
# ============================================
# §1 1階微分方程式
# ============================================
x = symbols("x")
y = Function("y")
# 例1: 分離形 dy/dx = x*y
ode1 = Eq(y(x).diff(x), x * y(x))
sol1 = dsolve(ode1)
print("Solution of dy/dx = x*y:", sol1)
# 例2: 線形1階 dy/dx + y = x
ode2 = Eq(y(x).diff(x) + y(x), x)
sol2 = dsolve(ode2)
print("Solution of dy/dx + y = x:", sol2)
# ============================================
# §2 2階微分方程式
# ============================================
# 例1: 同次線形 y'' + y = 0 (単振動)
ode3 = Eq(y(x).diff(x, 2) + y(x), 0)
sol3 = dsolve(ode3)
print("Solution of y'' + y = 0:", sol3)
# 例2: 非同次線形 y'' + y = sin(x)
ode4 = Eq(y(x).diff(x, 2) + y(x), sin(x))
sol4 = dsolve(ode4)
print("Solution of y'' + y = sin(x):", sol4)
# ============================================
# 数値シミュレーション(バネ・ダンパ系)
# m y'' + c y' + k y = 0
# ============================================
from scipy.integrate import solve_ivp
m, c, k = 1.0, 0.2, 1.0 # 質量, 減衰係数, ばね定数
def spring_mass_damper(t, Y):
y, dy = Y
ddy = -(c/m)*dy - (k/m)*y
return [dy, ddy]
# 初期条件
Y0 = [1.0, 0.0] # y(0)=1, y'(0)=0
t_span = (0, 20)
t_eval = np.linspace(t_span[0], t_span[1], 500)
sol_ivp = solve_ivp(spring_mass_damper, t_span, Y0, t_eval=t_eval)
# プロット
plt.figure()
plt.plot(sol_ivp.t, sol_ivp.y[0], label="Displacement y(t)")
plt.plot(sol_ivp.t, sol_ivp.y[1], label="Velocity y'(t)", linestyle="--")
plt.title("Damped Oscillator (m y'' + c y' + k y = 0)")
plt.xlabel("Time t")
plt.ylabel("y(t), y'(t)")
plt.legend(); plt.grid(True)
plt.show()