二つの放物線C
C_{1}:y=x^2 と
C_{2}:y=x^2-6x+15の共通接線をlとする。\\
(1)lの方程式を求めC_{1},C_{2}およびlを図示せよ\\
(2)C_{1},C_{2}およびlによって囲まれた部分の面積を求めよ\\
解答
from sympy import *
from sympy.abc import *
eq1 = x**2
eq2=x**2-6*x+15
eq3=m*x+n
print(eq1-eq3)#−𝑚𝑥−𝑛+𝑥^2
print(eq2-eq3)#−𝑚𝑥−𝑛+𝑥2−6𝑥+15
ここらか判別式を計算
hanbetu1=(-m)*(-m)-4*(-n)#𝑚^2+4𝑛
hanbetu2=(-m-6)**2-4*(15-n)#4𝑛+(−𝑚−6)^2−60
solve([hanbetu1, hanbetu2], [m,n])#m=2 n=-1
グラフを書く
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-5,8)
y1=m*x+n
y2=x**2
y3=x**2-6*x+15
plt.grid()
plt.plot(x,y1)
plt.plot(x,y2)
plt.plot(x,y3)
交点を求める
#面積を求める
x = Symbol('x')
y2=x**2
y3=x**2-6*x+15
y4=y2-y3
y4
ans=solve(y4, x)
ans
交点を求める
y1=m*x+n
y2=x**2
y3=x**2-6*x+15
y7=y2-y1
y8=y3-y1
ans1=solve(y7,x)
ans2=solve(y8,x)
定積分を求める
# 1 5/2
# 5/2 4
ans=integrate(y7, (x,1,5/2))+integrate(y8, (x,5/2,4))
ans
2.25=9/4になる。