next up previous
Next: 1.3 数式処理とは Up: 1 Mathematica を始めよう Previous: 1.1 イントロ

1.2 Mathematica ってこんなもの (まずは触ってみる)

Mathematica は色々なコンピューター環境に用意されています。 以下の例は、 数学科のワークステーションである oyabun にログインして、 Mathematica を実行してみたものですが、 情報処理教室の Windows XP マシンでも、 以下のようにして使えます。
情報処理教室の Windows XP マシンでの Mathematica の利用法
  1. スタート・メニューから[すべてのプログラム(P)] → [Mathematica 4] を選択
  2. UserID (ユーザ名) と Password (パスワード) を尋ねられたらきちんと答える。
  3. タイトルバーに \fbox{\texttt{Z!Stream XPStyle - Microsoft Internet Explorer}} と書かれたウィンドウが現れる。 [Start] → [プログラム] →[Mathematica 4] を選択。
画面左側に現われる ``Untitled-1'' (日本語版では「名称未定義-1*」) というウィンドウに、 キーボードからコマンドを入力して、 最後に \framebox{Shift}+ \framebox{Enter} を 入力するのが基本である。

ここでは、 プログラムなどは書かずに、式を順次入力して計算結果を表示させています。
oyabun% math
Mathematica 4.0 for Solaris
Copyright 1988-1999 Wolfram Research, Inc.
 -- Motif graphics initialized -- 

In[1]:= 1/2+1/3                     ← 分数計算

        5
Out[1]= -                           → ちょっと見難いですけどね
        6

In[2]:= a={{0,1},{6,1}}             ← 行列の入力

Out[2]= {{0, 1}, {6, 1}}

In[3]:= Eigenvalues[a]              ← 行列の固有値の計算

Out[3]= {-2, 3}

In[4]:= Eigenvectors[a]             ← 行列の固有ベクトルの計算

Out[4]= {{-1, 2}, {1, 3}}

In[5]:= Expand[(x+y)^6]             ← 式の展開

         6      5         4  2       3  3       2  4        5    6
Out[5]= x  + 6 x  y + 15 x  y  + 20 x  y  + 15 x  y  + 6 x y  + y

In[6]:= N[Pi,50]                    ← 円周率 50 桁

Out[6]= 3.1415926535897932384626433832795028841971693993751

In[7]:= Integrate[Log[x],x]         ← 不定積分

Out[7]= -x + x Log[x]

In[8]:= Plot3D[x^2 - y^2, {x,-1,1}, {y,-1,1}]  ← グラフ

Out[8]= -Graphics-                  → ここで画面に図が表示されます

In[9]:= Solve[x^3+2x==1,x]          ← 3 次方程式を解かせてみる

  結果は一見に価するけれど、紙を食うのでカットします。

In[10]:= ParametricPlot3D[{Cos[t](3+Cos[u]),Sin[t](3+Cos[u]),Sin[u]},
         {t,0,2Pi},{u,0,2Pi}]       ← トーラスを描かせる。

Out[10]:= -Graphics3D-

In[11]:= Quit                       ← 終了
oyabun% 

\includegraphics[width=10cm]{eps/torus.ps}

next up previous
Next: 1.3 数式処理とは Up: 1 Mathematica を始めよう Previous: 1.1 イントロ
Masashi Katsurada
平成20年10月18日