# 微分方程式の計算について　　　N0.5　－1　定数変化法

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

###########   1階常微分方程式 定数変化法 (同次形の方程式　としての解を求め,次に定数Cをu(x)に代えて（1）式に代入してu(x)を求めていく

$$ \frac{dy}{dx}+P(x)y = q(x)------------（１）$$

はじめに同次形の方程式　としての解を求める

$$ \frac{dy}{dx}+f(x)y = 0 $$

$$ y{\left (x \right )} = C_{1} e^{- \int f{\left (x \right )}\, dx}----------(2)$$

C1をｘの関数としてu(x)と置き換えてみる
$$ y = u(x)e^{- \int f(x)dx} $$
このｙを(1)式の非同次の式に代入して、
u(x)を求める。
(2)のC1にu(u)を代入すして解とする


```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///1'
i =0
```


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


```python

```


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


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


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


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


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


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


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


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


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


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


```python
reseq = dsolve(diffeq, y(x))
reseq
```


```python
f0 = Eq(reseq.rhs.subs(x,0),0)
c = solve(f0)
c
```


```python
reseq01 = reseq.subs(C1, c[0])
reseq01
```


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


```python
reseq = dsolve(diffeq, y(x))
reseq
```


```python
f0 = Eq(reseq.rhs.subs(x,0),4)
c = solve(f0)
c
```


```python
reseq01 = reseq.subs(C1, c[0])
reseq01
```


```python

```

3f04739399010c3d56088b15c91242f2076457ac
ipynb
Jupyter Notebook
10_20181203-bibunhoteisiki-7-2-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
10_20181203-bibunhoteisiki-7-2-Ex&ans-.ipynb
kt-pro-git-1/Calculus_Differential_Equation-public
d5deaf117e6841c4f6ceb53bc80b020220fd4814
MIT
10_20181203-bibunhoteisiki-7-2-Ex&ans-.ipynb
kt-pro-git-1/Calculus_Differential_Equation-public
d5deaf117e6841c4f6ceb53bc80b020220fd4814
MIT
Qwen/Qwen-72B
1. YES
2. YES