gnuplot を動かす
2009 , 3月 25 日 水曜日Flashのプログラムのために、「プログラミングのための線形代数」を買った。
読みはじめたらサンプルプログラムの紹介があったので、さっそくここからダウンロードする。
$ ruby mat_anim.rb -s=0 |gnuplot
で動くらしい。
Macintosh OS X には、defaultでrubyが入っている。gnuplotを追加しサンプルプログラムを動かす。
まず Xwindowを起動する。
$ whereis gnuplot
見つからない。
Finderで検索すると、/sw/bin/gnuplotにあった。
$ /sw/bin/gnuplot
いちいちPathを入力するのが面倒なので パスの設定をする。
$ cat /etc/bashrc
# System-wide .bashrc file for interactive bash(1) shells.
if [ -n “$PS1” ]; then PS1=’\h:\w \u\$ ‘; fi
# Make bash check it’s window size after a process completes
shopt -s checkwinsize
export PATH=$PATH:/sw/bin/
確認。
$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/sw/bin/
大丈夫そうだ。
ユーザのディレクトリにダウンロードしたファイルを入れて準備OK。
mkdir pgm…テストするディレクトリ
Mac:~User$ cd pgm/
サンプルプログラムを実行する。
Mac:~User:~/pgm User$ ruby mat_anim.rb -s=0 | gnuplot
mat_anim.rb:323: warning: parenthesize argument(s) for future version
Sample 0
Matrix A =
1.50000 0.00000
0.00000 0.50000
— q: quit, n: next sample, p: previous sample, other: repeat —

サンプルプログラムが表示される。



Terminalやエディタ(Aqua)からXtrem(X11)へのコピーペースト
エディタの文字列をCMD+Cでコピーして、Xtremにペーストができない。
1.エディタの文字列をCMD+Cでコピー
2.Xtremで、Option + クリック
でコピーする。
3ボタンマウスなら、中央ボタンを押す。