この文書の URL は http://www.cc.kyoto-su.ac.jp/~mtkg/lecture/comp_A/2012/12.html です。

数式環境で使える記号

\documentclass[a4j]{jarticle}

\begin{document}

I $\heartsuit$ KSU!

他にもいろいろあります。
$\clubsuit$
$\diamondsuit$
$\spadesuit$
$\sharp$
$\flat$

\end{document}

練習

行列とベクトル

\documentclass[a4j]{jarticle}

\begin{document}

\section{行列とベクトル}

\subsection{行列}

\begin{equation}
  \left(
    \begin{array}{cc}
      1  &  2  \\
      3  &  4  \\
      5  &  6  \\
    \end{array}
  \right)
\end{equation}

\subsection{ベクトル}

\begin{equation}
  \left(
    \begin{array}{c}
      x \\
      y \\
    \end{array}
  \right)
\end{equation}

\end{document}

行列やベクトルを作るには数式環境の中で array (配列)環境を使います。

練習

行列式

大きい括弧には \right(, \right) 以外に次のようなものがあります。

こんどは行列式を書いてみましょう。

\documentclass[a4j]{jarticle}

\begin{document}

\section{行列式}

\begin{equation}
  \left|
    \begin{array}{ccc}
      1  &  2  &  3  \\
      4  &  5  &  6  \\
      7  &  8  &  9  \\
    \end{array}
  \right|
  = 1 \cdot 5 \cdot 9
  + 4 \cdot 8 \cdot 3
  + \cdots
  - 9 \cdot 2 \cdot 4
\end{equation}

\end{document}

練習

場合分け

array 環境を使うと場合分けを含んだ式を表現することもできます。

\documentclass[a4j]{jarticle}

\begin{document}

\section{場合分け}

\begin{equation}
  f(x) =
  \left\{
    \begin{array}{rl}
      -x  &  (x < 0) \\
       x  &  (x \geq 0) \\
    \end{array}
  \right.
\end{equation}

\end{document}

練習

       | -1    (x < -1)
f(x) = |  x    (-1 <= x < 1)
       |  1    (x >= 1)

連立一次方程式

行列とベクトルを組み合わせてみましょう。

\documentclass[a4j]{jarticle}

\begin{document}

\section{連立一次方程式}

\begin{equation}
\left[
  \begin{array}{cc}
     2  &  1  \\
    -3  &  4  \\
  \end{array}
\right]
\left[
  \begin{array}{c}
    x  \\
    y  \\
  \end{array}
\right]
=
\left[
  \begin{array}{c}
    5  \\
    6  \\
  \end{array}
\right]
\end{equation}

\end{document}

練習

[ 1  2  3 ] [ x ]   [ 11 ]
[ 4  5  6 ] [ y ] = [ 12 ]
[ 7  8  9 ] [ z ]   [ 13 ]

課題

次のような式(行列式)を書け。

| 1-x   2  |
|          |  = (1-x) (4-x) - 2・3 = x^2 - 5x - 2
|  3   4-x |