laplace

laplace ラプラス変換を行う。

一般的な表記例

laplace(f(t), t, s) 変数 t と変換助変数 s に対する f(t) のラプラス変換を行う。

サンプルコード:

laplace(1,t,s);
laplace(t,t,s);
laplace(t^n,t,s);
laplace(cos(omega*t),t,s);
laplace(sin(omega*t),t,s);
laplace(exp(a*t),t,s);
laplace(t*exp(a*t),t,s);

実行結果:

(%i1)                          laplace(1, t, s)
                                       1
(%o1)                                  -
                                       s
(%i2)                          laplace(t, t, s)
                                      1
(%o2)                                 --
                                       2
                                      s
                                        n
(%i3)                          laplace(t , t, s)
Is  n + 1  positive, negative, or zero?

positive;
                                           - n - 1
(%o3)                        gamma(n + 1) s
(%i4)                     laplace(cos(omega t), t, s)
                                       s
(%o4)                             -----------
                                   2        2
                                  s  + omega
(%i5)                     laplace(sin(omega t), t, s)
                                     omega
(%o5)                             -----------
                                   2        2
                                  s  + omega
(%i6)                       laplace(exp(a t), t, s)
                                       1
(%o6)                                -----
                                     s - a
(%i7)                      laplace(t exp(a t), t, s)
                                      1
(%o7)                              --------
                                          2
                                   (s - a)

ラグランジュの未定乗数法

Maximaでラグランジュの未定乗数法を利用する。

例題:

周囲の長さが1mの長方形で、面積を最大にするものはどういう長方形か?

サンプルコード:

f: x*y; /* 条件でx*yを最大にするようなx,yを求める。 */
g: 2*(x+y)-1; /* 周囲の長さは2*(x+y)であるから、2*(x+y)=1 */
q: f+lamda*g;
/* xについての偏微分 */
qx: diff(q,x);
/* yについての偏微分 */
qy: diff(q,y);
/* 連立方程式を解く*/
s : solve([qx=0,qy=0,g=0],[x,y,lamda]);

実行結果:

(%i1)                               f : x y
(%o1)                                 x y
(%i2)                          g : 2 (y + x) - 1
(%o2)                            2 (y + x) - 1
(%i3)                           q : lamda g + f
(%o3)                     lamda (2 (y + x) - 1) + x y
(%i4)                           qx : diff(q, x)
(%o4)                             y + 2 lamda
(%i5)                           qy : diff(q, y)
(%o5)                             x + 2 lamda
(%i6)          s : solve([qx = 0, qy = 0, g = 0], [x, y, lamda])
                               1      1            1
(%o6)                    [[x = -, y = -, lamda = - -]]
                               4      4            8

solve

solve 多項式方程式、連立方程式をを解く。

一般的な表記例

solve( 方程式,変数 ) 多項式方程式

solve([方程式1,方程式 2、...],[変数1,変数2,...]) 連立方程式

 

サンプルコード:

s:solve(a*x^2+b*x+c,x); /* 多項式方程式 */
m:solve([a*x+b*y=m,c*x+d*x=n],[x,y]); /* 連立方程式 */

実行結果:

(%i1)                    s : solve(c + b x + a x , x)
                         2                         2
                   sqrt(b  - 4 a c) + b      sqrt(b  - 4 a c) - b
(%o1)       [x = - --------------------, x = --------------------]
                           2 a                       2 a

(%i2)          m : solve([b y + a x = m, d x + c x = n], [x, y])
                              n        (d + c) m - a n
(%o2)                 [[x = -----, y = ---------------]]
                            d + c         b (d + c)

matrix

matrix 行列(マトリックス)の表現を行う。

一般的な表記例

matrix([a,b,...],[m,n,...],...,[x,y,...])

 

サンプルコード:

A:matrix([1,2,3],[4,5,6],[7,8,9]);
B:matrix([a,b],[c,d]);
C:matrix([e,f],[g,h]);
X:B + C;
Y:B - C;
Z:B . C; /* 行列の積 */
I:B^^-1; /* 逆行列 */

実行結果:

(%i1)             A : matrix([1, 2, 3], [4, 5, 6], [7, 8, 9])
                                  [ 1  2  3 ]
                                  [         ]
(%o1)                             [ 4  5  6 ]
                                  [         ]
                                  [ 7  8  9 ]

(%i2)                     B : matrix([a, b], [c, d])
                                   [ a  b ]
(%o2)                              [      ]
                                   [ c  d ]

(%i3)                     C : matrix([e, f], [g, h])
                                   [ e  f ]
(%o3)                              [      ]
                                   [ g  h ]

(%i4)                              X : C + B
                               [ e + a  f + b ]
(%o4)                          [              ]
                               [ g + c  h + d ]

(%i5)                              Y : B - C
                               [ a - e  b - f ]
(%o5)                          [              ]
                               [ c - g  d - h ]

(%i6)                              Z : B . C
                           [ b g + a e  b h + a f ]
