Annotation of OpenXM/src/cfep/Doc/Intro/next2.tex, Revision 1.6
1.1 takayama 1: % makeindex next2.idx
1.2 takayama 2: % License: GNU Free Documentation License 1.2.
1.1 takayama 3: \documentclass{jbook}
4: \usepackage{html}
5: \usepackage{makeidx}
6: \usepackage{ascmac}
7: \usepackage[dvips]{graphicx}
8: \textwidth = 15cm
9: \textheight = 23cm
10:
11: \topmargin = 0.7cm
12: \evensidemargin = 0cm
13: \oddsidemargin = 1cm
14:
15: \def\comment#1{ #1 }
16: %\def\comment#1{ }
17: \input{asirbookmacro}
18:
19: \title{ {\bf $BD6F~Lg(B Cfep/asir (MacOS X)} }
20: \author{ $B9b;3?.5#(B }
1.5 takayama 21: \date{ 2006$BG/(B($BJ?@.(B18$BG/(B), 3$B7n(B12$BF|HG(B(cfep 1.1). 2008-09-26, 2009-09-19 $B=$@5(B \\ $B%3%a%s%H$O(B takayama@math.kobe-u.ac.jp $B$^$G(B}
1.1 takayama 22: \makeindex
23:
24: \begin{document}
25: \maketitle
26: \tableofcontents
27:
28: \chapter{ $BEEBn$H$7$F$NMxMQ(B } \label{chapter:next}
29: %en \chapter{A Tour of Asir} \label{chapter:next}
30:
31: $B?@8MBg3X$N650iMQ7W;;5!4D6-$,(B MacOS X $B$KJQ99$5$l$k$N$KH<$$(B,
32: $BI.<T$,65:`$H$7$FMxMQ$7$F$$$?(B Windows $B$GF0:n$9$k(B10$B?J(BBasic$B$,MxMQ$G$-$J$/$J$C$?(B.
33: Cfep/asir $B$O$=$NBeMQ$H$7$F(B,
34: 2006$BG/=iF,$+$i3+H/$r?J$a$F$$$k%7%9%F%`$G$"$k(B.
35: 10$B?J(BBasic$B$NM%$l$F$$$kE@$N0l$D$O(B, $BCzG+$JF~Lg2r@b$,IUB0$7$F$$$k$3$H$G$"$k(B.
36: ``Cfep/asir$BD6F~Lg(B'' $B$O$3$N2r@b$K$9$3$7$G$b6aIU$3$&$HEXNO$7$F$_$?(B.
37: Asir$B$NF~Lg%F%-%9%H$K(B ``Asir$B%I%j%k(B'' $B$,$"$k$,(B, $B$3$ND6F~Lg$G$O(B ``Asir$B%I%j%k(B''
38: $B$N0l>O$*$h$S$=$N@h$NF~LgE*FbMF$rCzG+$K(B($B>/!9$/$I$/(B)$B@bL@$7$?(B.
39:
40: \bigbreak
41:
42: $B$3$N@a$G$O(B MacOS X $B$G$N(B cfep/asir $B$N5/F0K!(B, $BEEBnIw(B, Basic$BIw$N;H$$J}$r@bL@$9$k(B.
43: $B%U%!%$%k$NJ]B8Ey(B MacOS X $B$N6&DL$NA`:nJ}K!$K$O$[$H$s$I$U$l$F$$$J$$$,(B,
44: cfep/asir $B$O(B MacOS X $BI8=`$N%U%!%$%k$NJ]B8Ey$rMQ$$$F$$$k$N$G(B,
45: $B$3$N$h$&$JItJ,$G$OB>$N%=%U%H%&%(%"$HMxMQJ}K!$OF10l$G$"$k(B.
46: $B=i?4<T$N?M$OE,Ev$JK\$d%,%$%I$r;2>H$5$l$?$$(B.
47:
48:
49: \section{$B%-!<A`:n$HMQ8l$NI|=,(B}
50:
51: \noindent
52: $B%-!<%\!<%I(B, $B%^%&%9$NA`:n$NMQ8l(B.
53: \begin{enumerate}
54: %
55: \item
56: \fbox{\tt Command} $B%-!<$d(B
57: \fbox{\tt ALT } $B%-!<$d(B \fbox{\tt SHIFT} $B%-!<$d(B
58: \fbox{\tt CTRL } $B%-!<$OB>$N%-!<$H0l=o$K2!$9$3$H$G;O$a$F5!G=$9$k(B
59: $B%-!<$G$"$k(B.$B$3$l$i$@$1$rC1FH$K2!$7$F$b$J$K$b$*$-$J$$(B.
60: $B0J8e(B \fbox{\tt SHIFT} $B%-!<$r$*$7$J$,$iB>$N%-!<$r2!$9A`:n$r(B
61: \shift{$B$-!<(B} $B$H=q$/$3$H$K$9$k(B. command $B%-!<(B, alt $B%-!<(B, ctrl $B%-!<$K$D$$$F$b(B
62: $BF1MM$G$"$k(B.
63: %
64: \item
65: \shift{a} $B$H$9$k$HBgJ8;z$N(B A $B$rF~NO$G$-$k(B.
66: %
67: \item
68: \fbox{\tt BS} $B$H$+(B \fbox{\tt DEL} $B$H=q$$$F$"$k%-!<2!$9$H0lJ8;zA0$r>C5n$G$-$k(B.
69: %
70: \item $BF|K\8l%-!<%\!<%I$N>l9g(B \fbox{{\tt $\backslash$}}
71: ($B%P%C%/%9%i%C%7%e(B) $B$O(B \alt{\yen} $B$GF~NO$G$-$k(B.
72: %
73: \item
74: \fbox{\tt SPACE} $B%-!<$O6uGr$rF~NO$9$k%-!<$G$"$k(B.
75: $B7W;;5!$NFbIt$G$OJ8;z$O?t;z$KJQ49$5$l$F3JG<$*$h$S=hM}$5$l$k(B.
76: $BJ8;z$KBP1~$9$k?t;z$rJ8;z%3!<%I$H8F$V(B. $BJ8;z%3!<%I$K$O$$$m$$$m$J<oN`$N$b$N$,$"$k$,(B,
77: $B0lHV4pACE*$J$N$O%"%9%-!<%3!<%I7O$G$"$j(B, $B%"%k%U%!%Y%C%H$d?t;z(B, $B%-!<%\!<%I$K8=$l$k(B
78: $B5-9f$J$I$r%+%P!<$7$F$$$k(B. $B4A;z$O%"%9%-!<%3!<%I7O$G$OI=8=$G$-$J$$(B.
79: \fbox{A} $B$N%"%9%-!<%3!<%I$O(B 65$BHV$G$"$k(B. $B0J2<(B \fbox{B} $B$,(B 66, \fbox{C} $B$,(B 67,
80: $B$HB3$/(B.
81: $B6uGr$N%"%9%-!<%3!<%I$O(B32$BHV$G$"$k(B.
82: $BF|K\8lF~NO$N>uBV$GF~NO$5$l$k6uGr$O(B ``$BA43Q6uGr(B'' $B$H8F$P$l$F$*$j(B,
83: $B%"%9%-!<%3!<%I(B32$BHV$N6uGr(B ($BH>3Q6uGr(B) $B$H$OJL$NJ8;z$G$"$k(B.
84: $BA43Q6uGr$,%W%m%0%i%`$K:.$8$C$F$$$k$H%(%i!<$r5/$3$9(B.
85: asir $B$G$O%a%C%;!<%8$d%3%a%s%HEy$KF|K\8l$,MxMQ2DG=$G$"$k$,(B,
86: $B47$l$k$^$G$O1Q;z%b!<%I$N$_$rMxMQ$9$k$3$H$r$*4+$a$9$k(B.
87: $B1&>e$N8@8lI=<($,(B
88: \begin{center}
89: \scalebox{0.1}{\includegraphics{Figs/language.ps}}
90: \end{center}
91: $B$H$J$C$F$$$k>uBV$G(B cfep/asir $B$KF~NO$7$h$&(B.
92: %
93: \item
94: \fbox{ ' } ($B%7%s%0%k%/%*!<%H(B) $B$H(B \fbox{ ` } ($B%P%C%/%/%*!<%H(B)
95: $B$OJL$NJ8;z$G$"$k(B.
96: $B%W%m%0%i%`$rFI$`;~$KCm0U(B.
97: $B$^$?(B, $B%W%m%0%i%`$rFI$`;~$O(B {\tt 0} ($B%<%m!K$H(B {\tt o} $B!J$*!<!K(B
98: $B$N0c$$$K$bCm0U(B.
99: %
100: %
101: \item
102: $B%^%&%9$NA`:n$K$O<!$N;0<oN`$,$"$k(B.
103: %
104: %
105: \begin{enumerate}
106: \item $B%/%j%C%/(B: $BA*Br$9$k$H$-(B,
107: $BJ8;z$rF~NO$9$k0LCV!J%-%c%l%C%H$N0LCV!K$N0\F0$KMQ$$$k(B.
108: $B%^%&%9$N%\%?%s$r$A$g$s$H$*$9(B. \index{$B$/$j$C$/(B@$B%/%j%C%/(B}
109: \item $B%I%i%C%0(B: $B0\F0(B, $B%5%$%:$NJQ99(B, $BHO0O$N;XDj(B, $B%3%T!<$N(B
110: $B$H$-$J$I$KMQ$$$k(B.
111: $B%^%&%9$N%\%?%s$r2!$7$J$,$iF0$+$9(B.
112: \item $B%@%V%k%/%j%C%/!'%W%m%0%i%`$N<B9T(B, open($B%U%!%$%k$r3+$/(B)$B$r$9$k$?$a$K(B
113: $BMQ$$$k(B. \index{$B$@$V$k$/$j$C$/(B@$B%@%V%k%/%j%C%/(B}
114: $B%^%&%9$N%\%?%s$r#22s$D$:$1$F$A$g$s$A$g$s$H$*$9(B.
115: $B%@%V%k%/%j%C%/$r$7$?%"%$%3%s$OGr$/$J$C$?$j7A>u$,$+$o$k$3$H$,(B
116: $B$*$*$$(B.
117: $B%@%V%k%/%j%C%/$7$?$i$7$P$i$/BT$D(B.
118: $B7W;;5!$,K;$7$$$H$-$O5/F0$K;~4V$,$+$+$k$3$H$b$"$j(B.
119: $B$`$d$_$K%@%V%k%/%j%C%/$r7+$jJV$9$H$=$N2s?t$@$15/F0$5$l$F$J$*CY$/$J$k(B.
120: \end{enumerate}
121: %
122: \end{enumerate}
123:
124:
125: \section{ Cfep/Asir $B$N5/F0K!$HEEBnE*$J;H$$J}(B }
126: %en \section{Using Risa/Asir as a Calculator}
127: %C
128:
129: cfep $B$N%"%$%3%s(B($B$$$N$V$?7/(B)
130: %en
131: %en In case of Windows, open the folder (directory) in which Risa/Asir is
132: %en installed and double click the icon of {\tt asirgui}
133: %<C
134: \begin{center}
135: \scalebox{0.1}{\includegraphics{Figs/inobuta.ps}}
136: \end{center}
137: %>C
138: $B$r%@%V%k%/%j%C%/$9$k$H?^(B\ref{fig:cfepStart}$B$N$h$&$K(B cfep/asir $B$,5/F0$9$k(B.
139: $B0J2<(B cfep/asir $B$rC1$K(B asir $B$H$h$V(B.
140:
141: %<C
142: \begin{figure}[tb]
143: \scalebox{0.5}{\includegraphics{Figs/cfepStart.ps}}
144: \caption{ cfep/asir $B$N5/F02hLL(B} \label{fig:cfepStart}
145: \end{figure}
146: %>C
147:
148: $B?^(B\ref{fig:cfepStart} $B$NF~NOAk$K7W;;$7$?$$<0$d%W%m%0%i%`$rF~NO$7$F(B
149: ``$B;O$a(B''$B%\%?%s(B
150: %<C
151: \begin{center}
152: \scalebox{0.1}{\includegraphics{Figs/buttonStart.ps}}
153: \end{center}
154: %>C
155: $B$r$*$9$H<B9T$r3+;O$9$k(B.
156: $B<0$N7W;;$d%W%m%0%i%`$N<B9T$,=*N;$9$k$H(B,
157: $B?7$7$$%&%$%s%I%&(B OutputView $B$,3+$-7k2L$,$=$N%&%$%s%I%&$KI=<($5$l$k(B.
158: \index{$B$K$e$&$j$g$/$^$I(B@$BF~NOAk(B}
159: \index{OutputView}
160: ``$B;O$a(B''$B%\%?%s$r$*$7$F<B9T$r3+;O$9$k$3$H$r7W;;5!MQ8l$G$O(B
161: ``$BF~NO$NI>2A$r;O$a$k(B'' $B$H$$$&(B.
162: \index{;} \index{$B$R$g$&$+(B@$BI>2A(B}
163:
164: $B=PNO>.Ak$K$O%7%9%F%`$+$i$N$$$m$$$m$J>pJs$,=PNO$5$l$k$,(B,
165: $BFbMF$OCf>e5i<T8~$1$N$b$N$,B?$$(B.
166: \index{$B$7$e$D$j$g$/$3$^$I(B@$B=PNO>.Ak(B}
167:
168: $B%U%!%$%k%a%K%e!<(B
169: %<C
170: \begin{center}
171: \scalebox{0.3}{\includegraphics{Figs/menuFile.eps}}
172: \end{center}
173: %>C
174: $B$+$i(B''$BJ]B8(B''$B$d(B''$BJLL>$GJ]B8(B''$B$r<B9T$9$k$HF~NOAk$NFbMF$r%U%!%$%k$H$7$FJ]B8$G$-$k(B.
175: $B=PNO>.Ak$NFbMF$d(B OutputView $B$NFbMF$OJ]B8$5$l$J$$$N$GCm0U$7$F$[$7$$(B.
176:
177: cfep/asir $B$r40A4$K=*N;$9$k$K$O(B cfep $B%a%K%e!<(B
178: %<C
179: \begin{center}
180: \scalebox{0.3}{\includegraphics{Figs/menuCfep.eps}}
181: \end{center}
182: %>C
183: $B$N(B ``cfep $B$r=*N;(B'' $B$r<B9T$9$k(B.
184: %en Input \verb@ quit; @ to terminate the Risa/Asir.
185: %
186: %
187:
188: %<C
189: \bigbreak
190: \bigbreak
191:
192: %>C
193:
194:
195: $B$5$F?^(B\ref{fig:cfepStart}$B$G$O(B
196: $ 3 \times 4 + 1 $ $B$N7W;;$r$7$F$$$k(B.
197: \begin{screen}
198: Asir $B$K$*$1$k7W;;<0$OIaDL$N?t<0$H;w$F$$$F(B,
199: $BB-$7;;$O(B {\tt $+$},
200: $B0z$-;;$O(B {\tt $-$}
201: $B$H=q$/(B.
202: $B$+$1;;$H3d;;$O(B $\times$ $B$d(B $B!`(B $B$,%-!<%\!<%I$K$J$$$H$$$&Nr;KE*M}M3$b$"$j(B,
203: $B$=$l$>$l(B {\tt *} $B$H(B {\tt /} $B$GI=8=$9$k(B.
204: $BN_>h(B $P^N$ $B$O(B \verb@P^N@ $B$N$h$&$K(B \verb@^@ $B5-9f$rMQ$$$FI=$9(B.
205: \end{screen}
206:
207: \begin{screen}
208: $B<0$N=*$j$r=hM}7O(B(asir)$B$K65$($k(B($B<($9(B)$B$N$K(B {\tt ;} ($B%;%_%3%m%s(B)
209: $B$r=q$+$J$$$H$$$1$J$$(B.
210: $BJ8Kv$N(B ``$B!#(B'' $B$N$h$&$JLr3d$r2L$?$9(B.
211: $B$^$?$+$1;;$N5-9f(B {\tt *} $B$N>JN,$O$G$-$J$$(B.
212: \end{screen}
213:
214: \begin{example} \rm
215: $B0J2<$N:8$N7W;;<0$r(B asir $B$G$O1&$N$h$&$K$"$i$o$9(B.
216: \begin{center}
217: \begin{tabular}{|l|l|} \hline
218: $2 \times (3+5^4)$ & \verb@2*(3+5^4);@ \\ \hline
219: $\left\{\left(2+\frac{2}{3}\right)\times 4+\frac{1}{3}\right\}\times 2 +5 $
220: & \verb@ ((2+2/3)*4+1/3)*2+5; @ \\ \hline
221: $AX+B$ & \verb@A*X+B;@ \\ \hline
222: $AX^2+BX+C$ & \verb@A*X^2+B*X+C;@ \\ \hline
223: $\frac{1}{X-1}$ & \verb@1/(X-1);@ \\ \hline
224: \end{tabular}
225: \end{center}
226: \end{example}
227:
228: $B7W;;$N=g=x$O3g8L$b4^$a$FIaDL$N?t<0$N7W;;$HF1$8$G$"$k(B.
229: $B$?$@$7(B
230: $B?t3X$G$O$+$C$3$H$7$F(B, {\tt [,]},{\tt \{,\}}$B$J$I$,$D$+$($k$,(B
231: asir $B$G$O(B {\tt (,)} $B$N$_(B.
232: {\tt [,]} $B$d(B {\tt \{,\}}$B$OJL$N0UL#$r$b$D(B.
233: $B>e$NNc$N$h$&$K(B {\tt (,)} $B$r2?=E$K$b$D$+$C$F$h$$(B.
234: %en In mathematics, {\tt (,)}, {\tt [,]} ,{\tt \{,\}} are used
235: %en as brackets in expressions,
236: %en but in Risa/Asir, only {\tt (,)} can be used as brackets in expressions,
237: %en and {\tt [,]} and {\tt \{,\}} are used for different purposes (list and
238: %en grouping in programs).
239: $B$3$N>l9g3g8L$NBP1~4X78$,$o$+$j$K$/$$(B.
240: $B3g8L$NBP1~$rD4$Y$?$$HO0O$r%^%&%9$G%I%i%C%0$7$FA*Br$7(B,
241: \begin{center}
242: \scalebox{0.1}{\includegraphics{Figs/buttonBracket.eps}}
243: \end{center}
244: $B%\%?%s$r$*$9$3$H$K$h$j3g8L$NBP1~$rD4$Y$k$3$H$,$G$-$k(B.
245: \begin{figure}[tb]
246: \begin{center}
247: \scalebox{0.5}{\includegraphics{Figs/menuCheckBracket.eps}}
248: \end{center}
249: \caption{$B3g8L$NBP1~(B} \label{fig:menuCheckBracket}
250: \end{figure}
251: $B?^(B\ref{fig:menuCheckBracket}$B$NNc$G$O(B \verb@(1+2*(3+4))@ $B$H=q$/$Y$-$H$3$m$r(B
252: \verb@(1+2*(3+4)@ $B$H=q$$$F$*$j%(%i!<$,I=<($5$l$F$$$k(B.
253:
254: \bigbreak
255:
256: \noindent \QQQ
257: ``Basic$BIw$N;H$$J}$r@bL@$9$k(B'' $B$H=q$$$F$"$j$^$7$?$,(B, Basic $B$C$F2?$G$9$+(B? \\
258: \noindent \AAA
259: $B%3%s%T%e!<%?$K;E;v$r$5$;$k$K$O:G=*E*$K$O%W%m%0%i%`8@8l(B
260: ($B7W;;5!$X$N;E;v$N<j=g$r;X<($9$k$?$a$N?M9)8@8l(B)$B$rMQ$$$k(B.
261: $B%o!<%W%mEy$b%W%m%0%i%`8@8l$G5-=R$5$l$F$$$k(B.
262: Basic $B$O:G$b8E$$%W%m%0%i%`8@8l$N0l$D$G$"$j(B, $B=i?4<T$K$d$5$7$/(B, $B$+$D(B
263: $B7W;;5!$N;EAH$_$d%W%m%0%i%`8@8l$NM}2r$K$bM-MQ$G$"$k(B.
264: Basic $B$O9b9;$N?t3X$N652J=qEy$K$bEP>l$9$k(B.
265: $BCx<T$O$$$^$^$G(B ``10$B?J(BBASIC'' $B$r=i?4<T8~$165:`$H$7$F3hMQ$7$F$$$?$,(B,
266: ``10$B?J(BBASIC''$B$,(B MacOS X $B$GF0:n$7$J$$$?$a(B cfep $B$r3+H/$7$?(B.
267: Asir $B8@8l$b%W%m%0%i%`8@8l$G$"$j(B Basic $B$H$h$/;w$F$$$k$,(B, C $B8@8l$K$b$C$H6a$$(B.
268:
269:
270: \noindent \QQQ
271: MacOS X $B$C$F2?$G$9$+(B? \\
272: \noindent \AAA
273: -----$B$^$@=q$$$F$J$$(B.
274:
275:
276:
277: %<C
278: \bigbreak
279: \noindent
280: %>C
281: Asir $B$O?t$N=hM}$N$_$J$i$:(B, $\sqrt{x}$$B$d;03Q4X?t$N6a;w7W;;(B, $BB?9`<0$N7W;;$b$G$-$k(B.
282: %en Asir can do calculations not only for numbers, but also for polynomials.
283: %en Let us see some examples.
284: %en
285: $B:8$N?t3XE*$J<0$O(B asir $B$G$O1&$N$h$&$KI=$9(B.
286: \begin{center}
287: \begin{tabular}{|l|l|} \hline
288: $\pi$ ($B1_<~N((B) & {\tt @pi} \\ \hline
289: $\cos x$ & {\tt cos(x)} \\ \hline
290: $\sin x$ & {\tt sin(x)} \\ \hline
291: $\tan x$ & {\tt tan(x)} \\ \hline
292: $\sqrt{x}$ & \verb@x^(1/2)@ \\ \hline
293: \end{tabular}
294: \end{center}
295: %en {\tt sin(x), cos(x)} are the trigonometric functions sine and cosine.
296: %en The symbol {\tt @pi} is the constant $\pi$.
297: $B;03Q4X?t$N3QEY$K$"$?$kItJ,$N(B $x$ $B$O%i%8%"%s$H$$$&C10L$rMQ$$$FI=$9(B.
298: $B9b9;Dc3XG/$N?t3X$G$O3QEY$rEY(B(degree)$B$H$$$&C10L$rMQ$$$FI=$9$,(B,
299: $B?t3X(B3$B0J>e$G$O3QEY$O%i%8%"%s$H$$$&C10L$GI=$9(B.
300: \begin{screen}
301: 90$BEY(B($BD>3Q(B)$B$,(B $\pi/2$ $B%i%8%"%s(B, 180$BEY$,(B $\pi$ $B%i%8%"%s(B.
302: $B0lHL$K(B $d$$BEY$O(B $\frac{d}{180} \pi$ $B%i%8%"%s$G$"$k(B.
303: \end{screen}
304: $BC10L%i%8%"%s$r$b$A$$$k$HHyJ,K!$N8x<0$,4J7i$K$J$k(B.
305: $B$?$H$($P(B $x$ $B$,%i%8%"%s$G$"$k$H(B $\sin x$ $B$NHyJ,$O(B $\cos x$ $B$G$"$k(B.
306: \index{$B$i$8$"$s(B@$B%i%8%"%s(B}
307:
308: $\sin(x)$ $B$d(B $\cos(x)$ $B$N6a;wCM$r5a$a$k$K$O$?$H$($P(B
309: %en \item In order to get approximate values of $\sin(x)$ $\cos(x)$, input as
310: %<C
311: \begin{center}
312: \verb@ deval(sin(3.14)); @
313: \end{center}
314: %>C
315: $B$HF~NO$9$k(B.
316: $B$3$l$O(B $\sin (3.14)$ $B$N6a;wCM$r7W;;$9$k(B.
317: $\sin \pi = 0 $ $B$J$N$G(B $0$ $B$K6a$$CM$,=PNO$5$l$k$O$:$G$"$k(B.
318: $B<B:](B {\tt 0.00159265} $B$r=PNO$9$k(B. \index{deval}
319: {\tt deval}
320: (\underline{eval}uate and get a result in {\underline d}ouble number precision $B$NN,(B)
321: $B$O(B 64 bit$B$NIbF0>.?tE@?t$K$h$j6a;wCM7W;;$9$k(B.
322: 64 bit$B$NIbF0>.?tE@?t$H$O2?$+$N@bL@$OD6F~Lg$NHO0O30$G$"$k$,(B,
323: $B7W;;5!$OM-8B$N5-21NN0h(B($B%a%b%j(B)$B$7$+;}$?$J$$$N$G(B, $B>.?t$bM-8B7e$7$+07$($J$$(B
324: $B$H3P$($F$*$3$&(B. 64bit $B$O07$($k7e?t$rI=$7$F$$$k(B.
325: $B>\$7$/$O(B ``asir $B%I%j%k(B'' $B$r;2>H$7$FM_$7$$(B.
326:
327: %en The function {\tt deval} numerically evaluates the argument in 64 bit floating point arithmetic.
328: %en As to details, see Chapter \ref{chapter:naibu}.
329: %en
330:
331: \begin{figure}[thb]
332: \begin{center}
333: \scalebox{0.5}{\includegraphics{Figs/sqrt2.eps}}
334: \end{center}
335: \caption{$BJ?J}:,$N7W;;(B}
336: \label{fig:sqrt2}
337: \end{figure}
338:
339: \begin{example} \rm
340: $\sqrt{2}$, $\sqrt{3}$ $B$N6a;wCM$r7W;;$7$J$5$$(B. \\
341: $BF~NO(B
342: \begin{screen}
343: \begin{verbatim}
344: print(deval(2^(1/2)));
345: print(deval(3^(1/2)));
346: \end{verbatim}
347: \end{screen}
348: $B=PNO$O(B
349: $B?^(B\ref{fig:sqrt2}$B$r$_$h(B.
350: \end{example}
351:
352:
353: $B>e$NNc$N$h$&$K(B,
354: $B%;%_%3%m%s(B {\tt ;} $B$G6h@Z$i$l$?0lO"$NL?Na$N$"$D$^$j$O$b$C$H$b(B
355: $BC1=c$J(B asir $B%W%m%0%i%`$NNc$G$"$k(B. \index{$B$W$m$0$i$`(B@$B%W%m%0%i%`(B}
356: $B0lO"$NL?Na$O;O$a$+$i=gHV$K<B9T$5$l$k(B.
357: {\tt print($B<0Ey(B);} $B$O(B ``$B<0Ey(B'' $B$NCM$r7W;;$7$FCM$r2hLL$KI=<($9$k(B.
358:
359: $B$5$F=PNO$N(B {\tt 1.41421} ($B$R$H$h(B $B$R$H$h$K(B $B$R$H$_$4$m(B) $B$O(B $\sqrt{2}$ $B$N6a;wCM$J$N$G(B,
360: \verb@print(deval(2^(1/2)));@
361: $B$N<B9T7k2L$G$"$k(B.
362: $B$5$F=PNO$N(B {\tt 1.73205} ($B$R$H$J$_$K(B $B$*$4$l$d(B) $B$O(B $\sqrt{3}$ $B$N6a;wCM$J$N$G(B,
363: \verb@print(deval(3^(1/2)));@
364: $B$N<B9T7k2L$G$"$k(B.
365: $B:G8e$N(B {\tt 0} $B$O$J$s$J$N$G$"$m$&$+(B?
366: $B<B$O$3$l$O:G8e$N(B {\tt print} $BJ8$NLa$7$F$$$kCM$G$"$k(B.
367: $B$`$D$+$7$$(B? $BJL$NNc$G@bL@$7$h$&(B.
368:
369: \noindent
370: \fbox{$BF~NO(B}
371: \begin{screen}
372: \begin{verbatim}
373: 1+2;
374: 2+3;
375: 3+4;
376: \end{verbatim}
377: \end{screen}
378: $B$3$N;~=PNO$O(B(OutputView$B$X$NI=<($O(B)
379: \begin{screen}
380: {\tt 7}
381: \end{screen}
382: $B$H$J$k(B.
383: cfep/asir $B$G$O$H$/$K(B {\tt print} $BJ8$r$+$+$J$$8B$j(B
384: $B:G8e$NJ8$N7W;;7k2L(B($BI>2A7k2L(B)$B$7$+=PNO$7$J$$(B.
385: $B$$$^$N>l9g$O(B $3+4$ $B$N7k2L(B $7$ $B$r=PNO$7$F$$$k(B.
386: \index{$B$7$e$D$j$g$/$1$C$+(B@$B=PNO7k2L(B}
387:
388: \begin{problem} \rm
389: \begin{enumerate} \index{2$B$N$k$$$8$g$&(B@$2$$B$NN_>h(B}
390: \item $2^8$, $2^9$, $2^{10}$,
391: $B$NCM$r7W;;$7$FEz$($rI=<($9$k%W%m%0%i%`$r=q$-$J$5$$(B.
392: \item $2$ $B$NN_>h$O%Q%=%3%s$N@-G=@bL@$K$h$/EP>l$9$k(B.
393: $B$?$H$($P8!:w%7%9%F%`(B google $B$K%-!<%o!<%I(B ``512 $B%a%b%j(B $BEk:\(B'' $B$rF~NO$7$?$H$3$m(B
394: ``$B%S%G%*%a%b%j$r(B 256M $B$+$i(B 512M $B$KG\A}$5$;(B'' $B$J$I(B, $B?tB?$/$N5-;v$,%R%C%H$9$k(B.
395: $B$3$N$h$&$J5-;v$r(B($B0UL#$,$o$+$i$J$/$F$b(B)10$B7o$"$D$a$F$_$h$&(B.
396: $512$ $B0J30$N(B $2$ $B$NN_>h$G$bF1$8$3$H$r;n$7$F$_$h$&(B.
397: \item ($BCf5i(B) $2$ $B$NN_>h$,%Q%=%3%s$N@-G=@bL@$K$h$/EP>l$9$kM}M3$rO@$8$J$5$$(B.
398: \end{enumerate}
399: \end{problem}
400:
401: \bigbreak
402:
403: \begin{figure}[thb]
404: \begin{center}
405: \scalebox{0.4}{\includegraphics{Figs/plot1.eps}}
406: \end{center}
407: \caption{$B4X?t$N%0%i%U(B}
408: \end{figure}
409:
410: \noindent
411: \HHH
412: \index{plot} \index{X11}
413: %en \begin{example} \rm
414: %en \index{plot}
415: \underline{X11 $B4D6-$,F0$$$F$$$l$P(B},
416: {\tt plot(f);} $BL?Na$G(B
417: $x$$B$N4X?t(B $f$ $B$N%0%i%U$rIA$1$k(B.
418: %en The command {\tt plot(f);}
419: %en draws the graph of the function $f$ in the variable $x$.
420: {\tt x} $B$NHO0O$r;XDj$7$?$$$H$-$O$?$H$($P(B \\
421: {\tt plot(f,[x,0,10])}
422: $B$HF~NO$9$k$H(B, {\tt x} $B$O(B 0 $B$+$i(B 10 $B$^$GJQ2=$9$k(B.
423: %en When you need to specify the range of variables {\tt x},
424: %en input, for example \\
425: %en {\tt plot(f,[x,0,10])}
426: %en Then, the variable {\tt x} runs over $[0, 10]$.
427:
428: \noindent \fbox{$BF~NONc(B}
429: %<C
430: \begin{screen}
431: \begin{verbatim}
432: plot(sin(x));
433: plot(sin(2*x)+0.5*sin(3*x),[x,-10,10]);
434: \end{verbatim}
435: \end{screen}
436: %>C
437: \begin{problem} \rm
438: $B$$$m$$$m$J4X?t$N%0%i%U$rIA$$$F$"$=$s$G$_$h$&(B.
439: $B?t3X$NCN<1$rAmF00w$7$F7W;;5!$NIA$/7A$,$I$&$7$F$=$&$J$N$+(B
440: $B@bL@$r;n$_$F$_$h$&(B.
441: \end{problem}
442:
443:
444: \section{$B%(%i!<%a%C%;!<%8(B}
445:
446: $BF~NO$K%(%i!<$,$"$k$H(B, $B%(%i!<%a%C%;!<%8$,I=<($5$l$k(B.
447: \index{$B$($i!<(B@$B%(%i!<(B}
448: \index{$B$($i!<$a$C$;!<$8(B@$B%(%i!<%a%C%;!<%8(B}
449:
450: \begin{figure}[htb]
451: \begin{center}
452: \scalebox{0.5}{\includegraphics{Figs/errorParseEq}}
453: \end{center}
454: \caption{$BJ8K!%(%i!<(B} \label{fig:errorParseEq}
455: \end{figure}
456: $B?^(B\ref{fig:errorParseEq} $B$G$O(B
457: \verb@ 2+4= @
458: $B$HF~NO$7$F$$$k(B. $B:G8e$K(B \verb@=@ $B$r=q$/I=8=$O(B asir $B$NJ8K!$G$O(B
459: $B5v$5$l$F$$$J$$$N$G(B, ``$BJ8K!%(%i!<(B'' $B$H;XE&$5$l$F$$$k(B. \index{$B$V$s$]$&$($i!<(B@$BJ8K!%(%i!<(B}
460: \begin{screen}
461: $BBgBN$3$l$G$o$+$C$F$/$l$F$$$$$8$c$J$$(B,
462: $B$H$3$A$i$,$*$b$C$F$$$F$b%W%m%0%i%`8@8l$O0l@ZM;DL$,$-$+$J$$(B.
463: \end{screen}
464: $B$J$*(B
465: \begin{verbatim}
466: error([41,4294967295,parse error,[asir_where,[[toplevel,1]]]])
467: \end{verbatim}
468: $B$NItJ,$O>e5i<T8~$1$N>pJs$J$N$G$H$j$"$($:L5;k$7$F$b$i$$$?$$(B.
469:
470:
471: \begin{figure}[htb]
472: \begin{center}
473: \scalebox{0.5}{\includegraphics{Figs/errorMultiLine}}
474: \end{center}
475: \caption{$B%(%i!<9T(B} \label{fig:errorMultiLine}
476: \end{figure}
477: $B?^(B\ref{fig:errorMultiLine} $B$G$O(B
478: \begin{screen}
479: \begin{verbatim}
480: print( 2^7 );
481: print( 2^8 );
482: print( deval(2^(1/2));
483: print( deval(3^(1/2)));
484: \end{verbatim}
485: \end{screen}
486: $B$HF~NO$7$F$$$k(B.
487: 3$B9TL\$O1&3g8L$,$R$H$DB-$j$J$/$F(B
488: \verb@print( deval(2^(1/2)));@
489: $B$,@5$7$$F~NO$G$"$k(B.
490: $B%(%i!<9T$N(B3$B9TL\$K%-%c%l%C%H$,<+F0E*$K0\F0$7$F$$$k$O$:$G$"$k(B.
1.4 takayama 491: $B$J$*%W%m%0%i%`$NF~NO%&%$%s%I!<Fb$G%^%&%9$r%/%j%C%/$9$k$H(B, $B$;$C$+$/<+F00\F0$7$?(B
492: $B%-%c%l%C%H$N0LCV$,JQ$C$F$7$^$&(B.
493: $B%W%m%0%i%`$NF~NO%&%$%s%I!<$N%?%$%H%k%P!<$G%/%j%C%/$9$k$H$h$$(B.
1.1 takayama 494: $B$J$*$3$NNc$G$O(B
495: \begin{center}
496: \scalebox{0.05}{\includegraphics{Figs/buttonBracket.eps}}
497: \end{center}
498: $B%\%?%s$r$b$A$$$F$b$9$0%(%i!<$N>l=j$,$o$+$k(B.
499: \index{$B$+$C$3(B@$B3g8L(B}
500:
501: \noindent {\bf $BCm0U(B}:
502: $BI=<($5$l$?9T$O%(%i!<$NH/@80LCV$G$"$k$,(B,
503: $B%(%i!<$N860x$O$=$NA0$NJ}$N9T$K$"$k$3$H$bB?$$(B.
504: $B$?$H$($P(B
505: \begin{screen}
506: \begin{verbatim}
507: 1+2
508: 2+3;
509: \end{verbatim}
510: \end{screen}
511: $B$HF~NO$9$k$H%(%i!<9T$O(B 2 $B9TL\$G$"$k$,(B, $B860x$O(B1$B9TL\$G(B {\tt ; } $B$r(B
512: $B=q$-K:$l$?$3$H$G$"$k(B.
513:
514: \bigbreak
515: $B%(%i!<9T$,J#?tI=<($5$l$?>l9g$O$=$l$i$NCf$N$I$3$+$K%(%i!<$,$"$k(B.
516: $BJ#?t$"$k%(%i!<9T$K=gHV$K%8%c%s%W$7$F$$$/$K$O(B,
517: \fbox{$B<B9T(B} $B%a%K%e!<$+$i(B \fbox{$B<!$N%(%i!<9T$X(B} $B$rA*Br$9$k(B.
518: \begin{center}
519: \scalebox{0.3}{\includegraphics{Figs/menuNextError.eps}}
520: \end{center}
521: \index{$B$D$.$N$($i!<$.$g$&$X(B@$B<!$N%(%i!<9T$X(B}
522:
523: \begin{problem} \rm
524: $B%(%i!<$r@8$8$k<0$^$?$O%W%m%0%i%`$r(B5$B$D:n$l(B.
525: \end{problem}
526:
527:
528: \chapter{ $BJQ?t$H%W%m%0%i%`(B }
529:
530: \section{$BJQ?t(B}
531:
532: \noindent \index{$B$X$s$9$&(B@$BJQ?t(B}
533: $BJQ?t$K?tCMEy$r5-21$7$F$*$1$k(B.
534: \underline{$BJQ?tL>$OBgJ8;z$G;O$^$k(B}. \index{$B$X$s$9$&$a$$(B@$BJQ?tL>(B}
535: %$B1Q;z$NBgJ8;z(B, $B;RJ8;z$r6hJL$7$F$$$k$N$GCm0U(B.
536: $B$J$*8e=R$9$k$h$&$K(B asir $B$G$OB?9`<07W;;$,$G$-$k$,>.J8;z$G;O$^$kJ8;zNs$O(B
537: $BB?9`<0$NJQ?tL>$H$7$FMxMQ$5$l$k(B.
538: \index{$B$?$3$&$7$-$N$X$s$9$&$a$$(B@$BB?9`<0$NJQ?tL>(B}
539: %en \noindent
540: %en Symbols starting with capital alphabetical characters are
541: %en {\it program variables}, which are used to store values.
542: %en \index{program variable}
543: %en Names of functions defined in programs start with small alphabetical
544: %en characters.
545: %en Note that variable symbols starting with small alphabetical characters are
546: %en variables in polynomials in Risa/Asir and they cannot be used to store
547: %en values.
548: %en
549:
550: \index{2$B$N$k$$$8$g$&(B@$2$$B$NN_>h(B}
551: $2$$B$NN_>h$rI=<($9$k<!$N%W%m%0%i%`$r9M$($h$&(B.
552: \begin{screen}
553: \begin{verbatim}
554: print( 2^1 );
555: print( 2^2 );
556: print( 2^3 );
557: print( 2^4 );
558: print( 2^5 );
559: print( 2^6 );
560: print( 2^7 );
561: print( 2^8 );
562: \end{verbatim}
563: \end{screen}
564: $B$3$N%W%m%0%i%`$OJQ?t(B {\tt X} $B$rMQ$$$F(B
565: $B<!$N$h$&$K=q$$$F$*$1$P(B $2$ $B$NN_>h$@$1$J$/(B $3$ $B$NN_>h$rI=<($9$k(B
566: $B$N$K:FMxMQ$G$-$k(B($B?^(B\ref{fig:powerOf2}).
567: \begin{screen}
568: \begin{verbatim}
569: X = 2;
570: print( X^1 );
571: print( X^2 );
572: print( X^3 );
573: print( X^4 );
574: print( X^5 );
575: print( X^6 );
576: print( X^7 );
577: print( X^8 );
578: \end{verbatim}
579: \end{screen}
580: \begin{figure}[thb]
581: \begin{center}
582: \scalebox{0.3}{\includegraphics{Figs/powerOf2.eps}}
583: \end{center}
584: \caption{$BJQ?t$NMxMQ(B} \label{fig:powerOf2}
585: \end{figure}
586: $3$ $B$NN_>h$rI=<($9$k$K$O(B
587: \verb@X=2@ $B$N9T$r(B \verb@X=3@ $B$KJQ99$9$l$P$$$$$@$1$G$"$k(B.
588:
589: $B%"%k%U%!%Y%C%H$N(B\underline{$BBgJ8;z(B}$B$G$O$8$^$k1Q?t;z$NNs$,(B asir $B$N(B
590: $BJQ?t$G$"$k(B.
591: $B$D$^$j(B, {\tt X}, {\tt Y}, {\tt Z} $B$O$b$A$m$s$N$3$H(B,
592: {\tt Sum} $B$H$+(B {\tt Kazu} $B$H$+(B {\tt X1} $B$J$I(B2$BJ8;z0J>e$N1Q?t;z$NNs(B
593: $B$NAH$_9g$o$;$,JQ?tL>$H$7$F5v$5$l$k(B.
594:
595:
596: $BJQ?t$r4^$s$@<0$r%W%m%0%i%`Cf$G<+M3$K$D$+$&$3$H$b$G$-$k(B.
597: $B$?$H$($P(B
598: \begin{verbatim}
599: X = 2;
600: A = 1;
601: print( 2*X^2 -A );
602: \end{verbatim}
603: $B$r<B9T$9$k$H(B {\tt 7} $B$,I=<($5$l$k(B.
604:
605: $B$3$N$h$&$JNc$r$_$k$H(B, $BJQ?t$N5!G=$O(B
606: $BCf3X?t3X$G$J$i$&J8;z<0$H;w$F$$$k$H;W$&$@$m$&(B.
607: $BD6F~Lg$H$7$F$O$3$l$G$[$\@5$7$$M}2r$G$"$k$,(B, $B$h$j%9%F%C%W%"%C%W$7$F$$$/$K$O(B,
608: $B<!$N$3$H$r6/$/5-21$7$F$*$3$&(B.
609: \begin{screen}
610: $BJQ?t$H$O7W;;5!$K?tCMEy$rJ]B8$7$F$*$/%a%b%j>e$N>l=j$NL>A0$G$"$k(B.
611: \end{screen}
612:
613: $B$5$F(B, $BD6F~Lg(B, $BBh0l$N4XLg$G$"$k(B.
614: \begin{screen}
615: {\tt =} $B5-9f$O<!$N$h$&$J7A<0$G$D$+$&(B:
616: $$ \mbox{{\bf $BJQ?tL>(B}} {\tt = } \mbox{{\bf $B<0(B}} {\tt ;} $$
617: $B$3$l$O$^$:1&JU$N<0$r7W;;$7$=$N$"$H$=$N7W;;7k2L$r:8JU$NJQ?t$KBeF~$;$h$H$$$&0UL#(B.
618: \verb@=@ $B5-9f$O1&JU$r7W;;$7$F$=$N7k2L$r:8JU$XBeF~$;$h$H$$$&(B\underline{$BL?Na(B}
619: $B$@$H;W$C$FM_$7$$(B. \\
620: $B$?$H$($P(B,
621: \verb@X=1@ $B$O(B \verb@X@ $B$,(B \verb@1@ $B$KEy$7$$$H$$$&0UL#$G$O$J$/(B,
622: \verb@1@ $B$r(B $BJQ?t(B \verb@X@ $B$KBeF~$;$h$H$$$&0UL#$G$"$k(B.
623: \end{screen}
624: $B$3$3$G$$$$$?$$$3$H$O(B, \index{$B$@$$$K$e$&(B@$BBeF~(B} \index{=} \index{$B$@$$$K$e$&$-$4$&(B=@$BBeF~5-9f(B=}
625: \begin{screen}
626: \verb@=@ $B5-9f$N0UL#$,?t3X$G$N0UL#$H0c$&$h(B!
627: \end{screen}
628: $B$H$$$&$3$H$G$"$k(B.
629: $B$3$l$G:.Mp$9$kF~Lg<T$bB?$$$N$G%W%m%0%i%`8@8l$K$h$C$F$O(B
630: ``$2$ $B$rJQ?t(B {\tt X} $B$KBeF~$;$h(B'' $B$r(B
631: \verb@X:=2@
632: $B$H=q$/>l9g$b$"$k(B ($B$?$H$($P%W%m%0%i%`8@8l(B Pascal).
633:
634: $B<!$N%W%m%0%i%`$O(B $2$, $2^2$, $2^4$, $2^8$ $B$r7W;;$7$FI=<($9$k(B.
635: \begin{screen}
636: \begin{verbatim}
637: X=2;
638: print(X);
639: X = X*X;
640: print(X);
641: X = X*X;
642: print(X);
643: X = X*X;
644: print(X);
645: \end{verbatim}
646: \end{screen}
647: \begin{figure}[thb]
648: \begin{center}
649: \scalebox{0.3}{\includegraphics{Figs/powerOf2b.eps}}
650: \end{center}
651: \caption{$BJQ?t$NMxMQ(B} \label{fig:powerOf2b}
652: \end{figure}
653: $B=PNO$,?^(B\ref{fig:powerOf2b}$B$N$h$&$K$J$kM}M3$r@bL@$7$h$&(B.
654: $B$^$:(B1$B9TL\$GJQ?t(B{\tt X}$B$K(B2$B$,BeF~$5$l$k(B.
655: $B<!$K(B3$B9TL\$G$O$^$:1&JU$N<0$r7W;;$9$k(B. $B$3$N>l9g(B {\tt X} $B$NCM$O(B $2$ $B$G$"$k$N$G(B,
656: $2\times2$ $B$G7k2L$O(B $4$ $B$G$"$k(B.
657: \underline{$B$3$N7W;;$,=*$C$?8e(B}$B7k2L$N(B $4$ $B$,JQ?t(B {\tt X} $B$KBeF~$5$l$k(B.
658: 5$B9TL\$G$O1&JU$N<0$O(B $4 \times 4$ $B$J$N$G(B, $B$=$N7W;;7k2L$N(B $16$ $B$,(B $B:8JU$NJQ?t(B $X$
659: $B$KBeF~$5$l$k(B.
660: \index{$B$X$s$9$&(B@$BJQ?t(B}
661:
662: \bigbreak
663: %
664: %
665: \noindent
666: \HHH \index{$B$?$3$&$7$-(B@$BB?9`<0(B} \index{$B$9$&$7$-$7$g$j(B@$B?t<0=hM}(B}
667: Asir $B$OB?9`<07W;;$b$G$-$k(B. $B<B$O(B Asir $B$O7W;;5!$G5-9fE*$K?t<0$r=hM}$9$k$?$a$N(B
668: $B?t<0=hM}%7%9%F%`$G$b$"$k(B.
669: %en Asir can do calculations for polynomials.
670: \begin{enumerate}
671: %en \begin{enumerate}
672: \item $B>.J8;z$G$O$8$^$k5-9f$OB?9`<0$NJQ?t$G$"$k(B.
673: $B?t3X$H$A$,$C$FJQ?t$NL>A0$O0lJ8;z$H$O$+$.$i$J$$(B.
674: $B$?$H$($P(B {\tt rate} $B$H=q$/$H(B, $rate$ $B$H$$$&L>A0$NB?9`<0$NJQ?t$H$J$k(B.
675: $B$?$H$($P(B {\tt x2} $B$H=q$/$H(B, $x2$ $B$H$$$&L>A0$NB?9`<0$NJQ?t$H$J$k(B.
676: $x$ $B$+$1$k(B $2$ $B$O(B {\tt x*2} $B$H=q$/(B. \index{$B$?$3$&$7$-$X$s$9$&(B@$BB?9`<0JQ?t(B}
677: %en \item Symbols starting small alphabetical character are variables of polynomials. For example, {\tt x2} is the variable of the name x2.
678: %en The expression {\tt x*2} stands for $x$ times $2$.
679: %
680: %
681: \item \index{$B$$$s$9$&$V$s$+$$(B@$B0x?tJ,2r(B} \index{fctr}
682: {\tt fctr(\poly)} $B$O(B \poly $B$rM-M}?t78?t$NHO0O$G0x?tJ,2r$9$k(B.
683: {\tt fctr} $B$O(B factor $B$NC;=LI=8=$G$"$k(B.
684: %en \item \index{factorization} \index{fctr}
685: %en The input {\tt fctr(\poly)} factors \poly in the ring of polynomials
686: %en with rational number coefficients.
687: %
688: %
689: \end{enumerate}
690: %en \end{enumerate}
691:
692: \begin{figure}[tbh]
693: \begin{center}
694: \scalebox{0.3}{\includegraphics{Figs/fctr1.eps}}
695: \end{center}
696: \caption{$B0x?tJ,2r(B} \label{fig:fctr1}
697: \end{figure}
698:
699: $B?^(B\ref{fig:fctr1} $B$N(B{\tt fctr} $B$N=PNO$N:G=i$O(B $x^2+2xy+y^2$ $B$,(B
700: $ 1^1 \times (x+y)^2 $
701: $B$H0x?tJ,2r$5$l$k$3$H$r0UL#$7$F$$$k(B.
702: $B?^(B\ref{fig:fctr1} $B$N(B{\tt fctr} $B$N=PNO$N(B2$BHVL\$O(B $x^2-1$ $B$,(B
703: $$ 1^1 \times (x-1)^1 \times (x+1)^1
704: $$
705: $B$H0x?tJ,2r$5$l$k$3$H$r0UL#$7$F$$$k(B.
706:
707:
708: \section{$B$/$j$+$($7(B}
709:
710: $B$/$j$+$($7$dH=CG$r$*$3$J$&$?$a$NJ8$,(B asir $B$K$OMQ0U$5$l$F$$$k(B.
711: $B$3$NJ8$r$b$A$$$k$HJ#;($J$3$H$r<B9T$G$-$k(B.
712: $B$^$:0lHV$N4pAC$G$"$k$/$j$+$($7$N5!G=$r$?$a$7$F$_$h$&(B.
713: \index{$B$/$j$+$($7(B} \index{for$B$V$s(B@for$BJ8(B}
714: %en A programming language is installed in Asir.
715: %en Let us try the most basic programming; repeating and printing.
716: \begin{example} \rm
717: $B?^(B\ref{fig:powerOf2}$B$N%W%m%0%i%`$O<!$N$h$&$K7+$jJV$75!G=(B --- {\tt for}$BJ8(B ---
718: $B$rMQ$$$F4J7i$K=q$1$k(B.
719: \begin{screen}
720: \begin{verbatim}
721: X = 2;
722: for (I=1; I<=8; I++) {
723: print( X^I );
724: }
725: \end{verbatim}
726: \end{screen}
727: $B<B9T7k2L$O?^(B\ref{fig:powerOf2For}$B$r$_$h(B.
728: \end{example}
729:
730: \begin{figure}[tbh]
731: \begin{center}
732: \scalebox{0.3}{\includegraphics{Figs/powerOf2For.eps}}
733: \end{center}
734: \caption{for$BJ8(B} \label{fig:powerOf2For}
735: \end{figure}
736:
737:
738: $B7+$jJV$74XO"$NI=8=$N0UL#$r2U>r=q$K$7$F$^$H$a$F$*$3$&(B.
739: \begin{enumerate}
740: %en \begin{enumerate}
741: \item \index{for} \index{$B$/$j$+$($7(B@$B7+$jJV$7(B} \index{\<@\verb&<=&}
742: %en \item \index{for} \index{repeat} \index{\<@\verb&<=&}
743: \verb@ for (K=$B=i4|CM(B; K<=$B=*$j$NCM(B; K++) {$B%k!<%W$NCf$G<B9T$9$k%3%^%s%I(B}; @
744: $B$O$"$k$3$H$r2?EY$b7+$jJV$7$?$$;~$KMQ$$$k(B.
745: for $B%k!<%W$H8F$P$l$k(B.
746: ``{\tt K<=N}'' $B$O(B, ``${\tt K} \leq {\tt N}$$B$+(B'' $B$H$$$&0UL#$G$"$k(B.
747: $B;w$?I=8=$K(B,
748: ``{\tt K>=N}''$B$,$"$k$,(B, $B$3$l$O(B ``${\tt K} \geq {\tt N}$$B$+(B'' $B$H$$$&0UL#$G$"$k(B.
749: {\tt =} $B$N$J$$(B
750: ``{\tt K<N}'' $B$O(B, ``${\tt K} < {\tt N}$$B$+(B'' $B$H$$$&0UL#$G$"$k(B.
751: \item \verb@ ++K @ $B$d(B \verb@ K++ @ $B$O(B {\tt K} $B$r(B 1 $BA}$d$;$H$$$&0UL#$G$"$k(B.
752: \verb@ K = K+1 @ $B$H=q$$$F$b$h$$(B.
753: $BF1$8$/(B, \verb@ --K @ $B$d(B \verb@ K-- @ $B$O(B {\tt K} $B$r(B 1 $B8:$i$;$H$$$&0UL#$G$"$k(B.
754: %en The sentence
755: %en {\tt for (K={\it initial value}; K<={\it limit}; K++) \{{\it commands}\}; }
756: %en is used to repeat commands.
757: %en It is called the ``for'' loop.
758: %en ``{\tt K<=N}'' means that ``${\tt K} \leq {\tt N}$ holds''.
759: %en A similar expression
760: %en ``{\tt K>=N}'' implies that ``${\tt K} \geq {\tt N}$ holds''
761: %en The expression ``{\tt K<N}'' means that ``${\tt K} < {\tt N}$''.
762: %en \item The expressions \verb@ ++K @ and \verb@ K++ @ mean increasing
763: %en {\tt K} by $1$.
764: %en In this example, it has the same meaning with \verb@ K = K+1 @.
765: %en Similarly \verb@ --K @ and \verb@ K-- @ mean decreasing {\tt K} by 1.
766: %
767: %
768: \end{enumerate}
769: %en \end{enumerate}
770: %en
771:
772: \begin{figure}[tbh]
773: \begin{center}
774: \scalebox{0.3}{\includegraphics{Figs/powerOf2For2.eps}}
775: \end{center}
776: \caption{for$BJ8(B} \label{fig:powerOf2For2}
777: \end{figure}
778: for $B$N$"$H$N(B {\tt \{}, {\tt \}} $B$NCf$K$OJ#?t$NJ8(B($BL?Na(B)$B$r=q$1$k(B.
779: \begin{screen}
780: \begin{verbatim}
781: X = 2;
782: for (I=1; I<=8; I++) {
783: print("2$B$N(B"+rtostr(I)+"$B>h$O(B ",0);
784: print( X^I );
785: }
786: \end{verbatim}
787: \end{screen}
788: $B$3$NNc$G$O(B
789: $BF|K\8l$r4^$`$N$GA0$N@a$G=R$Y$?$h$&$KF|K\8l6uGr$r%W%m%0%i%`K\BN$K$$$l$J$$$h$&$K$7$F(B,
790: $BCm0U?<$/%W%m%0%i%`$rF~NO$7$F$b$i$$$?$$(B.
791: $B<B9T7k2L$O?^(B\ref{fig:powerOf2For2}$B$r$_$h(B. \index{2$B$N$k$$$8$g$&(B@$2$$B$NN_>h(B}
792: \verb@print("2$B$N(B"+rtostr(I)+"$B>h$O(B ",0);@ $B$NItJ,$r4JC1$K@bL@$7$F$*$3$&(B.
793: $B$^$::G8e$N(B {\tt 0} $B$O=PNO$N$"$H2~9T$7$J$$(B, $B$D$^$j<!$N(B {\tt print} $BJ8$N=PNO$r(B
794: $B$=$N$^$^B3$1$h$H$$$&0UL#(B. \index{print} \index{rtostr}
795: \verb@"@ $B$G$+$3$^$l$?ItJ,$OJ8;zNs$H8F$P$l$F$$$k(B.$B$3$l$O$3$N$^$^I=<($5$l$k(B.
796: \verb@rtostr(I)@ $B$O?t;z(B {\tt I} $B$rJ8;zNsI=8=$KJQ49$7$J$5$$(B, $B$H$$$&0UL#(B
797: ($BD6F~Lg$H$7$F$OFq$7$$(B?).
798: $B$"$HJ8;zNs$KBP$7$F(B {\tt +} $B$rE,MQ$9$k$HJ8;zNs$,7k9g$5$l$k(B.
799: \index{$B$b$8$l$D$N$1$D$4$&(B@$BJ8;zNs$N7k9g(B}
800: \index{$B$b$8$l$D$R$g$&$2$s(B@$BJ8;zNsI=8=(B}
801:
802:
803: \noindent
804: \fbox{$B;(CL(B}
805: ($B9>8M;~Be$N?t3X$NK\$K$"$C$?LdBj$N2~Bj(B) \\
806: $BEBMM(B: $B$3$N$?$S$NF/$-$O$"$C$Q$l$G$"$C$?(B. $BK+H~$O$J$K$,$h$$$+(B? \\
807: $B2HMh(B: $B:#F|$O0l1_(B, $BL@F|$O(B2$B1_(B, $BL@8eF|$O(B4$B1_$H(B, $BA0F|$N(B2$BG\$E$D(B, $B$3$l$r(B4$B=54VB3$1$F(B
808: $B$/$@$5$k$@$1$G7k9=$G$4$6$$$^$9(B. \\
809: $BEBMM(B: $B$J$s$H$b$5$5$d$+$JK+H~$8$c$N$&(B. $B$h$7$h$7(B. \\
810: $B$5$F(B, $B2HMh$O$$$/$iK+>^6b$r$b$i$($k$@$m$&(B?
811: $B$3$l$b$^$?(B$2$$B$NN_>h$N7W;;$G$"$k(B. \index{2$B$N$k$$$8$g$&(B@$2$$B$NN_>h(B}
812: Cfep/asir $B$G7W;;$7$F$_$h$&(B.
813:
814:
815:
816: \begin{example}\Begin \quad
817: {\tt for} $B$K$h$k7+$jJV$7$rMQ$$$F(B $\sqrt{x}$ $B$N?tI=$r$D$/$m$&(B.
818: %en \begin{example}\Begin [02] \quad
819: %en By using {\tt for} loop, generate a table of $\sqrt{x}$.
820: %en \end{example}
821: %en
822: \begin{screen}
823: \begin{center}
824: \begin{verbatim}
825: for (I=0; I<2; I = I+0.2) {
826: print(I,0); print(" : ",0);
827: print(deval(I^(1/2)));
828: }
829: \end{verbatim}
830: \end{center}
831: \end{screen}
832: %>C
833: $B=PNO7k2L(B
834: %en Output.
835: %<C
836: \begin{center}
837: \begin{tabular}{|l|} \hline \sl
838: 0 : 0 \\
839: 0.2 : 0.447214 \\
840: 0.4 : 0.632456 \\
841: 0.6 : 0.774597 \\
842: 0.8 : 0.894427 \\
843: 1 : 1 \\
844: 1.2 : 1.09545 \\
845: 1.4 : 1.18322 \\
846: 1.6 : 1.26491 \\
847: 1.8 : 1.34164 \\
848: 2 : 1.41421 \\
849: \hline
850: \end{tabular}
851: \end{center}
852: %>C
853: \rm
854: \index{print}
855: {\tt print(A)} $B$OJQ?t(B {\tt A} $B$NCM$r2hLL$KI=<($9$k(B.
856: {\tt print($BJ8;zNs(B)} $B$OJ8;zNs$r2hLL$KI=<($9$k(B.
857: {\tt print(A,0)} $B$OJQ?t(B {\tt A} $B$NCM$r2hLL$KI=<($9$k$,(B, $BI=<($7$?(B
858: $B$"$H$N2~9T$r$7$J$$(B.
859: $B6uGr$bJ8;z$G$"$k(B.$B$7$?$,$C$F(B, $B$?$H$($P(B
860: {\tt A=10; print(A,0); print(A+1);}
861: $B$r<B9T$9$k$H(B, \index{print}
862: {\tt 1011} $B$HI=<($5$l$F$7$^$&(B.
863: {\tt A=10; print(A,0); print(" ",0);print(A+1);}
864: $B$r<B9T$9$k$H(B,
865: {\tt 10 11} $B$HI=<($5$l$k(B.
866: %en \rm
867: %en \index{print}
868: %en The command {\tt print(A)} displays the value of the variable {\tt A}
869: %en on the screen.
870: %en The command {\tt print({\it string})} outpus the {\it string} on the screen.
871: %en The command {\tt print(A,0)} displays the value of the variable {\tt A},
872: %en but it does not make the newline.
873: %en Note that the blank is a character. For example, if you input
874: %en {\tt A=10; print(A,0); print(A+1);}
875: %en {\tt 1011} will be displayed. So, input as
876: %en {\tt A=10; print(A,0); print(" ",0);print(A+1);}
877: %en Then,
878: %en {\tt 10 11} will be displayed.
879: %en
880: \end{example}
881:
882: $B$H$3$m$G(B, $B$3$NNc$G$O>r7o$,(B ${\tt I}<2$ $B$J$N$K(B ${\tt I}=2$
883: $B$N>l9g$,I=<($5$l$F$$$k(B.
884: $B<B:]$K(B asir $B>e$G<B9T$7$F$_$k$H$3$&$J$k$,(B, $BM}M3$rCN$k$K$O!"(B
885: $BIbF0>.?t$N7W;;5!>e$G$NI=8=$K$D$$$F$NCN<1$,I,MW$G$"$k(B
886: (``asir$B%I%j%k(B''$B$r;2>H(B).
887: $B$H$j$"$($:(B,
888: %en In this example, the termination condition is ${\tt I}<2$, but
889: %en the case of ${\tt I}=2$ is executed. In order to understand the reason,
890: %en we need to study the format of floating point numbers.
891: %en (See \ref{chapter:naibu} for details).
892: %en For now, please keep the following in our mind.
893: \begin{FRAME}
894: $B@0?t$dJ,?t$N7W;;$O(B Asir $B>e$G@53N$K<B9T$5$l$k$,(B,
895: $B>.?t$K$D$$$F$O$=$&$G$J$$(B.
896: \end{FRAME}
897: $B$H3P$($F$*$3$&(B.
898: %en \begin{FRAME}
899: %en Arithmetics for integers and rational numbers are exact in Risa/Asir,
900: %en but arithmetics for dicimal numbers are not.
901: %en \end{FRAME}
902: %en
903:
904: \begin{problem}
905: $B$"$?$($i$l$?(B 10 $B?J?t$r(B 2$B?J?t$XJQ49$9$k%W%m%0%i%`$r:n$l(B.
906: $B%R%s%H(B: {\tt A}$B!`(B{\tt B} $B$NM>$j$O(B \verb@A%B@ $B$G7W;;$G$-$k(B.
907: \index{$B$"$^$j(B@$BM>$j(B}
908: \end{problem}
909:
910: \section{$B<B9T$NCf;_(B}
911: %
912: %
913: \index{$B$A$e$&$7(B@$BCf;_(B} \index{interrupt}
914: $B<B9TCf$N7W;;$d%W%m%0%i%`$N<B9T$rCf;_$7$?$$;~$OCf;_%\%?%s(B
915: \begin{center}
916: \scalebox{0.1}{\includegraphics{Figs/buttonStop.eps}}
917: \end{center}
918: $B$r%/%j%C%/$9$k(B.
919:
920: \begin{figure}[tbh]
921: \begin{center}
922: \scalebox{0.5}{\includegraphics{Figs/interrupt.eps}}
923: \end{center}
924: \caption{$B<B9T$NCf;_(B} \label{fig:interrupt}
925: \end{figure}
926:
927: $B?^(B\ref{fig:interrupt}$B$G$O(B
928: $10^{100}$ $B2s$N(B {\tt Hello } $B$N=PNO$N7+$jJV$7$rCf;_$7$F$$$k(B.
929:
930: cfep $B$O3+H/ES>e$N%7%9%F%`$N$?$a(B
931: \begin{verbatim}
932: [control] control function_id is 1030
933: [control] control_reset_connection.
934: Sending the SIGUSR1 signal to 1226: Result = 0
935: In ox103_reset: Done.
936: 515
937: Done
938: \end{verbatim}
939: $B$3$N$h$&$J3+H/<T@lMQ$N%a%C%;!<%8$b=PNO$5$l$k$,(B,
940: $B$H$j$"$($:$3$N$h$&$J%a%C%;!<%8$,$G$?$iCf;_$,@.8y$7$?$H$$$&$3$H$G$"$k(B.
941:
942:
943: \section{$B%(%s%8%s:F5/F0(B}
944:
945: \index{$B$5$$$-$I$&(B@$B:F5/F0(B} \index{$B$1$$$5$s$($s$8$s(B@$B7W;;%(%s%8%s(B}
946: \index{$B$1$$$5$s$5!<$P(B@$B7W;;%5!<%P(B}
947: Cfep/asir $B$G$O<!$N$h$&$K(B3$B$D$N%W%m%;%9$,8_$$$KDL?.$7$J$,$iF0:n$7$F$$$k(B.
948: \begin{center}
949: \fbox{cfep} $\Leftrightarrow$ \fbox{$B%3%s%H%m!<%i(B(ox\_texmacs)}
950: $\Leftrightarrow$ \fbox{$B7W;;%(%s%8%s(B(ox\_asir)}
951: \end{center}
952: $B7W;;%(%s%8%s(B($B7W;;%5!<%P(B)$B$r:F5/F0$7$?$jJL$N$b$N$K$H$j$+$($?$j$G$-$k(B.
953: \index{$B$1$$$5$s$($s$8$s(B@$B7W;;%(%s%8%s(B}
954: \index{$B$1$$$5$s$5!<$P(B@$B7W;;%5!<%P(B}
955: \index{$B$($s$8$s(B@$B%(%s%8%s(B}
956:
957: \index{$B$5$$$-$I$&(B@$B:F5/F0(B} \index{restart}
958: $B%(%s%8%s:F5/F0%\%?%s(B
959: \begin{center}
960: \scalebox{0.05}{\includegraphics{Figs/buttonRestart}}
961: \end{center}
962: $B$r%/%j%C%/$9$k$H(B,
963: $B8=:_MxMQ$7$F$$$k7W;;%(%s%8%s$rDd;_$7(B,
964: $B?7$7$$7W;;%(%s%8%s$r%9%?!<%H$9$k(B.
965: $BA*BrHO0O$N$_$r<B9T$9$k%b!<%I$G$J$$$+$.$jMxMQ>e$GCf;_$H$N0c$$$O(B
966: $B$"$^$j$J$$$,(B, $B:F5/F0$N$H$-$N%a%C%;!<%8(B
967: \begin{center}
968: \scalebox{0.4}{\includegraphics{Figs/restartDialog}}
969: \end{center}
970: $B$K$b$"$k$h$&$K(B, $BJL$N7W;;%(%s%8%s$r5/F0$9$k$3$H$b2DG=$G$"$k(B.
971: $B$3$NNc$G$O(B unix shell $B$b5/F0$G$-$k(B.
972:
973: $B$^$?(B, ``$B<B9T(B'' $B%a%K%e!<$+$i(B ``$B%(%s%8%s$r<+F0%9%?!<%H$7$J$$(B'' $B%b!<%I$rA*$s$G$k(B
974: $B>l9g$K7W;;%(%s%8%s$r<jF0$G%9%?!<%H$9$k$K$O(B, $B$3$N%\%?%s$rMQ$$$k(B.
975:
976: \bigbreak
977:
978: \noindent
979: \HHH
980: cfep $B$O(B \index{cfep}
981: Cocoa FrontEnd view Process
982: $B$NN,$G$"$k(B.
983: cfep $B$O(B Objective C $B$H$$$&8@8l$*$h$S(B xcode 2 $B$H$$$&3+H/4D6-$rMQ$$$F(B
984: Cocoa $B$H$$$&%U%l!<%`%o!<%/$N$b$H$G3+H/$5$l$F$$$k(B.
985: cfep $B$N(B Objective C $B$N%W%m%0%i%`$N0lIt$r$_$F$_$h$&(B.
986: \begin{screen}
987: \begin{verbatim}
988: for (i=0; i<oglCommSize; i++) {
989: gc = [oglComm objectAtIndex: i];
990: [self execute: gc];
991: }
992: \end{verbatim}
993: \end{screen}
994: asir $B$HF1$8$h$&$J(B {\tt for} $BJ8$,$"$k$M(B.
995:
996: \section{$B%X%k%W$NMxMQ(B}
997:
998: \index{$B$+$s$9$&(B@$B4X?t(B}
999: Cfep/asir $B$G$N(B ``$B4X?t(B'' $B$H$O?t3X$N4X?t$N$h$&$K0z?t$rM?$($k$H7W;;$7$FCM$r$b$I$7(B,
1000: $B$+$D$"$k;E;v(B($BI=<(Ey(B)$B$r$9$k<jB3$-$N=8$^$j$G$"$k(B.
1001: $BNc$($P(B {\tt print}, {\tt deval}, {\tt sin}, {\tt fctr} $BEy$O4X?t$G$"$k(B.
1002: $B4X?t$r<+J,$GDj5A$9$k$3$H$b2DG=$G$"$k(B. $B$3$l$K$D$$$F$O8e$N@bL@$*$h$S(B
1003: ``asir$B%I%j%k(B''$B$r;2>H(B.
1004:
1005: $B$"$i$+$8$aDj5A$:$_$N4X?t$r(B ``$BAH$_9~$_4X?t(B'' $B$H$h$V(B.
1006: \index{help}
1007: \index{$B$X$k$W(B@$B%X%k%W(B} \index{$B$/$_$3$_$+$s$9$&(B@$BAH$_9~$_4X?t(B}
1008: $BAH$_9~$_4X?t$N>\$7$$@bL@$rD4$Y$k$K$O(B
1009: ``cfep $B$N%X%k%W(B'' $B$+$i(B
1010: \begin{center}
1011: \scalebox{0.3}{\includegraphics{Figs/helpTop}}
1012: \end{center}
1013: $B$N(B ``$B:w0z(B'' $B$rA*$S(B, $B:w0z(B
1014: \begin{center}
1015: \scalebox{0.45}{\includegraphics{Figs/helpIndex}}
1016: \end{center}
1017: $B$N(B ``Risa/Asir $B%^%K%e%"%k(B'' $B$rA*$S(B,
1018: ``Risa/Asir $B%^%K%e%"%k(B'' $B$N:G=i$N%Z!<%8$N4X?t0lMw$+$i(B
1019: $BD4$Y$?$$4X?t$rC5$9(B.
1020: $B$?$H$($P(B {\tt fctr} ($B0x?tJ,2rMQ$N4X?t(B) $B$O$3$N0lMw$NCf$K$"$k(B.
1021: \begin{center}
1022: \scalebox{0.35}{\includegraphics{Figs/helpFctr}}
1023: \end{center}
1024: \index{fctr}
1025:
1026:
1027: \index{spotlight}
1028: $B8!:w$K$O(B spotlight $B$N3hMQ$bM-1W$G$"$m$&(B. $B:w0z(B
1029: \begin{center}
1030: \scalebox{0.45}{\includegraphics{Figs/helpIndex}}
1031: \end{center}
1032: $B$N(B ``$B;HMQ@bL@=q$N%U%)%k%@$r(Bfinder$B$G3+$/(B''
1033: $B$rA*$V$H;HMQ@bL@=q$N%U%)%k%@$,3+$/$N$G(B, $B$3$3$r(B spotlight $B$G8!:w$9$k$H(B
1034: $B$$$m$$$m$JH/8+$,$"$k$G$"$m$&(B.
1035: $B$A$J$_$K(B, $B$3$ND6F~Lg$d(B asir$B%I%j%k$O$3$N%U%)%k%@$N(B pdf $B%U%)%k%@$NCf$K$"$k(B.
1036: ($B$J$*$3$3$+$i$N(B spotlight $B8!:w$O2?8N$+CY$$$N$G(B, $B%a%K%e!<%P!<$N(B
1037: splotlight $B$+$i$N8!:w$NJ}$,$$$$$+$b$7$l$J$$(B.
1038: )
1039: %% mdfind, mdimport?
1040:
1041:
1042: \chapter{$B%0%i%U%#%C%/(B}
1043:
1044: \section{$B%i%$%V%i%j$NFI$_9~$_(B} \index{$B$i$$$V$i$j(B@$B%i%$%V%i%j(B}
1045:
1046: \begin{figure}
1047: \begin{center}
1048: \scalebox{0.5}{\includegraphics{Figs/glib_lineImport.eps}}
1049: \end{center}
1050: \caption{$B%i%$%V%i%j$N%m!<%I(B} \label{fig:glib_lineImport}
1051: \end{figure}
1052:
1053: Asir $B8@8l$G=q$+$l$F$$$k4X?tDj5A$N=89g$,%i%$%V%i%j$G$"$k(B.
1054: $B%i%$%V%i%j$rFI$_9~$`$K$O(B {\tt import} $B%3%^%s%I$^$?$O(B
1055: {\tt load} $B%3%^%s%I$rMQ$$$k(B. \index{import} \index{load}
1056: $B%^%K%e%"%k$K5-=R$5$l$F$$$k4X?t$G%i%$%V%i%j$NFI$_9~$_$,A0Ds$H$J$C$F$k$b$N$b(B
1057: $BB?$$(B.
1058: $B$?$H$($P(B, $B@~$r0z$/%3%^%s%I(B {\tt glib\_line(0,0,100,100);}
1059: $B$r<B9T$7$F$b(B, ``glib\_line $B$,Dj5A$5$l$F$$$^$;$s(B''
1060: $B$H$$$&%(%i!<$,I=<($5$l$k(B.
1061: $B%0%i%U%#%C%/%3%^%s%I$N%i%$%V%i%jFI$_9~$`%3%^%s%I(B
1062: \begin{verbatim}
1063: import("glib3.rr");
1064: \end{verbatim}
1065: $B$r<B9T$7$F$*$/$H?^(B\ref{fig:glib_lineImport}$B$N$h$&$K(B
1066: $B@~$rIA2h$9$k(B.
1067:
1068:
1069: Asir-contrib $B%W%m%8%'%/%H$K$h$j=8@Q$5$l$?%i%$%V%i%j$N=89gBN$,(B
1070: asir-contrib $B$G$"$k(B. \index{asir-contrib}
1071: Asir-contrib $B$rFI$_9~$s$G$7$^$&$H(B,
1072: $B$[$H$s$I$N4X?t$K$D$$$F(B import $B$,I,MW$+$I$&$+5$$K$9$kI,MW$O$J$/$J$k$,(B,
1073: $BBgNL$N%i%$%V%i%j$rFI$_9~$`$?$a$K;~4V$,$+$+$k$N$,7gE@$G$"$k(B.
1074: asir-contrib $B$O(B \fbox{$B<B9T(B} $B%a%K%e!<$+$iFI$_9~$a$k(B.
1075: \begin{center}
1076: \scalebox{0.3}{\includegraphics{Figs/importContrib}}
1077: \end{center}
1078:
1079: \section{$B@~$r0z$/4X?t(B}
1080:
1081: \begin{example} \rm
1082: \begin{screen}
1083: \begin{verbatim}
1084: import("glib3.rr");
1085: glib_line(0,0, 100,100);
1086: glib_flush();
1087: \end{verbatim}
1088: \end{screen}
1089: $B?^(B\ref{fig:glib_lineImport} $B$,IA2h7k2L$G$"$k(B.
1090: $y$$B:BI8$O2hLL$,2<$X$$$/$[$IBg$-$/$J$k(B.
1091: $B?^(B\ref{figure:cond:coord} $B$r;2>H(B.
1092: $B:8>e$N:BI8$O(B $(0,0)$, $B1&2<$N:BI8$,(B $(400,400)$.
1093: \verb@glib_line@ $B$G(B $(0,0)$ $B$+$i(B $(100,100)$ $B$X@~$rIA2h(B.
1094: \verb@glib_flush@ $B$O2hLL$r99?7$9$k$O$?$i$-$,$"$k(B. flush $B$7$J$$$H(B,
1095: $BIA2h7k2L$,2hLL$G$NI=<($KH?1G$7$J$$>l9g$,$"$k(B.
1096: \end{example}
1097:
1098: \index{glib}
1099: {\tt glib3.rr} $B$r%m!<%I$9$k$3$H$K$h$j(B, $B<!$N4X?t$,;H$($k$h$&$K$J$k(B. \\
1100: \begin{tabular}{|l|l|}
1101: \hline
1102: {\tt glib\_window(X0,Y0,X1,Y1)} &
1103: $B?^$r=q$/(B window $B$N%5%$%:$r7h$a$k(B. \\
1104: & $B2hLL:8>e$N:BI8$,(B {\tt (X0,Y0)},
1105: $B2hLL1&2<$N:BI8$,(B {\tt (X1,Y1)} \\
1106: & $B$G$"$k$h$&$J:BI87O$G0J2<IA2h$;$h(B. \\
1107: & $B$?$@$7(B x $B:BI8$O(B, $B1&$K$$$/$K=>$$$*$*$-$/$J$j(B, \\
1108: &
1109: y $B:BI8$O(B \underline{$B2<$K(B} $B$$$/$K=>$$Bg$-$/$J$k(B ($B?^(B \ref{figure:cond:coord}). \\ \hline
1110: {\tt glib\_clear()} & $BA4$F$N(BOpenGL$B%*%V%8%'%/%H$r>C5n$7(B,
1111: $BIA2h2hLL$r%/%j%"$9$k(B. \\ \hline
1112: {\tt glib\_putpixel(X,Y)} & $B:BI8(B {\tt (X,Y)} $B$KE@$rBG$D(B. \\ \hline
1113: {\tt glib\_set\_pixel\_size(S)} &
1114: $BE@$NBg$-$5$N;XDj(B. 1.0 $B$,(B1$B%T%/%;%kJ,$NBg$-$5(B. \\ \hline
1115: {\tt glib\_line(X,Y,P,Q)} & $B:BI8(B {\tt (X,Y)} $B$+$i(B $B:BI8(B {\tt (P,Q)} $B$XD>@~$r0z$/(B \\ \hline
1116: {\tt glib\_remove\_last()} & $B0l$DA0$N(B OpenGL $B%*%V%8%'%/%H$r>C$9(B. \\ \hline
1117: \end{tabular}
1118:
1119: \begin{figure}[htb]
1120: \setlength{\unitlength}{1mm}
1121: \begin{picture}(100,40)(0,0)
1122: \put(20,35){\vector(1,0){80}}
1123: \put(98,32){x}
1124: \put(20,35){\vector(0,-1){35}}
1125: \put(23,1){y}
1126: \end{picture}
1127: \caption{$B:BI87O(B} \label{figure:cond:coord}
1128: \end{figure}
1129:
1130: $B?'$rJQ99$7$?$$$H$-$O(B, \verb@ | @ $B5-9f$G6h@Z$C$?%*%W%7%g%J%k0z?t(B
1131: {\tt color} $B$r;H$&(B. \index{$B$*$W$7$g$J$k$R$-$9$&(B@$B%*%W%7%g%J%k0z?t(B}
1132: $B$?$H$($P(B,
1133: \begin{center}
1134: \verb@ glib_line(0,0,100,100|color=0xff0000); @
1135: \end{center}
1136: $B$HF~NO$9$k$H(B, $B?'(B {\tt 0xff0000} $B$G@~J,$r$R$/(B.
1137: $B$3$3$G(B, $B?'$O(B RGB $B$N3F@.J,$N6/$5$r(B 2 $B7e$N(B 16 $B?J?t$G;XDj$9$k(B.
1138: 16$B?J?t$K$D$$$F$O(B ``asir $B%I%j%k(B'' $B$r;2>H(B.
1139: $B$3$NNc$G$O(B, R $B@.J,$,(B ff $B$J$N$G(B, $B@V$N@~$r$R$/$3$H$H$J$k(B.
1140: $B$J$*(B, $B4X?t(B {\tt glib\_putpixel} $B$bF1$8$h$&$K$7$F(B, $B?'$r;XDj$G$-$k(B.
1.5 takayama 1141: 16$B?J?t$rCN$i$J$$?MMQ$K(B, $B?'$H$=$N(B16$B?J?t$K$h$kI=8=$NBP1~I=$r$"$2$F$*$/(B.
1142:
1143: \begin{tabular}{|l|l|}
1144: \hline
1145: 0xffffff & $BGr(B \\ \hline
1146: 0xffff00 & $B2+(B \\ \hline
1147: 0xff0000 & $B@V(B \\ \hline
1148: 0x00ff00 & $BNP(B \\ \hline
1149: 0x0000ff & $B@D(B \\ \hline
1150: 0x000000 & $B9u(B \\ \hline
1151: \end{tabular}
1152:
1153: \noindent
1154: ($B$"$H$O;n$7$F2<$5$$(B)
1.1 takayama 1155:
1156: $B$5$F(B, $B?^(B \ref{figure:cond:coord} $B$G8+$?$h$&$K%3%s%T%e!<%?%W%m%0%i%`$N(B
1157: $B@$3&$G$O(B, $B2hLL$N:8>e$r86E@$K$7$F(B, $B2<$X$$$/$K=>$$(B, $y$ $B:BI8$,A}$($k$h$&$J(B
1158: $B:BI87O$r$H$k$3$H$,B?$$(B.
1159: $B?t3X$N%0%i%U$r=q$$$?$j$9$k$K$O$3$l$G$OITJX$J$3$H$bB?$$$N$G(B,
1160: {\tt glib3.rr} $B$G$O(B,
1161: \begin{center}
1162: \verb@ Glib_math_coordinate=1; @
1163: \end{center}
1164: $B$r<B9T$7$F$*$/$H(B
1165: $B2hLL$N:82<$,86E@$G(B, $B>e$K$$$/$K=>$$(B $y$ $B:BI8$,A}$($k$h$&$J(B
1166: $B?t3X$G$N:BI87O$G?^$rIA2h$9$k(B.
1167:
1168: \begin{example} \rm \index{$B$0$i$U(B@$B%0%i%U(B}
1169: 2$B<!4X?t(B $y=x^2-1$ $B$N%0%i%U$r=q$$$F$_$h$&(B.
1170: %%Prog: cfep/tests/2006-03-11-graph2d.rr
1171: \begin{screen}
1172: \begin{verbatim}
1173: import("glib3.rr");
1174: Glib_math_coordinate=1;
1175: glib_window(-2,-2, 2,2);
1176:
1177: glib_line(-2,0,2,0 | color=0x0000ff);
1178: glib_line(0,-2,0,2 | color=0x0000ff);
1179: for (X=-2.0; X< 2.0; X = X+0.1) {
1180: Y = X^2-1;
1181: X1 = X+0.1;
1182: Y1 = X1^2-1;
1183: glib_line(X,Y, X1,Y1);
1184: }
1185: glib_flush();
1186: \end{verbatim}
1187: \end{screen}
1188: $B<B9T7k2L$O?^(B\ref{fig:graph2d}.
1189: -----$B%W%m%0%i%`$N2r@b$O$^$@=q$$$F$J$$(B.
1190: \end{example}
1191:
1192: %<C
1193: \begin{figure}[tb]
1194: \scalebox{0.6}{\includegraphics{Figs/graph2d.eps}}
1195: \caption{2$B<!4X?t$N%0%i%U(B} \label{fig:graph2d}
1196: \end{figure}
1197: %>C
1198:
1199:
1200: \section{$B1_$rIA$/4X?t$r:n$C$F$_$h$&(B}
1201:
1202: %%Prog: cfep/tests/2006-03-11-circle.rr
1203: \begin{screen}
1204: \begin{verbatim}
1205: import("glib3.rr");
1206: Glib_math_coordinate=1;
1207: glib_window(-1,-1,1,1);
1208: glib_clear();
1209: E = 0.2; X = 0; Y = 0; R = 0.5;
1210: for (T=0; T<=deval(2*@pi); T = T+E) {
1211: Px = X+deval(R*cos(T));
1212: Py = Y+deval(R*sin(T));
1213: Qx = X+deval(R*cos(T+E));
1214: Qy = Y+deval(R*sin(T+E));
1215: glib_line(Px,Py,Qx,Qy);
1216: glib_flush();
1217: }
1218: \end{verbatim}
1219: \end{screen}
1220: -----$B%W%m%0%i%`$N2r@b$O$^$@=q$$$F$J$$(B.
1221:
1.5 takayama 1222: $B>e$N%W%m%0%i%`$G$O(B $\cos$, $\sin$ $B$rMQ$$$F1_$rIA$$$F$$$k(B.
1.1 takayama 1223: $BCf?4(B, $BH>7B$rJQ99$7$?$j(B, $B?'$rJQ99$7$?$j$7$J$,$i$?$/$5$s$N1_$rIA$/$K$O(B,
1224: $B$I$N$h$&$K$9$l$P$h$$$G$"$m$&$+(B?
1225: ``$B4X?t(B'' $B$rMQ$$$k$H$=$l$,MF0W$K$G$-$k(B.
1226:
1227: $B$"$k$R$H$^$H$^$j$N%W%m%0%i%`$O4X?t(B (function) $B$H$7$F(B
1228: $B$^$H$a$F$*$/$H$h$$(B. \index{$B$+$s$9$&(B@$B4X?t(B}
1229: $B7W;;5!8@8l$K$*$1$k4X?t$O?t3X$G$$$&4X?t$H;w$FHs$J$k$b$N$G$"$k(B.
1230: $B4X?t$r<jB3$-(B (procedure) $B$H$+(B $B%5%V%k!<%A%s(B (subroutine) $B$H$+(B
1231: $B$h$V8@8l$b$"$k(B.
1232: $B4X?t$rMQ$$$k:GBg$NMxE@$O(B, $B4X?t$r0lC6=q$$$F$7$^$($P(B,
1233: $BCf?H$r%V%i%C%/%\%C%/%9$H$7$F07$($k$3$H$G$"$k(B.
1234: $BBg5,LO$J%W%m%0%i%`$r=q$/$H$-$OJ#;($J=hM}$r$$$/$D$+$N4X?t$KJ,3d$7$F(B
1235: $B$^$:3F4X?t$r==J,%F%9%H$7;E>e$2$k(B.
1236: $B$=$l$+$i$=$l$i$N4X?t$rAH$_9g$o$;$F$$$/$3$H$K$h$j(B,
1237: $BJ#;($J5!G=$r<B8=$9$k(B.
1238: $B$3$N$h$&$J%"%W%m!<%A$r$H$k$3$H$K$h$j(B, ``$B:$Fq$,J,3d(B'' $B$5$l$k(B.
1239:
1240: %<C
1241: \begin{figure}[tbh]
1242: \scalebox{0.6}{\includegraphics{Figs/circleFunc.eps}}
1243: \caption{ $B4X?t$K$h$kF1?41_$NIA2h(B} \label{fig:circleFunc}
1244: \end{figure}
1245: %>C
1246:
1247: $B$5$F1_$rIA$/Nc$K$b$I$m$&(B.
1248: $B0J2<$N$h$&$K4X?t(B {\tt circle(X,Y,R,Color)}$B$rDj5A(B ({\tt def}) $B$9$k(B.
1249: $B$3$N4X?t$r(B $R$ $B$d(B $Color$ $B$rJQ2=$5$;$J$,$i8F$V$3$H$K$h$j(B,
1250: $B?^(B\ref{fig:circleFunc} $B$N$h$&$JF1?41_$N?^$rIA$/$3$H$,2DG=$H$J$k(B.
1251: $B4X?t$K$D$$$F>\$7$/$O(B ``asir $B%I%j%k(B'' $B$r;2>H$7$F$[$7$$(B.
1252:
1253: \begin{screen}
1254: \begin{verbatim}
1255: import("glib3.rr");
1256:
1257: def circle(X,Y,R,Color) {
1258: E = 0.2;
1259: for (T=0; T<deval(2*@pi); T = T+E) {
1260: Px = X+deval(R*cos(T));
1261: Py = Y+deval(R*sin(T));
1262: Qx = X+deval(R*cos(T+E));
1263: Qy = Y+deval(R*sin(T+E));
1264: glib_line(Px,Py,Qx,Qy | color=Color);
1265: }
1266: glib_flush();
1267: }
1268:
1269: Glib_math_coordinate=1;
1270: glib_window(-1,-1,1,1);
1271: glib_clear();
1272: CC = 0xff0000;
1273: for (P = 0.4; P<0.5; P = P+0.01) {
1274: circle(0,0,P,CC);
1275: CC = random()%0x1000000;
1276: }
1277: \end{verbatim}
1278: \end{screen}
1279: -----$B%W%m%0%i%`$N>\$7$$2r@b$^$@(B.
1280:
1281: \begin{problem} \rm
1282: \begin{enumerate}
1283: \item $BJ,EY4o$rIA$/%W%m%0%i%`$r:n$l(B.
1284: \item ($BH/E82]Bj(B) $B$3$NJ,EY4o(B, $B;e(B, $B$*$b$j(B, $B$o$j$P$7(B, $BHD(B, cfep/asir $B$K$h$k%W%m%0%i%`Ey$rMQ$$$F(B,
1285: $BLZ$d%S%k$N9b$5$rB,Dj$9$k5!3#$H%=%U%H%&%(%"%7%9%F%`$r3+H/$;$h(B.
1286: \end{enumerate}
1287: \end{problem}
1288:
1289: \begin{problem} \rm
1290: ($B$3$l$OH/E82]Bj(B) \index{OpenGL} \index{3$B$8$2$s$0$i$U$#$C$/$9(B@3$B<!85%0%i%U%#%C%/%9(B}
1291: cfep $B$K$O(B OpenGL $B%$%s%?%W%j%?!<$,AH$_9~$s$G$"$k(B.
1292: OpenGL $B$O(B3$B<!85%0%i%U%#%C%/%9$rMQ$$$k%=%U%H%&%(%":n@.$N$?$a$K(B
1293: $BMQ$$$i$l$kLs(B 150$B<oN`$N%3%^%s%I$+$i9=@.$5$l$F$$$k%Q%C%1!<%8$G(B
1294: 3$B<!85%0%i%U%#%C%/%9$NI8=`5,3J$N$R$H$D$G$b$"$k(B.
1295: cfep 1.1$B$G$O$=$NCf$N(B 10 $B<e$N%3%^%s%I$rMxMQ$G$-$k(B.
1296:
1297: $B$3$N(B OpenGL $B%$%s%?%W%j%?!<$rMQ$$(B,
1298: $BB?LLBN(B(polygon)$B$r:`NA$K$7(B,
1299: cfep$B>e5iJT(B, OpenGL $B$N%W%m%0%i%`$r;29M$K(B
1300: ``$B2H(B'' $B$r=q$$$F$_$h$&(B.
1301: \end{problem}
1302:
1303:
1304:
1305: \chapter{For $BJ8$K$h$k?tNs$N7W;;(B}
1306:
1307: \section{$BD6F~Lg(B, $BBh(B2$B$N4XLg(B: $BA22=<0$G$-$^$k?tNs$N7W;;(B}
1308:
1309: \begin{example} \rm
1310: $a$ $B$r@5$N?t$H$9$k$H$-(B,
1311: \begin{eqnarray*}
1312: x_{n+1} &=& \frac{x_n + \frac{a}{x_n}}{2}, \\
1313: x_0 &=& a
1314: \end{eqnarray*}
1315: $B$G$-$^$k?tNs(B $x_0, x_1, x_2, \ldots $
1316: $B$O(B $\sqrt{a}$ $B$K$I$s$I$s6aIU$/$3$H(B($B<}B+$9$k$3$H(B)$B$,CN$i$l$F$$$k(B.
1.5 takayama 1317: $a=2$ $B$N;~(B, $x_1, x_2, \ldots, x_4, x_5$ $B$r7W;;$9$k%W%m%0%i%`$r=q$$$F$_$h$&(B.
1.1 takayama 1318: %%Prog: cfep/tests/2006-03-11-sqrt.rr
1319: \begin{screen}
1320: \begin{verbatim}
1321: A = 2.0;
1322: X = A;
1323: for (I=0; I<5; I++) {
1324: Y = (X+A/X)/2;
1325: print(Y);
1326: X = Y;
1327: }
1328: \end{verbatim}
1329: \end{screen}
1330: \end{example}
1331:
1332: $B$3$N%W%m%0%i%`$N<B9T7k2L$O?^(B\ref{fig:sqrt}.
1333: %<C
1334: \begin{figure}[tbh]
1335: \scalebox{0.5}{\includegraphics{Figs/sqrt.eps}}
1336: \caption{$\sqrt{2}$ $B$K<}B+$9$k?tNs(B} \label{fig:sqrt}
1337: \end{figure}
1338: %>C
1339:
1340: $BD6F~Lg$G$N4XLg$O(B
1341: \begin{screen}
1342: \begin{verbatim}
1343: Y = (X+A/X)/2;
1344: X = Y;
1345: \end{verbatim}
1346: $B$N0UL#$r40A4$KM}2r$9$k$3$H(B
1347: \end{screen}
1348: $B$G$"$k(B.
1349: $BJQ?t$N>O$G@bL@$7$?$h$&$K(B,
1350: $$ \mbox{{\bf $BJQ?tL>(B}} {\tt = } \mbox{{\bf $B<0(B}} {\tt ;} $$
1351: $B$O$^$:1&JU$N<0$r7W;;$7$=$N$"$H$=$N7W;;7k2L$r:8JU$NJQ?t$KBeF~$;$h$H$$$&0UL#(B
1352: $B$G$"$k(B. $B$7$?$,$C$F(B,
1353: \verb@ Y = (X+A/X)/2; @ $B$O8=:_$N(B {\tt X} $B$H(B {\tt A} $B$K3JG<$5$l$?(B
1354: $B?t;z$r$b$H$K(B \verb@ (X+A/X)/2 @ $B$NCM$r7W;;$7(B, $B$=$N7k2L$rJQ?t(B {\tt Y} $B$XBeF~$;$h(B,
1355: $B$H$$$&0UL#$G$"$k(B. $B$^$?(B
1356: \begin{screen}
1357: \verb@X=Y@ $B$O(B \verb@X@ $B$,(B \verb@Y@ $B$KEy$7$$$H$$$&0UL#$G$O$J$/(B,
1358: $BJQ?t(B\verb@Y@ $B$K3JG<$5$l$??t;z$r(B $BJQ?t(B \verb@X@ $B$KBeF~$;$h$H$$$&0UL#$G$"$k(B.
1359: \end{screen}
1360: $B$3$N$h$&$K9M$($l$P(B, $B>e$N%W%m%0%i%`$,(B $x_1, x_2, x_3, x_4$ $B$NCM$r(B
1361: $B=gHV$K7W;;$7$F(B print $B$7$F$$$kM}M3$,M}2r$G$-$k$G$"$m$&(B.
1362: $B<+J,$,7W;;5!$K$J$C$?$D$b$j$G(B,
1363: $BJQ?t$NCf$N?tCM$,$I$N$h$&$KJQ2=$7$F$$$/$N$+(B,
1364: $B=q$-$J$,$iM}2r$7$FD:$-$?$$(B.
1365: $B$3$l$,$O$C$-$jM}2r$G$-(B, $B1~MQLdBj$,<+M3$K2r$1$k$h$&$K$J$C$?(B, $BD6F~LgB46H$G$"$k(B.
1366: \index{$B$@$$$K$e$&(B@$BBeF~(B}
1367:
1.5 takayama 1368: \begin{problem} \rm
1369: $BJQ?t(B {\tt I}, {\tt X}, {\tt Y} $B$NCM$O(B {\tt for} $B%k!<%WFb$G$I$N$h$&$K(B
1370: $BJQ2=$9$k$+(B?
1371: {\tt Y= (X+A/X)/2} $B$N9T$,<B9T$5$l$kA0$N$3$l$i$NJQ?t$NCM$rI=$K$7$F(B
1372: $B$^$H$a$h(B. {\tt print([I,X,Y])} $B$r$O$5$`$3$H$K$h$j$3$NI=$,@5$7$$$3$H$r(B
1373: $B$?$7$+$a$h(B.
1374: \end{problem}
1375:
1376: \begin{problem} \rm
1377: $B%W%m%0%i%`$N%P%0(B(bug)$B$H$O$J$K$+(B?
1378: \end{problem}
1379:
1.1 takayama 1380: \section{$B1_$rIA$/?tNs(B}
1381:
1382: $B?tNs$N7W;;$rMQ$$$k$H(B, $\cos$ $B$d(B $\sin$ $B$N7W;;$r$d$i$:$K1_$rIA$/$3$H$,(B
1383: $B$G$-$k(B.
1384: %%Prog: cfep/tests/2006-03-11-circle-dda.rr
1385: \begin{screen}
1386: \begin{verbatim}
1387: import("glib3.rr");
1388: Glib_math_coordinate=1;
1389: glib_window(-2,-2, 2,2);
1390: glib_clear();
1391: E = 0.1;
1392: C1 = 1.0; C2=1.0;
1393: S1 = 0.0; S2=E;
1394: for (T=0; T<=deval(2*@pi); T = T+E) {
1395: C3 = 2*C2-C1-E*E*C2;
1396: S3 = 2*S2-S1-E*E*S2;
1397: glib_line(C1,S1, C2,S2);
1398: C1=C2; S1=S2;
1399: C2=C3; S2=S3;
1400: glib_flush();
1401: }
1402: \end{verbatim}
1403: \end{screen}
1404:
1405: $B$3$N%W%m%0%i%`$N<B9T7k2L$O?^(B\ref{fig:circleDda}.
1406: %<C
1407: \begin{figure}[tbh]
1408: \scalebox{0.6}{\includegraphics{Figs/circleDda.eps}}
1409: \caption{$\cos$, $\sin$ $B$r;H$o$:$K1_$rIA$/(B} \label{fig:circleDda}
1410: \end{figure}
1411: %>C
1412:
1413: -----$B%W%m%0%i%`$N2r@b$^$@=q$$$F$J$$(B.
1414:
1.5 takayama 1415: $B%R%s%H(B:
1416: $BHyJ,J}Dx<0(B $d^2 x/dt^2 = -x, d^2 y/dt^2 = -y$ $B$r(B $t$ $B$r%i%8%"%s$H$7$F(B
1417: $B:9J,K!$G6a;wE*$K2r$$$F$$$k(B.
1418:
1.1 takayama 1419: $B$3$NOCBj$O(B, $B?tNs$N7W;;$H:9J,J}Dx<0$K$h$k%7%_%e%l!<%7%g%s$KB3$/(B.
1420: $B$3$l$K$D$$$F$O$^$?9F$r$"$i$?$a$F=q$$$F$_$?$$(B.
1421:
1422: $B0J>e$GD6F~Lg$O=*N;$G$"$k(B. $BB3$-$O(B ``Asir $B%I%j%k(B'' $B$rFI$s$G$M(B.
1.5 takayama 1423: $BFC$KG[Ns$H4X?t$r%^%9%?!<$9$k$H?t3X%W%m%0%i%`$K$O=EJu$9$k(B.
1424:
1.6 ! takayama 1425: $B$J$*(B, asir $B%I%j%k$K>R2p$7$F$"$k%W%m%0%i%`$O(B \verb@ end$ @ %$
! 1426: $B$^$?$O(B \verb@ end; @ $B$,:G8e$K=q$$$F$"$k>l9g$,B?$$$,(B,
! 1427: cfep/asir $B$G$O$3$N(B {\tt end} $B$r=q$$$F$O$$$1$J$$(B.
! 1428: {\tt end } $B$O7W;;%(%s%8%s$NDd;_L?Na$G$"$j(B, $B<B9T$5$l$k$H(B ``$B7W;;Cf$NI=<((B'' $B$,$G$FL51~Ez$H$J$k(B.
! 1429: ($B0l1~(B, $B9TF,$K$"$k$3$l$i$NL?Na$O<+F0E*$K:o=|$9$k$h$&$K$J$C$F$O$$$k(B.)
! 1430: %% kxx/ox_texmacs.c
! 1431:
1.5 takayama 1432: \begin{problem} \rm
1433: ($B%l%]!<%HLdBj$NNc(B) \\
1434: $B$J$K$+?^$rIA$/%W%m%0%i%`$r=q$-$J$5$$(B. ($BDjHV%I%i%(%b%s$G$b$h$$(B)
1435: \end{problem}
1.1 takayama 1436:
1437: \chapter{cfep $B>e5iJT(B}
1438:
1439: \section{\TeX $B$K$h$k%?%$%W%;%C%H(B($B<B83E*(B)}
1440: %%Doc: cfep/tests/2006-03-06
1441: $B=PNO$r(BTeX$B$G%?%$%W%;%C%H$9$k$K$O(B
1442: ``$B<B9T(B'' $B%a%K%e!<$+$i(B ``$B=PNO$r(BTeX$B$G%?%$%W%;%C%H(B'' $B$rA*Br$9$k(B.
1.3 takayama 1443: {\tt latex}, {\tt dvipng} $B$,%$%s%9%H!<%k$5$l$F$$(B
1.1 takayama 1444: $B$J$$$HF0:n$7$J$$(B.
1.3 takayama 1445: $B$3$l$i$O$?$H$($P(B {\tt fink} $B$+$i(B \TeX $B$r%$%s%9%H!<%k$7$?$j(B,
1446: {\tt ptex\_package\_2005v2.1.dmg} $B$J$I$G(B Mac $BMQ$N(B pTeX $B$r%$%s%9%H!<%k$7$F$*$1$P$h$$(B.
1.1 takayama 1447: \TeX $B$rMQ$$$?;E>e$jNc$O?^(B\ref{fig:sl2}$B$r8+$h(B.
1448: $B$J$*(B, \TeX $B$G%?%$%W%;%C%H$9$k>l9g%[!<%`$N2<$K(B
1449: \verb@OpenXM_tmp@ $B$J$k:n6HMQ$N%U%)%k%@$,:n@.$5$l$k(B.
1450: $B%?%$%W%;%C%H$O<B835!G=$N$?$a(B, $B$3$N%U%)%k%@$NCf$N:n6HMQ%U%!%$%k$O<+F0$G$O>C5n$5$l$J$$(B.
1451: $B;~!9<jF0$G:n6H%U%!%$%k$r>C5n$5$l$?$$(B.
1452: \index{tex@\TeX}
1453:
1454: \section{$BA*BrHO0O$N$_$N<B9T(B}
1455:
1456: \index{$B$;$s$?$/$O$s$$$N$_$N$8$C$3$&(B@$BA*BrHO0O$N$_$N<B9T(B}
1457: $B2hLL>e$N(B ``$BA*BrHO0O$N$_$r<B9T(B'' $B$r%A%'%C%/$9$k$H(B,
1458: ``$B;O$a(B'' $B%\%?%s$r$*$7$?$H$-(B, $BA*BrHO0O$N$_$,I>2A$5$l$k(B.
1459: $BA*BrHO0O$,$J$$>l9g$O%-%c%l%C%H0LCV$N9T$,<+F0A*Br$5$l$F<B9T$5$l$k(B.
1460: \command{{\tt Enter}} $B$HAH$_9g$o$;$F$3$N5!G=$r;H$&$H(B, $B%?!<%_%J%k$+$i(B
1461: asir $B$rMxMQ$9$k$N$K$A$g$C$H;w$F$/$k(B.
1462: $B?^(B\ref{fig:sl2}$B$O$3$N$h$&$J<B9T$r$7$F$$$kNc$G$"$k(B.
1463:
1464: %<C
1465: \begin{figure}[tbh]
1466: \scalebox{0.5}{\includegraphics{Figs/sl2.eps}}
1467: \caption{$B%?!<%_%J%kIw(B} \label{fig:sl2}
1468: \end{figure}
1469: %>C
1470:
1471:
1472: \noindent
1473: %%Doc: cfep/tests/2007-03-07-debug.rtfd
1474: \fbox{$B<ALd(B}
1475: cfep $B$N%$%s%?%U%'!<%9$G%G%P%C%0$r$7$J$,$i%W%m%0%i%`$r3+H/$9$k$K$O$I$N$h$&$K$d$k$H(B
1476: $B$h$$$+(B? \\
1477: \fbox{$BEz$((B}
1478: cfep $B$O=i?4<T8~$-$N%$%s%?%U%'!<%9$J$N$G(B,
1479: $BBg5,LO$J%W%m%0%i%`3+H/$rA[Dj$7$F$$$J$$$,(B,
1480: $B;d$O<!$N$h$&$K%i%$%V%i%j$N3+H/$r$7$F$$$k(B.
1481:
1482: \begin{enumerate}
1483: \item $BI,MW$J4X?t$r=q$/(B. $B2<$NNc$G$O(B {\tt sum1}.
1484: \item $B4X?t$r%F%9%H$9$kF~NO$r%3%a%s%H$N7A$G$=$N4X?t$N6a$/$K=q$$$F$*$/(B.
1485: $B2<$NNc$G$O%3%a%s%H$K$"$k(B {\tt sum1(10,1); } $BEy(B.
1486: \end{enumerate}
1487:
1488:
1489: \begin{screen}
1490: \begin{verbatim}
1491: /*
1492: testinput: sum1(10,1);
1493: testinput: sum1(10,2);
1494: */
1495: def sum1(N,M) {
1496: S = 0; i=1;
1497: for (I=1; I<N; I++) {S = S+I^M; }
1498: return S;
1499: }
1500: \end{verbatim}
1501: \end{screen}
1502:
1503: \begin{enumerate}
1504: \item ``$B;O$a(B'' $B%\%?%s$G4X?tDj5A$r%m!<%I(B.
1505: $B$3$N;~E@$GJ8K!%(%i!<$J$I$,$"$l$P%a%C%;!<%8$K$7$?$,$C$F=$@5(B.
1506: \item $B$=$N$"$H(B ``$BA*BrHO0O$N$_$r<B9T(B'' $B$N%b!<%I$KJQ99$7$F%3%a%s%HFb$N(B testinput $B$r<B9T(B.
1507: \item $B<B9T;~$N%(%i!<$N9THV9f$X$N0\F0$O(B "$BA*BrHO0O$N$_$r<B9T(B" $B$N%b!<%I$r2r=|$7$F$+$i(B
1508: $B9T$&(B. \index{$B$($i!<(B@$B%(%i!<(B}
1509: \end{enumerate}
1510:
1511: %<C
1512: \begin{figure}[tb]
1513: \scalebox{0.5}{\includegraphics{Figs/howtoDebug1.eps}}
1514: \caption{``$BA*BrHO0O$N$_$r<B9T(B''$B$N3hMQ(B} \label{fig:howtoDebug1}
1515: \end{figure}
1516: %>C
1517:
1518:
1519: \section{$B%(%s%8%s$r5/F0$7$J$$(B}
1520: %%cfep/tests/2006-03-08-noEngine
1521:
1522: \noindent
1523: \fbox{$B<ALd(B}
1524: $B%F%-%9%HJT=8$^$?$O%F%-%9%H$N1\Mw$@$1$G7W;;$r$9$k$D$b$j$O$"$j$^$;$s$,(B. \\
1525: \fbox{$BEz$((B}
1526: ``$B<B9T(B'' $B%a%K%e!<$G(B ``$B%(%s%8%s$r<+F05/F0$7$J$$(B'' $B$rA*Br(B. \\
1527: %<C
1528: \scalebox{0.3}{\includegraphics{Figs/menuNoEngine.eps}} \\
1529: %>C
1530: $B$"$H$G%(%s%8%s$r5/F0$7$?$$>l9g$O(B ``$B:F5/(B'' $B%\%?%s$r$*$7$F%(%s%8%s$r5/F0$9$k(B. \\
1531: %<C
1532: \scalebox{0.3}{\includegraphics{Figs/popupRestart.eps}}
1533: %>C
1534:
1535:
1536: \section{OpenGL$B%$%s%?%W%j%?(B}
1537:
1538: \index{OpenGL}
1539: Cfep $B$K$O(B OpenGL $B%$%s%?%W%j%?!<$,AH$_9~$s$G$"$k(B.
1540: OpenGL $B$O(B3$B<!85%0%i%U%#%C%/%9$rMQ$$$k%=%U%H%&%(%":n@.$N$?$a$K(B
1541: $BMQ$$$i$l$kLs(B 150$B<oN`$N%3%^%s%I$+$i9=@.$5$l$F$$$k%Q%C%1!<%8$G(B
1542: 3$B<!85%0%i%U%#%C%/%9$NI8=`5,3J$N$R$H$D$G$b$"$k(B.
1543: cfep 1.1$B$G$O$=$NCf$N(B 10 $B<e$N%3%^%s%I$rMxMQ$G$-$k(B.
1544: $B>\$7$/$O(B
1545: {\tt cfep.app/OpenXM/lib/asir-contrib/cfep-opengl.rr} $B$r;2>H(B.
1546:
1547: \index{OpenGL$B$0$i$U$#$C$/$*$V$8$'$/$H(B@OpenGL$B%0%i%U%#%C%/%*%V%8%'%/%H(B}
1548: OpenGL $B$G$O$^$:(B OpenGL$B%0%i%U%#%C%/%*%V%8%'%/%H$rG[CV$7(B,
1549: $B$=$l$+$i;kE@$N0LCV$+$i8+$?2hA|$rIA2h$9$kJ}K!$rMQ$$$k(B.
1550: $B$7$?$,$C$F(B, $B%7%9%F%`$O>o$K(B OpenGL$B%0%i%U%#%C%/%*%V%8%'%/%H$N=89g$rJ];}(B
1551: $B$7$F$$$k(B.
1552: {\tt glib\_remove\_last()} $BL?Na$O$=$N:G8e$NMWAG$r:o=|$9$kL?Na$G$"$k(B.
1553: {\tt cfep-opengl.rr} $B%i%$%V%i%j$G$O(B,
1554: {\tt opengl.metaRemoveLast()} $B4X?t$G:G8e$NMWAG$r:o=|$G$-$k(B.
1555: \index{opengl}
1556:
1557: %<C
1558: \begin{figure}[tb]
1559: \scalebox{0.6}{\includegraphics{Figs/twoPolygon.eps}}
1560: \caption{} \label{fig:twoPolygon}
1561: \end{figure}
1562: %>C
1563:
1564: \begin{screen}
1565: \begin{verbatim}
1566: import("cfep-opengl.rr");
1567: opengl.metaRemoveAll();
1568: opengl.init();
1569: opengl.glib3DefaultScene(0);
1570: opengl.redraw();
1571: opengl.glColor4f(0.0,0.0,1.0,0.3);
1572: opengl.glBegin(GL_POLYGON); Y=0.1;
1573: opengl.glVertex3f(-1.0, Y, 0.5);
1574: opengl.glVertex3f(-1.0, Y, -0.5);
1575: opengl.glVertex3f(1.0, Y, -0.5);
1576: opengl.glVertex3f(1.0, Y, 0.5);
1577: opengl.glEnd();
1578:
1579: opengl.glColor4f(1.0,0.0,0.0,0.5);
1580: opengl.glBegin(GL_POLYGON);
1581: opengl.glVertex3f(0.0, 0.5, 0.0);
1582: opengl.glVertex3f(0.0, 0.5, -0.4);
1583: opengl.glVertex3f(0.5, -0.2, -0.4);
1584: opengl.glVertex3f(0.5, -0.2, 0.0);
1585: opengl.glEnd();
1586: opengl.glFlush() ;
1587: opengl.metaShowListOfOpenGLCommands();
1588: \end{verbatim}
1589: \end{screen}
1590: $B$3$N%W%m%0%i%`$G$O(B 2 $BKg$ND9J}7A$rIA$$$F$$$k(B.
1591: $B$3$N%W%m%0%i%`$N=PNO$O?^(B\ref{fig:twoPolygon}.
1592: -----$B>\$7$$@bL@$O$^$@(B.
1593:
1594: OpenGL $B$N2hLL$K$OIaDL$N?t3X$N$h$&$K(B $(x,y)$ $B:BI8$,$O$$$C$F$*$j(B,
1595: $B2hLL$+$i<jA0B&$,(B $z$ $B:BI8$,@5$NJ}8~(B, $B2hLL$N8~$3$&B&$,(B
1596: $z$ $B:BI8$,Ii$NJ}8~$G$"$k(B.
1597: ``$BL\(B'' $B$+$i86E@J}8~$r8+$?2hA|$,(B
1598: $B?^(B\ref{fig:twoPolygon}$B$K$"$k$h$&$K(B 3 $B$D$N%9%i%$%@!<$rMQ$$$FL\$N0LCV$rF0$+$;$k$N$G(B,
1599: OpenGL$B%*%V%8%'%/%H$r$$$m$$$m$J3QEY$+$i$_$k$3$H$,2DG=$G$"$k(B.
1600: $B2<$N%9%i%$%@!<$,L\$N(B $x$ $B:BI8(B, $B1&$NFs$D$N%9%i%$%@!<$,$=$l$>$lL\$N(B $y$, $z$ $B:BI8$G$"$k(B.
1601: $BL\$NF0$-$K47$l$k$K$O(B, $B<!$NFs$D$N%G%b2hLL$r$?$a$9$HLLGr$$$@$m$&(B.
1602: \begin{screen}
1603: \begin{verbatim}
1604: import("cfep-opengl.rr");
1605: opengl.glib3DefaultScene("mesa demo/ray");
1606: \end{verbatim}
1607: \end{screen}
1608:
1609: \begin{screen}
1610: \begin{verbatim}
1611: import("cfep-opengl.rr");
1.3 takayama 1612: opengl.glib3DefaultScene("cfep demo/icosahedron");
1.1 takayama 1613: \end{verbatim}
1614: \end{screen}
1615:
1.4 takayama 1616: \section{asir $B0J30$N7W;;%(%s%8%s$NMxMQ(B}
1617:
1618: cfep$B$+$i(B asir $B0J30$N(B OpenXM $B=`5r$N7W;;%(%s%8%s$bMxMQ$G$-$^$9(B.
1619: $B$?$H$($P(B, $B<B9T(B, $B7W;;%(%s%8%s$NA*Br$G(B, kan/sm1 $B$rMxMQ$9$k$3$H$b2DG=$G$9(B.
1620: cfep, {\tt ox\_texmacs}, {\tt ox\_sm1} $B$,Aj8_$KDL?.$7$J$,$i7W;;$7$F$$$^$9(B.
1621:
1622: $B$J$*(B kan/sm1 $B$N(B {\tt run} $B%3%^%s%I$O;H$($^$;$s(B.
1623: \begin{verbatim}
1624: [(parse) ($B%U%!%$%kL>(B) pushfile] extension
1625: \end{verbatim}
1626: $B$GBeMQ$7$F2<$5$$(B.
1627:
1.1 takayama 1628: \cleardoublepage
1629: \flushbottom
1630: \printindex
1631:
1632: \end{document}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>