# 微分方程式の計算について　　　N0.5-3　2階線形定数同次微分方程式

###  学籍番号[＿＿＿＿＿＿＿＿＿]クラス[＿＿＿＿＿]　クラス番号[＿＿＿＿＿] 名前[＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿]

###########   ２階線形定数係数同次微分方程式

$$ \frac{d^2y}{dx^2}+b\frac{dy}{dx} +cy = 0 ------------（１）$$

上記の（１）式から得られる特性方程式は　$$ \lambda^2 + b \lambda + c =0  $$

解の公式より　$$  \lambda =  \frac{-b \pm \sqrt{ b^2 - 4\times 1\times c }}{2\times1}$$

(1)判別式 $ b^2-4\times c  >0  $ なら　
2つの実数解　$ \lambda_1 ,\lambda_2 $　から一般解は
$$ y = C_1 e^{\lambda_1 x} +  C_2 e^{\lambda_2 x} $$
(2)判別式 $ b^2-4\times c  = 0  $ なら　1つの実数解(重解)　$ \lambda $　から一般解は
$$ y = ( C_1+ C_2 x) e^{\lambda x}  $$
(3)判別式 $ b^2-4\times c  < 0  $ なら　複素共役な解　$ \lambda = \alpha \pm i \beta  $　から一般解は
$$ y = e^{\alpha x}( C_1 \cos( \beta x)   + C_2 \sin( \beta x)) $$




```python
from sympy import *
x, n , a ,C1, C2 ,C3 = symbols('x n a C1 C2 C3')
f,g,y = symbols('f g y' ,cls=Function)
init_printing()
m ='5///3'
i =0
```


```python
diffeq = Eq(y(x).diff(x, 2)-3* y(x).diff(x, 1) + 2*y(x) ,0)
i =0
i=i+1
print( 'No.',m,'---',i)
diffeq
```


```python
simplify(dsolve(diffeq, y(x)))
```


```python
diffeq = Eq(y(x).diff(x, 2)-6* y(x).diff(x, 1) + 9*y(x) ,0)
i=i+1
print( 'No.',m,'---',i)
diffeq
```


```python
simplify(dsolve(diffeq, y(x)))
```


```python
diffeq = Eq(y(x).diff(x, 2)-2* y(x).diff(x, 1) + 3*y(x) ,0)
i=i+1
print( 'No.',m,'---',i)
diffeq
```


```python
simplify(dsolve(diffeq, y(x)))
```


```python
diffeq = Eq(y(x).diff(x, 2)+4* y(x).diff(x, 1) + 4*y(x) ,0)
i=i+1
print( 'No.',m,'---',i)
diffeq
```


```python
soln = simplify(dsolve(diffeq, y(x)))
soln
```


```python
# y(0)=3, y'(0) = -4
constants = solve([soln.rhs.subs(x,0)-3 ,soln.rhs.diff(x,1).subs(x,0)-  -4])
constants
```


```python
solne = soln.subs(constants)
solne
```


```python
diffeq = Eq(y(x).diff(x, 2)+4* y(x).diff(x, 1) + 13*y(x) ,0)
i=i+1
print( 'No.',m,'---',i)
diffeq
```


```python
soln = simplify(dsolve(diffeq, y(x)))
soln
```


```python
# y(π)= -６, y'(π) = ２４
constants = solve([soln.rhs.subs(x,pi)- -6 ,soln.rhs.diff(x,1).subs(x,pi)-  24])
constants
```


```python
solne = soln.subs(constants)
solne
```


```python
diffeq = Eq(y(x).diff(x, 2)+3* y(x).diff(x, 1) + 2*y(x) ,0)
i=i+1
print( 'No.',m,'---',i)
diffeq
```


```python
soln = simplify(dsolve(diffeq, y(x)))
soln
```


```python
# y(0)=1, y'(0) = 2
constants = solve([soln.rhs.subs(x,0)- 1 ,soln.rhs.diff(x,1).subs(x,0)-  2])
constants
```


```python
solne = soln.subs(constants)
solne
```


```python

```

dfaa5e6af9ec7150d5ce46751d22a1c3a95cb5f2
ipynb
Jupyter Notebook
11_20181211-bibunhoteisiki-7-3-Ex&ans.ipynb
kt-pro-git-1/Calculus_Differential_Equation-public
d5deaf117e6841c4f6ceb53bc80b020220fd4814
MIT
2019-07-10T11:33:18.000Z
2019-07-10T11:33:18.000Z
11_20181211-bibunhoteisiki-7-3-Ex&ans.ipynb
kt-pro-git-1/Calculus_Differential_Equation-public
d5deaf117e6841c4f6ceb53bc80b020220fd4814
MIT
11_20181211-bibunhoteisiki-7-3-Ex&ans.ipynb
kt-pro-git-1/Calculus_Differential_Equation-public
d5deaf117e6841c4f6ceb53bc80b020220fd4814
MIT
Qwen/Qwen-72B
1. YES
2. YES