2017年11月5日日曜日

学習環境

数学読本〈5〉微分法の応用/積分法/積分法の応用/行列と行列式(松坂 和夫(著)、岩波書店)の第20章(面積、体積、長さ - 積分法の応用)、20.4(簡単な微分方程式)、2階微分方程式、問48.を取り組んでみる。

    1. 2次方程式が2つの異なる実数解α、βを持つ場合。

      y'= C 1 α e αx + C 2 β e βx y''= C 1 α 2 e αx + C 2 β 2 e βx y''+py'+qy = C 1 α 2 e αx + C 2 β 2 e βx +p( C 1 α e αx + C 2 β e βx )+q( C 1 e αx + C 2 e βx ) = C 1 e αx ( α 2 +pα+q )+ C 2 e βx ( β 2 +pβ+q ) = C 1 e αx 0+ C 2 e βx 0 =0
    2. 重解αをもつ場合。

      y'= C 1 ( e αx +x e αx α )+ C 2 e αx α = e αx ( C 1 ( 1+xα )+ C 2 α ) y''= C 1 ( e αx α+ e αx α+x e αx α 2 )+ C 2 e αx α 2 = C 1 ( 2 e αx α+x e αx α 2 )+ C 2 e αx α 2 = e αx ( C 1 ( 2α+x α 2 )+ C 2 α 2 ) y''+py'+qy = e αx ( C 1 ( 2α+x α 2 )+ C 2 α 2 )+p e αx ( C 1 ( 1+xα )+ C 2 α )+q( C 1 x e αx + C 2 e αx ) = e αx ( C 1 ( 2α+x α 2 +p+pxα+qx )+ C 2 ( α 2 +pα+q ) ) = e x ( C 1 ( 2α+p+x( α 2 +pα+q ) )+ C 2 ·0 ) = e x C 1 ( 2α+p ) α= p 2 e x C 1 ( 2α+p ) = e x C 1 ( 2· p 2 +p ) = e x C 1 ( p+p ) =0 y''+py'+qy=0

      • ( a+bi ) 2 +p( a+bi )+q=0 ( a 2 b 2 +pa+q )+( 2ab+pb )i=0 a 2 b 2 +pa+q=0 2ab+pb=0 b( 2a+p )=0 b0 2a+p=0 y'=A( e ax asin( bx+β )+ e ax bcos( bx+β ) ) =A e ax ( asin( bx+β )+bcos( bx+β ) ) y''=A( e ax a( asin( bx+β )+bcos( bx+β ) )+ e ax ( abcos( bx+β ) b 2 sin( bx+β ) ) ) =A e ax ( a 2 sin( bx+β )+abcos( bx+β )+abcos( bx+β ) b 2 sin( bx+β ) ) =A e ax ( ( a 2 b 2 )sin( bx+β )+2abcos( bx+β ) ) y''+py'+q =A e ax ( ( a 2 b 2 )sin( bx+β )+2abcos( bx+β ) )+pA e ax ( asin( bx+β )+bcos( bx+β ) )+qA e ax sin( bx+β ) =A e ax ( ( a 2 b 2 )sin( bx+β )+2abcos( bx+β )+pasin( bx+β )+pbcos( bx+β )+qsin( bx+β ) ) =A e x ( ( a 2 b 2 +pa+q )sin( bx+β )+b( 2a+p )cos( bx+β ) ) =A e x ( 0sin( bx+β )+b0cos( bx+β ) ) =0

      • y'=A( e ax acos( bx+γ ) e ax bsin( bx+γ ) ) =A e ax ( acos( bx+γ )bsin( bx+γ ) ) y''=A( e ax a( acos( bx+γ )bsin( bx+γ ) )+ e ax ( absin( bx+γ ) b 2 cos( bx+γ ) ) ) =A e ax ( a 2 cos( bx+γ )absin( bx+γ )absin( bx+γ ) b 2 cos( bx+γ ) ) =A e ax ( ( a 2 b 2 )cos( bx+γ )2absin( bx+γ ) ) y''+py'+q =A e ax ( ( a 2 b 2 )cos( bx+γ )2absin( bx+γ ) )+pA e ax ( acos( bx+γ )bsin( bx+γ ) )+q( A e ax cos( bx+γ ) ) =A e ax ( ( a 2 b 2 )cos( bx+γ )2absin( bx+γ )+p( acos( bx+γ )bsin( bx+γ ) )+qcos( bx+γ ) ) =A e ax ( ( a 2 b 2 +pa+q )cos( bx+γ )b( 2a+p )sin( bx+γ ) ) =A e ax ( 0cos( bx+γ )b0sin( bx+γ ) ) =0