(%o6)                      [                      ]
                           [ d g + c e  d h + c f ]

                                       <- 1>
(%i7)                             I : B
                         [      d             b     ]
                         [  ---------   - --------- ]
                         [  a d - b c     a d - b c ]
(%o7)                    [                          ]
                         [       c           a      ]
                         [ - ---------   ---------  ]
                         [   a d - b c   a d - b c  ]

taylor

taylor テイラー級数展開を行う。

一般的な表記例

taylor (f(x), x, a, n) 

 

サンプルコード:

a:0;
n:4;
taylor(exp(x),x,a,n);
taylor(sin(x),x,a,n);
taylor(cos(x),x,a,n);
taylor(tan(x),x,a,n);
taylor(exp(%i*x),x,a,n);
taylor(1/(1-x),x,a,n);
taylor(sqrt(1+x),x,a,n);

実行結果:

(%i1)                                a : 0
(%o1)                                  0

(%i2)                                n : 4
(%o2)                                  4

(%i3)                       taylor(exp(x), x, a, n)
                                  2    3    4
                                 x    x    x
(%o3)/T/                 1 + x + -- + -- + -- + . . .
                                 2    6    24

(%i4)                       taylor(sin(x), x, a, n)
                                     3
                                    x
(%o4)/T/                        x - -- + . . .
                                    6

(%i5)                       taylor(cos(x), x, a, n)
                                   2    4
                                  x    x
(%o5)/T/                      1 - -- + -- + . . .
                                  2    24

(%i6)                       taylor(tan(x), x, a, n)
                                     3
                                    x
(%o6)/T/                        x + -- + . . .
                                    3

(%i7)                     taylor(exp(%i x), x, a, n)
                                  2       3    4
                                 x    %i x    x
(%o7)/T/              1 + %i x - -- - ----- + -- + . . .
                                 2      6     24

                                     1
(%i8)                       taylor(-----, x, a, n)
                                   1 - x
                                  2    3    4
(%o8)/T/                 1 + x + x  + x  + x  + . . .

(%i9)                    taylor(sqrt(x + 1), x, a, n)
                                 2    3      4
                            x   x    x    5 x
(%o9)/T/                1 + - - -- + -- - ---- + . . .
                            2   8    16   128

diff

diff 微分/偏微分、関数 f(x) の変数 x に関する導関数を求める

一般的な表記例

diff( f(x),x ) 微分

diff( f(x),x,n ) n 階微分

サンプルコード:

diff(x^n,x);
diff(exp(a*x),x);
diff(log(x),x);
diff(cos(x),x);
diff(sin(x),x);
diff(sinh(x),x);
diff(cosh(x),x);

実行結果:

                                        n
(%i1)                             diff(x , x)
                                      n - 1
(%o1)                              n x

(%i2)                          diff(exp(a x), x)
                                        a x
(%o2)                               a %e

(%i3)                           diff(log(x), x)
                                       1
(%o3)                                  -
                                       x

(%i4)                           diff(cos(x), x)
(%o4)                              - sin(x)

(%i5)                           diff(sin(x), x)
(%o5)                               cos(x)

(%i6)                          diff(sinh(x), x)
(%o6)                               cosh(x)

(%i7)                          diff(cosh(x), x)
(%o7)                               sinh(x)

integrate

integrate 定積分・不定積分

一般的な表記例

integrate( f(x),x,a,b ) 定積分、a から b までの定積分を求める

integrate( f(x),x ) 不定積分

サンプルコード:

integrate(x^n,x);
integrate(exp(a*x),x);
integrate(log(x),x);
integrate(cos(x),x);
integrate(sin(x),x);
integrate(sinh(x),x);
integrate(cosh(x),x);

実行結果:

                                          n
(%i1)                          integrate(x , x)
                                     n + 1
                                    x
(%o1)                               ------
                                    n + 1

(%i2)                       integrate(exp(a x), x)
                                       a x
                                     %e
(%o2)                                -----
                                       a

(%i3)                        integrate(log(x), x)
(%o3)                            x log(x) - x

(%i4)                        integrate(cos(x), x)
(%o4)                               sin(x)

(%i5)                        integrate(sin(x), x)
(%o5)                              - cos(x)

(%i6)                        integrate(sinh(x), x)
(%o6)                               cosh(x)

(%i7)                        integrate(cosh(x), x)
(%o7)                               sinh(x)

maxima

Maxima(マキシマ)は、Lispで記述されGNU GPLライセンスの下に配布されているフリーな数式処理システムである。現在も活発に開発が続けられており、商用の Maple や Mathematica などと比べても劣らない機能や性能を持っている。


ブックマーク このエントリをはてなブックマークに追加 Yahoo!ブックマークに登録 このエントリをtwitterに登録 Googleブックマークに登録 このエントリをdel.icio.usに登録 このエントリをlivedoorクリップに登録
©2008 質問箱 http://www.askbox.net Powered by Google App Engine