<jupyter_start><jupyter_text>微分方程式の計算について　　　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)) $$<jupyter_code>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
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
simplify(dsolve(diffeq, y(x)))
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
simplify(dsolve(diffeq, y(x)))
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
simplify(dsolve(diffeq, y(x)))
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
soln = simplify(dsolve(diffeq, y(x)))
soln
# y(0)=3, y'(0) = -4
constants = solve([soln.rhs.subs(x,0)-3 ,soln.rhs.diff(x,1).subs(x,0)-  -4])
constants
solne = soln.subs(constants)
solne
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
soln = simplify(dsolve(diffeq, y(x)))
soln
# y(π)= -６, y'(π) = ２４
constants = solve([soln.rhs.subs(x,pi)- -6 ,soln.rhs.diff(x,1).subs(x,pi)-  24])
constants
solne = soln.subs(constants)
solne
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
soln = simplify(dsolve(diffeq, y(x)))
soln
# y(0)=1, y'(0) = 2
constants = solve([soln.rhs.subs(x,0)- 1 ,soln.rhs.diff(x,1).subs(x,0)-  2])
constants
solne = soln.subs(constants)
solne<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2861811391223156, 'fraction_numerical': 0.052754435107376284, 'mean_word_length': 3.983720930232558, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '35694', 'license': 'MIT', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1309, 'n_words': 227, 'path': '11_20181211-bibunhoteisiki-7-3-Ex&ans.ipynb', 'repo_name': 'kt-pro-git-1/Calculus_Differential_Equation-public', 'size': '2142'}