コード(Emacs)

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, solve, exp, Derivative

p, q, X, a, b, C1, C2, x = symbols('p, q, X, a, b, C1, C2, x')
eq = X ** 2 + p * X + q
a0, b0 = solve(eq, X)

y = C1 * exp(a * x) + C2 * exp(b * x)
D1 = Derivative(y, x, 1)
D2 = Derivative(y, x, 2)
y1 = D1.doit()
y2 = D2.doit()
eq = y2 + p * y1 + q * y

for t in [D1, y1, D2, y2, eq, eq.subs({a: a0, b: b0}).expand() == 0]:
    pprint(t)
    print()

入出力結果(Terminal, Jupyter(IPython))

=$ ./sample48.py
∂ ⎛    a⋅x       b⋅x⎞
──⎝C₁⋅ℯ    + C₂⋅ℯ   ⎠
∂x                   

      a⋅x         b⋅x
C₁⋅a⋅ℯ    + C₂⋅b⋅ℯ   

  2                   
 ∂ ⎛    a⋅x       b⋅x⎞
───⎝C₁⋅ℯ    + C₂⋅ℯ   ⎠
  2                   
∂x                    

    2  a⋅x       2  b⋅x
C₁⋅a ⋅ℯ    + C₂⋅b ⋅ℯ   

    2  a⋅x       2  b⋅x     ⎛      a⋅x         b⋅x⎞     ⎛    a⋅x       b⋅x⎞
C₁⋅a ⋅ℯ    + C₂⋅b ⋅ℯ    + p⋅⎝C₁⋅a⋅ℯ    + C₂⋅b⋅ℯ   ⎠ + q⋅⎝C₁⋅ℯ    + C₂⋅ℯ   ⎠

True

$

HTML5

<div id="graph0"></div>
<pre id="output0"></pre>
<label for="r0">r = </label>
<input id="r0" type="number" min="0" value="0.5">
<label for="dx">dx = </label>
<input id="dx" type="number" min="0" step="0.0001" value="0.005">
<br>
<label for="x1">x1 = </label>
<input id="x1" type="number" value="-10">
<label for="x2">x2 = </label>
<input id="x2" type="number" value="10">
<br>
<label for="y1">y1 = </label>
<input id="y1" type="number" value="-10">
<label for="y2">y2 = </label>
<input id="y2" type="number" value="10">
<br>
<label for="n0">n = </label>
<input id="n0" type="number" min="0" value="1">
<label for="ε0">ε = </label>
<input id="ε0" type="number" min="0" value="0.1">
<label for="a0">A = </label>
<input id="a0" type="number" value="1">
<label for="α0">α = </label>
<input id="α0" type="number" value="2">

<button id="draw0">draw</button>
<button id="clear0">clear</button>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.6/d3.min.js" integrity="sha256-5idA201uSwHAROtCops7codXJ0vja+6wbBrZdQ6ETQc=" crossorigin="anonymous"></script>

<script src="sample48.js"></script>
 

JavaScript

=$ ./sample48.py
∂ ⎛    a⋅x       b⋅x⎞
──⎝C₁⋅ℯ    + C₂⋅ℯ   ⎠
∂x                   

      a⋅x         b⋅x
C₁⋅a⋅ℯ    + C₂⋅b⋅ℯ   

  2                   
 ∂ ⎛    a⋅x       b⋅x⎞
───⎝C₁⋅ℯ    + C₂⋅ℯ   ⎠
  2                   
∂x                    

    2  a⋅x       2  b⋅x
C₁⋅a ⋅ℯ    + C₂⋅b ⋅ℯ   

    2  a⋅x       2  b⋅x     ⎛      a⋅x         b⋅x⎞     ⎛    a⋅x       b⋅x⎞
C₁⋅a ⋅ℯ    + C₂⋅b ⋅ℯ    + p⋅⎝C₁⋅a⋅ℯ    + C₂⋅b⋅ℯ   ⎠ + q⋅⎝C₁⋅ℯ    + C₂⋅ℯ   ⎠

True

$








0 コメント:

コメントを投稿