Annotation of OpenXM/src/cfep/Doc/Intro/next2.tex, Revision 1.3
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.3 ! takayama 21: \date{ 2006$BG/(B($BJ?@.(B18$BG/(B), 3$B7n(B12$BF|HG(B(cfep 1.1). 2007-10-09 $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.
491: $B$J$*$3$NNc$G$O(B
492: \begin{center}
493: \scalebox{0.05}{\includegraphics{Figs/buttonBracket.eps}}
494: \end{center}
495: $B%\%?%s$r$b$A$$$F$b$9$0%(%i!<$N>l=j$,$o$+$k(B.
496: \index{$B$+$C$3(B@$B3g8L(B}
497:
498: \noindent {\bf $BCm0U(B}:
499: $BI=<($5$l$?9T$O%(%i!<$NH/@80LCV$G$"$k$,(B,
500: $B%(%i!<$N860x$O$=$NA0$NJ}$N9T$K$"$k$3$H$bB?$$(B.
501: $B$?$H$($P(B
502: \begin{screen}
503: \begin{verbatim}
504: 1+2
505: 2+3;
506: \end{verbatim}
507: \end{screen}
508: $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
509: $B=q$-K:$l$?$3$H$G$"$k(B.
510:
511: \bigbreak
512: $B%(%i!<9T$,J#?tI=<($5$l$?>l9g$O$=$l$i$NCf$N$I$3$+$K%(%i!<$,$"$k(B.
513: $BJ#?t$"$k%(%i!<9T$K=gHV$K%8%c%s%W$7$F$$$/$K$O(B,
514: \fbox{$B<B9T(B} $B%a%K%e!<$+$i(B \fbox{$B<!$N%(%i!<9T$X(B} $B$rA*Br$9$k(B.
515: \begin{center}
516: \scalebox{0.3}{\includegraphics{Figs/menuNextError.eps}}
517: \end{center}
518: \index{$B$D$.$N$($i!<$.$g$&$X(B@$B<!$N%(%i!<9T$X(B}
519:
520: \begin{problem} \rm
521: $B%(%i!<$r@8$8$k<0$^$?$O%W%m%0%i%`$r(B5$B$D:n$l(B.
522: \end{problem}
523:
524:
525: \chapter{ $BJQ?t$H%W%m%0%i%`(B }
526:
527: \section{$BJQ?t(B}
528:
529: \noindent \index{$B$X$s$9$&(B@$BJQ?t(B}
530: $BJQ?t$K?tCMEy$r5-21$7$F$*$1$k(B.
531: \underline{$BJQ?tL>$OBgJ8;z$G;O$^$k(B}. \index{$B$X$s$9$&$a$$(B@$BJQ?tL>(B}
532: %$B1Q;z$NBgJ8;z(B, $B;RJ8;z$r6hJL$7$F$$$k$N$GCm0U(B.
533: $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
534: $BB?9`<0$NJQ?tL>$H$7$FMxMQ$5$l$k(B.
535: \index{$B$?$3$&$7$-$N$X$s$9$&$a$$(B@$BB?9`<0$NJQ?tL>(B}
536: %en \noindent
537: %en Symbols starting with capital alphabetical characters are
538: %en {\it program variables}, which are used to store values.
539: %en \index{program variable}
540: %en Names of functions defined in programs start with small alphabetical
541: %en characters.
542: %en Note that variable symbols starting with small alphabetical characters are
543: %en variables in polynomials in Risa/Asir and they cannot be used to store
544: %en values.
545: %en
546:
547: \index{2$B$N$k$$$8$g$&(B@$2$$B$NN_>h(B}
548: $2$$B$NN_>h$rI=<($9$k<!$N%W%m%0%i%`$r9M$($h$&(B.
549: \begin{screen}
550: \begin{verbatim}
551: print( 2^1 );
552: print( 2^2 );
553: print( 2^3 );
554: print( 2^4 );
555: print( 2^5 );
556: print( 2^6 );
557: print( 2^7 );
558: print( 2^8 );
559: \end{verbatim}
560: \end{screen}
561: $B$3$N%W%m%0%i%`$OJQ?t(B {\tt X} $B$rMQ$$$F(B
562: $B<!$N$h$&$K=q$$$F$*$1$P(B $2$ $B$NN_>h$@$1$J$/(B $3$ $B$NN_>h$rI=<($9$k(B
563: $B$N$K:FMxMQ$G$-$k(B($B?^(B\ref{fig:powerOf2}).
564: \begin{screen}
565: \begin{verbatim}
566: X = 2;
567: print( X^1 );
568: print( X^2 );
569: print( X^3 );
570: print( X^4 );
571: print( X^5 );
572: print( X^6 );
573: print( X^7 );
574: print( X^8 );
575: \end{verbatim}
576: \end{screen}
577: \begin{figure}[thb]
578: \begin{center}
579: \scalebox{0.3}{\includegraphics{Figs/powerOf2.eps}}
580: \end{center}
581: \caption{$BJQ?t$NMxMQ(B} \label{fig:powerOf2}
582: \end{figure}
583: $3$ $B$NN_>h$rI=<($9$k$K$O(B
584: \verb@X=2@ $B$N9T$r(B \verb@X=3@ $B$KJQ99$9$l$P$$$$$@$1$G$"$k(B.
585:
586: $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
587: $BJQ?t$G$"$k(B.
588: $B$D$^$j(B, {\tt X}, {\tt Y}, {\tt Z} $B$O$b$A$m$s$N$3$H(B,
589: {\tt Sum} $B$H$+(B {\tt Kazu} $B$H$+(B {\tt X1} $B$J$I(B2$BJ8;z0J>e$N1Q?t;z$NNs(B
590: $B$NAH$_9g$o$;$,JQ?tL>$H$7$F5v$5$l$k(B.
591:
592:
593: $BJQ?t$r4^$s$@<0$r%W%m%0%i%`Cf$G<+M3$K$D$+$&$3$H$b$G$-$k(B.
594: $B$?$H$($P(B
595: \begin{verbatim}
596: X = 2;
597: A = 1;
598: print( 2*X^2 -A );
599: \end{verbatim}
600: $B$r<B9T$9$k$H(B {\tt 7} $B$,I=<($5$l$k(B.
601:
602: $B$3$N$h$&$JNc$r$_$k$H(B, $BJQ?t$N5!G=$O(B
603: $BCf3X?t3X$G$J$i$&J8;z<0$H;w$F$$$k$H;W$&$@$m$&(B.
604: $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,
605: $B<!$N$3$H$r6/$/5-21$7$F$*$3$&(B.
606: \begin{screen}
607: $BJQ?t$H$O7W;;5!$K?tCMEy$rJ]B8$7$F$*$/%a%b%j>e$N>l=j$NL>A0$G$"$k(B.
608: \end{screen}
609:
610: $B$5$F(B, $BD6F~Lg(B, $BBh0l$N4XLg$G$"$k(B.
611: \begin{screen}
612: {\tt =} $B5-9f$O<!$N$h$&$J7A<0$G$D$+$&(B:
613: $$ \mbox{{\bf $BJQ?tL>(B}} {\tt = } \mbox{{\bf $B<0(B}} {\tt ;} $$
614: $B$3$l$O$^$:1&JU$N<0$r7W;;$7$=$N$"$H$=$N7W;;7k2L$r:8JU$NJQ?t$KBeF~$;$h$H$$$&0UL#(B.
615: \verb@=@ $B5-9f$O1&JU$r7W;;$7$F$=$N7k2L$r:8JU$XBeF~$;$h$H$$$&(B\underline{$BL?Na(B}
616: $B$@$H;W$C$FM_$7$$(B. \\
617: $B$?$H$($P(B,
618: \verb@X=1@ $B$O(B \verb@X@ $B$,(B \verb@1@ $B$KEy$7$$$H$$$&0UL#$G$O$J$/(B,
619: \verb@1@ $B$r(B $BJQ?t(B \verb@X@ $B$KBeF~$;$h$H$$$&0UL#$G$"$k(B.
620: \end{screen}
621: $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=}
622: \begin{screen}
623: \verb@=@ $B5-9f$N0UL#$,?t3X$G$N0UL#$H0c$&$h(B!
624: \end{screen}
625: $B$H$$$&$3$H$G$"$k(B.
626: $B$3$l$G:.Mp$9$kF~Lg<T$bB?$$$N$G%W%m%0%i%`8@8l$K$h$C$F$O(B
627: ``$2$ $B$rJQ?t(B {\tt X} $B$KBeF~$;$h(B'' $B$r(B
628: \verb@X:=2@
629: $B$H=q$/>l9g$b$"$k(B ($B$?$H$($P%W%m%0%i%`8@8l(B Pascal).
630:
631: $B<!$N%W%m%0%i%`$O(B $2$, $2^2$, $2^4$, $2^8$ $B$r7W;;$7$FI=<($9$k(B.
632: \begin{screen}
633: \begin{verbatim}
634: X=2;
635: print(X);
636: X = X*X;
637: print(X);
638: X = X*X;
639: print(X);
640: X = X*X;
641: print(X);
642: \end{verbatim}
643: \end{screen}
644: \begin{figure}[thb]
645: \begin{center}
646: \scalebox{0.3}{\includegraphics{Figs/powerOf2b.eps}}
647: \end{center}
648: \caption{$BJQ?t$NMxMQ(B} \label{fig:powerOf2b}
649: \end{figure}
650: $B=PNO$,?^(B\ref{fig:powerOf2b}$B$N$h$&$K$J$kM}M3$r@bL@$7$h$&(B.
651: $B$^$:(B1$B9TL\$GJQ?t(B{\tt X}$B$K(B2$B$,BeF~$5$l$k(B.
652: $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,
653: $2\times2$ $B$G7k2L$O(B $4$ $B$G$"$k(B.
654: \underline{$B$3$N7W;;$,=*$C$?8e(B}$B7k2L$N(B $4$ $B$,JQ?t(B {\tt X} $B$KBeF~$5$l$k(B.
655: 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$
656: $B$KBeF~$5$l$k(B.
657: \index{$B$X$s$9$&(B@$BJQ?t(B}
658:
659: \bigbreak
660: %
661: %
662: \noindent
663: \HHH \index{$B$?$3$&$7$-(B@$BB?9`<0(B} \index{$B$9$&$7$-$7$g$j(B@$B?t<0=hM}(B}
664: 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
665: $B?t<0=hM}%7%9%F%`$G$b$"$k(B.
666: %en Asir can do calculations for polynomials.
667: \begin{enumerate}
668: %en \begin{enumerate}
669: \item $B>.J8;z$G$O$8$^$k5-9f$OB?9`<0$NJQ?t$G$"$k(B.
670: $B?t3X$H$A$,$C$FJQ?t$NL>A0$O0lJ8;z$H$O$+$.$i$J$$(B.
671: $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.
672: $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.
673: $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}
674: %en \item Symbols starting small alphabetical character are variables of polynomials. For example, {\tt x2} is the variable of the name x2.
675: %en The expression {\tt x*2} stands for $x$ times $2$.
676: %
677: %
678: \item \index{$B$$$s$9$&$V$s$+$$(B@$B0x?tJ,2r(B} \index{fctr}
679: {\tt fctr(\poly)} $B$O(B \poly $B$rM-M}?t78?t$NHO0O$G0x?tJ,2r$9$k(B.
680: {\tt fctr} $B$O(B factor $B$NC;=LI=8=$G$"$k(B.
681: %en \item \index{factorization} \index{fctr}
682: %en The input {\tt fctr(\poly)} factors \poly in the ring of polynomials
683: %en with rational number coefficients.
684: %
685: %
686: \end{enumerate}
687: %en \end{enumerate}
688:
689: \begin{figure}[tbh]
690: \begin{center}
691: \scalebox{0.3}{\includegraphics{Figs/fctr1.eps}}
692: \end{center}
693: \caption{$B0x?tJ,2r(B} \label{fig:fctr1}
694: \end{figure}
695:
696: $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
697: $ 1^1 \times (x+y)^2 $
698: $B$H0x?tJ,2r$5$l$k$3$H$r0UL#$7$F$$$k(B.
699: $B?^(B\ref{fig:fctr1} $B$N(B{\tt fctr} $B$N=PNO$N(B2$BHVL\$O(B $x^2-1$ $B$,(B
700: $$ 1^1 \times (x-1)^1 \times (x+1)^1
701: $$
702: $B$H0x?tJ,2r$5$l$k$3$H$r0UL#$7$F$$$k(B.
703:
704:
705: \section{$B$/$j$+$($7(B}
706:
707: $B$/$j$+$($7$dH=CG$r$*$3$J$&$?$a$NJ8$,(B asir $B$K$OMQ0U$5$l$F$$$k(B.
708: $B$3$NJ8$r$b$A$$$k$HJ#;($J$3$H$r<B9T$G$-$k(B.
709: $B$^$:0lHV$N4pAC$G$"$k$/$j$+$($7$N5!G=$r$?$a$7$F$_$h$&(B.
710: \index{$B$/$j$+$($7(B} \index{for$B$V$s(B@for$BJ8(B}
711: %en A programming language is installed in Asir.
712: %en Let us try the most basic programming; repeating and printing.
713: \begin{example} \rm
714: $B?^(B\ref{fig:powerOf2}$B$N%W%m%0%i%`$O<!$N$h$&$K7+$jJV$75!G=(B --- {\tt for}$BJ8(B ---
715: $B$rMQ$$$F4J7i$K=q$1$k(B.
716: \begin{screen}
717: \begin{verbatim}
718: X = 2;
719: for (I=1; I<=8; I++) {
720: print( X^I );
721: }
722: \end{verbatim}
723: \end{screen}
724: $B<B9T7k2L$O?^(B\ref{fig:powerOf2For}$B$r$_$h(B.
725: \end{example}
726:
727: \begin{figure}[tbh]
728: \begin{center}
729: \scalebox{0.3}{\includegraphics{Figs/powerOf2For.eps}}
730: \end{center}
731: \caption{for$BJ8(B} \label{fig:powerOf2For}
732: \end{figure}
733:
734:
735: $B7+$jJV$74XO"$NI=8=$N0UL#$r2U>r=q$K$7$F$^$H$a$F$*$3$&(B.
736: \begin{enumerate}
737: %en \begin{enumerate}
738: \item \index{for} \index{$B$/$j$+$($7(B@$B7+$jJV$7(B} \index{\<@\verb&<=&}
739: %en \item \index{for} \index{repeat} \index{\<@\verb&<=&}
740: \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}; @
741: $B$O$"$k$3$H$r2?EY$b7+$jJV$7$?$$;~$KMQ$$$k(B.
742: for $B%k!<%W$H8F$P$l$k(B.
743: ``{\tt K<=N}'' $B$O(B, ``${\tt K} \leq {\tt N}$$B$+(B'' $B$H$$$&0UL#$G$"$k(B.
744: $B;w$?I=8=$K(B,
745: ``{\tt K>=N}''$B$,$"$k$,(B, $B$3$l$O(B ``${\tt K} \geq {\tt N}$$B$+(B'' $B$H$$$&0UL#$G$"$k(B.
746: {\tt =} $B$N$J$$(B
747: ``{\tt K<N}'' $B$O(B, ``${\tt K} < {\tt N}$$B$+(B'' $B$H$$$&0UL#$G$"$k(B.
748: \item \verb@ ++K @ $B$d(B \verb@ K++ @ $B$O(B {\tt K} $B$r(B 1 $BA}$d$;$H$$$&0UL#$G$"$k(B.
749: \verb@ K = K+1 @ $B$H=q$$$F$b$h$$(B.
750: $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.
751: %en The sentence
752: %en {\tt for (K={\it initial value}; K<={\it limit}; K++) \{{\it commands}\}; }
753: %en is used to repeat commands.
754: %en It is called the ``for'' loop.
755: %en ``{\tt K<=N}'' means that ``${\tt K} \leq {\tt N}$ holds''.
756: %en A similar expression
757: %en ``{\tt K>=N}'' implies that ``${\tt K} \geq {\tt N}$ holds''
758: %en The expression ``{\tt K<N}'' means that ``${\tt K} < {\tt N}$''.
759: \item \verb@ ++K @ $B$d(B \verb@ K++ @ $B$O(B {\tt K} $B$r(B 1 $BA}$d$;$H$$$&0UL#$G$"$k(B.
760: \verb@ K = K+1 @ $B$H=q$$$F$b$h$$(B.
761: $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.
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.
1141:
1142: $B$5$F(B, $B?^(B \ref{figure:cond:coord} $B$G8+$?$h$&$K%3%s%T%e!<%?%W%m%0%i%`$N(B
1143: $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
1144: $B:BI87O$r$H$k$3$H$,B?$$(B.
1145: $B?t3X$N%0%i%U$r=q$$$?$j$9$k$K$O$3$l$G$OITJX$J$3$H$bB?$$$N$G(B,
1146: {\tt glib3.rr} $B$G$O(B,
1147: \begin{center}
1148: \verb@ Glib_math_coordinate=1; @
1149: \end{center}
1150: $B$r<B9T$7$F$*$/$H(B
1151: $B2hLL$N:82<$,86E@$G(B, $B>e$K$$$/$K=>$$(B $y$ $B:BI8$,A}$($k$h$&$J(B
1152: $B?t3X$G$N:BI87O$G?^$rIA2h$9$k(B.
1153:
1154: \begin{example} \rm \index{$B$0$i$U(B@$B%0%i%U(B}
1155: 2$B<!4X?t(B $y=x^2-1$ $B$N%0%i%U$r=q$$$F$_$h$&(B.
1156: %%Prog: cfep/tests/2006-03-11-graph2d.rr
1157: \begin{screen}
1158: \begin{verbatim}
1159: import("glib3.rr");
1160: Glib_math_coordinate=1;
1161: glib_window(-2,-2, 2,2);
1162:
1163: glib_line(-2,0,2,0 | color=0x0000ff);
1164: glib_line(0,-2,0,2 | color=0x0000ff);
1165: for (X=-2.0; X< 2.0; X = X+0.1) {
1166: Y = X^2-1;
1167: X1 = X+0.1;
1168: Y1 = X1^2-1;
1169: glib_line(X,Y, X1,Y1);
1170: }
1171: glib_flush();
1172: \end{verbatim}
1173: \end{screen}
1174: $B<B9T7k2L$O?^(B\ref{fig:graph2d}.
1175: -----$B%W%m%0%i%`$N2r@b$O$^$@=q$$$F$J$$(B.
1176: \end{example}
1177:
1178: %<C
1179: \begin{figure}[tb]
1180: \scalebox{0.6}{\includegraphics{Figs/graph2d.eps}}
1181: \caption{2$B<!4X?t$N%0%i%U(B} \label{fig:graph2d}
1182: \end{figure}
1183: %>C
1184:
1185:
1186: \section{$B1_$rIA$/4X?t$r:n$C$F$_$h$&(B}
1187:
1188: %%Prog: cfep/tests/2006-03-11-circle.rr
1189: \begin{screen}
1190: \begin{verbatim}
1191: import("glib3.rr");
1192: Glib_math_coordinate=1;
1193: glib_window(-1,-1,1,1);
1194: glib_clear();
1195: E = 0.2; X = 0; Y = 0; R = 0.5;
1196: for (T=0; T<=deval(2*@pi); T = T+E) {
1197: Px = X+deval(R*cos(T));
1198: Py = Y+deval(R*sin(T));
1199: Qx = X+deval(R*cos(T+E));
1200: Qy = Y+deval(R*sin(T+E));
1201: glib_line(Px,Py,Qx,Qy);
1202: glib_flush();
1203: }
1204: \end{verbatim}
1205: \end{screen}
1206: -----$B%W%m%0%i%`$N2r@b$O$^$@=q$$$F$J$$(B.
1207:
1208: $B>e$N%W%m%0%i%`$G$O(B $cos$, $sin$ $B$rMQ$$$F1_$rIA$$$F$$$k(B.
1209: $BCf?4(B, $BH>7B$rJQ99$7$?$j(B, $B?'$rJQ99$7$?$j$7$J$,$i$?$/$5$s$N1_$rIA$/$K$O(B,
1210: $B$I$N$h$&$K$9$l$P$h$$$G$"$m$&$+(B?
1211: ``$B4X?t(B'' $B$rMQ$$$k$H$=$l$,MF0W$K$G$-$k(B.
1212:
1213: $B$"$k$R$H$^$H$^$j$N%W%m%0%i%`$O4X?t(B (function) $B$H$7$F(B
1214: $B$^$H$a$F$*$/$H$h$$(B. \index{$B$+$s$9$&(B@$B4X?t(B}
1215: $B7W;;5!8@8l$K$*$1$k4X?t$O?t3X$G$$$&4X?t$H;w$FHs$J$k$b$N$G$"$k(B.
1216: $B4X?t$r<jB3$-(B (procedure) $B$H$+(B $B%5%V%k!<%A%s(B (subroutine) $B$H$+(B
1217: $B$h$V8@8l$b$"$k(B.
1218: $B4X?t$rMQ$$$k:GBg$NMxE@$O(B, $B4X?t$r0lC6=q$$$F$7$^$($P(B,
1219: $BCf?H$r%V%i%C%/%\%C%/%9$H$7$F07$($k$3$H$G$"$k(B.
1220: $BBg5,LO$J%W%m%0%i%`$r=q$/$H$-$OJ#;($J=hM}$r$$$/$D$+$N4X?t$KJ,3d$7$F(B
1221: $B$^$:3F4X?t$r==J,%F%9%H$7;E>e$2$k(B.
1222: $B$=$l$+$i$=$l$i$N4X?t$rAH$_9g$o$;$F$$$/$3$H$K$h$j(B,
1223: $BJ#;($J5!G=$r<B8=$9$k(B.
1224: $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.
1225:
1226: %<C
1227: \begin{figure}[tbh]
1228: \scalebox{0.6}{\includegraphics{Figs/circleFunc.eps}}
1229: \caption{ $B4X?t$K$h$kF1?41_$NIA2h(B} \label{fig:circleFunc}
1230: \end{figure}
1231: %>C
1232:
1233: $B$5$F1_$rIA$/Nc$K$b$I$m$&(B.
1234: $B0J2<$N$h$&$K4X?t(B {\tt circle(X,Y,R,Color)}$B$rDj5A(B ({\tt def}) $B$9$k(B.
1235: $B$3$N4X?t$r(B $R$ $B$d(B $Color$ $B$rJQ2=$5$;$J$,$i8F$V$3$H$K$h$j(B,
1236: $B?^(B\ref{fig:circleFunc} $B$N$h$&$JF1?41_$N?^$rIA$/$3$H$,2DG=$H$J$k(B.
1237: $B4X?t$K$D$$$F>\$7$/$O(B ``asir $B%I%j%k(B'' $B$r;2>H$7$F$[$7$$(B.
1238:
1239: \begin{screen}
1240: \begin{verbatim}
1241: import("glib3.rr");
1242:
1243: def circle(X,Y,R,Color) {
1244: E = 0.2;
1245: for (T=0; T<deval(2*@pi); T = T+E) {
1246: Px = X+deval(R*cos(T));
1247: Py = Y+deval(R*sin(T));
1248: Qx = X+deval(R*cos(T+E));
1249: Qy = Y+deval(R*sin(T+E));
1250: glib_line(Px,Py,Qx,Qy | color=Color);
1251: }
1252: glib_flush();
1253: }
1254:
1255: Glib_math_coordinate=1;
1256: glib_window(-1,-1,1,1);
1257: glib_clear();
1258: CC = 0xff0000;
1259: for (P = 0.4; P<0.5; P = P+0.01) {
1260: circle(0,0,P,CC);
1261: CC = random()%0x1000000;
1262: }
1263: \end{verbatim}
1264: \end{screen}
1265: -----$B%W%m%0%i%`$N>\$7$$2r@b$^$@(B.
1266:
1267: \begin{problem} \rm
1268: \begin{enumerate}
1269: \item $BJ,EY4o$rIA$/%W%m%0%i%`$r:n$l(B.
1270: \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,
1271: $BLZ$d%S%k$N9b$5$rB,Dj$9$k5!3#$H%=%U%H%&%(%"%7%9%F%`$r3+H/$;$h(B.
1272: \end{enumerate}
1273: \end{problem}
1274:
1275: \begin{problem} \rm
1276: ($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}
1277: cfep $B$K$O(B OpenGL $B%$%s%?%W%j%?!<$,AH$_9~$s$G$"$k(B.
1278: OpenGL $B$O(B3$B<!85%0%i%U%#%C%/%9$rMQ$$$k%=%U%H%&%(%":n@.$N$?$a$K(B
1279: $BMQ$$$i$l$kLs(B 150$B<oN`$N%3%^%s%I$+$i9=@.$5$l$F$$$k%Q%C%1!<%8$G(B
1280: 3$B<!85%0%i%U%#%C%/%9$NI8=`5,3J$N$R$H$D$G$b$"$k(B.
1281: cfep 1.1$B$G$O$=$NCf$N(B 10 $B<e$N%3%^%s%I$rMxMQ$G$-$k(B.
1282:
1283: $B$3$N(B OpenGL $B%$%s%?%W%j%?!<$rMQ$$(B,
1284: $BB?LLBN(B(polygon)$B$r:`NA$K$7(B,
1285: cfep$B>e5iJT(B, OpenGL $B$N%W%m%0%i%`$r;29M$K(B
1286: ``$B2H(B'' $B$r=q$$$F$_$h$&(B.
1287: \end{problem}
1288:
1289:
1290:
1291: \chapter{For $BJ8$K$h$k?tNs$N7W;;(B}
1292:
1293: \section{$BD6F~Lg(B, $BBh(B2$B$N4XLg(B: $BA22=<0$G$-$^$k?tNs$N7W;;(B}
1294:
1295: \begin{example} \rm
1296: $a$ $B$r@5$N?t$H$9$k$H$-(B,
1297: \begin{eqnarray*}
1298: x_{n+1} &=& \frac{x_n + \frac{a}{x_n}}{2}, \\
1299: x_0 &=& a
1300: \end{eqnarray*}
1301: $B$G$-$^$k?tNs(B $x_0, x_1, x_2, \ldots $
1302: $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.
1303: $a=2$ $B$N;~(B, $x_1, x_2, \ldots, x_4$ $B$r7W;;$9$k%W%m%0%i%`$r=q$$$F$_$h$&(B.
1304: %%Prog: cfep/tests/2006-03-11-sqrt.rr
1305: \begin{screen}
1306: \begin{verbatim}
1307: A = 2.0;
1308: X = A;
1309: for (I=0; I<5; I++) {
1310: Y = (X+A/X)/2;
1311: print(Y);
1312: X = Y;
1313: }
1314: \end{verbatim}
1315: \end{screen}
1316: \end{example}
1317:
1318: $B$3$N%W%m%0%i%`$N<B9T7k2L$O?^(B\ref{fig:sqrt}.
1319: %<C
1320: \begin{figure}[tbh]
1321: \scalebox{0.5}{\includegraphics{Figs/sqrt.eps}}
1322: \caption{$\sqrt{2}$ $B$K<}B+$9$k?tNs(B} \label{fig:sqrt}
1323: \end{figure}
1324: %>C
1325:
1326: $BD6F~Lg$G$N4XLg$O(B
1327: \begin{screen}
1328: \begin{verbatim}
1329: Y = (X+A/X)/2;
1330: X = Y;
1331: \end{verbatim}
1332: $B$N0UL#$r40A4$KM}2r$9$k$3$H(B
1333: \end{screen}
1334: $B$G$"$k(B.
1335: $BJQ?t$N>O$G@bL@$7$?$h$&$K(B,
1336: $$ \mbox{{\bf $BJQ?tL>(B}} {\tt = } \mbox{{\bf $B<0(B}} {\tt ;} $$
1337: $B$O$^$:1&JU$N<0$r7W;;$7$=$N$"$H$=$N7W;;7k2L$r:8JU$NJQ?t$KBeF~$;$h$H$$$&0UL#(B
1338: $B$G$"$k(B. $B$7$?$,$C$F(B,
1339: \verb@ Y = (X+A/X)/2; @ $B$O8=:_$N(B {\tt X} $B$H(B {\tt A} $B$K3JG<$5$l$?(B
1340: $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,
1341: $B$H$$$&0UL#$G$"$k(B. $B$^$?(B
1342: \begin{screen}
1343: \verb@X=Y@ $B$O(B \verb@X@ $B$,(B \verb@Y@ $B$KEy$7$$$H$$$&0UL#$G$O$J$/(B,
1344: $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.
1345: \end{screen}
1346: $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
1347: $B=gHV$K7W;;$7$F(B print $B$7$F$$$kM}M3$,M}2r$G$-$k$G$"$m$&(B.
1348: $B<+J,$,7W;;5!$K$J$C$?$D$b$j$G(B,
1349: $BJQ?t$NCf$N?tCM$,$I$N$h$&$KJQ2=$7$F$$$/$N$+(B,
1350: $B=q$-$J$,$iM}2r$7$FD:$-$?$$(B.
1351: $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.
1352: \index{$B$@$$$K$e$&(B@$BBeF~(B}
1353:
1354: \section{$B1_$rIA$/?tNs(B}
1355:
1356: $B?tNs$N7W;;$rMQ$$$k$H(B, $\cos$ $B$d(B $\sin$ $B$N7W;;$r$d$i$:$K1_$rIA$/$3$H$,(B
1357: $B$G$-$k(B.
1358: %%Prog: cfep/tests/2006-03-11-circle-dda.rr
1359: \begin{screen}
1360: \begin{verbatim}
1361: import("glib3.rr");
1362: Glib_math_coordinate=1;
1363: glib_window(-2,-2, 2,2);
1364: glib_clear();
1365: E = 0.1;
1366: C1 = 1.0; C2=1.0;
1367: S1 = 0.0; S2=E;
1368: for (T=0; T<=deval(2*@pi); T = T+E) {
1369: C3 = 2*C2-C1-E*E*C2;
1370: S3 = 2*S2-S1-E*E*S2;
1371: glib_line(C1,S1, C2,S2);
1372: C1=C2; S1=S2;
1373: C2=C3; S2=S3;
1374: glib_flush();
1375: }
1376: \end{verbatim}
1377: \end{screen}
1378:
1379: $B$3$N%W%m%0%i%`$N<B9T7k2L$O?^(B\ref{fig:circleDda}.
1380: %<C
1381: \begin{figure}[tbh]
1382: \scalebox{0.6}{\includegraphics{Figs/circleDda.eps}}
1383: \caption{$\cos$, $\sin$ $B$r;H$o$:$K1_$rIA$/(B} \label{fig:circleDda}
1384: \end{figure}
1385: %>C
1386:
1387: -----$B%W%m%0%i%`$N2r@b$^$@=q$$$F$J$$(B.
1388:
1389: $B$3$NOCBj$O(B, $B?tNs$N7W;;$H:9J,J}Dx<0$K$h$k%7%_%e%l!<%7%g%s$KB3$/(B.
1390: $B$3$l$K$D$$$F$O$^$?9F$r$"$i$?$a$F=q$$$F$_$?$$(B.
1391:
1392: $B0J>e$GD6F~Lg$O=*N;$G$"$k(B. $BB3$-$O(B ``Asir $B%I%j%k(B'' $B$rFI$s$G$M(B.
1393:
1394: \chapter{cfep $B>e5iJT(B}
1395:
1396: \section{\TeX $B$K$h$k%?%$%W%;%C%H(B($B<B83E*(B)}
1397: %%Doc: cfep/tests/2006-03-06
1398: $B=PNO$r(BTeX$B$G%?%$%W%;%C%H$9$k$K$O(B
1399: ``$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 1400: {\tt latex}, {\tt dvipng} $B$,%$%s%9%H!<%k$5$l$F$$(B
1.1 takayama 1401: $B$J$$$HF0:n$7$J$$(B.
1.3 ! takayama 1402: $B$3$l$i$O$?$H$($P(B {\tt fink} $B$+$i(B \TeX $B$r%$%s%9%H!<%k$7$?$j(B,
! 1403: {\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 1404: \TeX $B$rMQ$$$?;E>e$jNc$O?^(B\ref{fig:sl2}$B$r8+$h(B.
1405: $B$J$*(B, \TeX $B$G%?%$%W%;%C%H$9$k>l9g%[!<%`$N2<$K(B
1406: \verb@OpenXM_tmp@ $B$J$k:n6HMQ$N%U%)%k%@$,:n@.$5$l$k(B.
1407: $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.
1408: $B;~!9<jF0$G:n6H%U%!%$%k$r>C5n$5$l$?$$(B.
1409: \index{tex@\TeX}
1410:
1411: \section{$BA*BrHO0O$N$_$N<B9T(B}
1412:
1413: \index{$B$;$s$?$/$O$s$$$N$_$N$8$C$3$&(B@$BA*BrHO0O$N$_$N<B9T(B}
1414: $B2hLL>e$N(B ``$BA*BrHO0O$N$_$r<B9T(B'' $B$r%A%'%C%/$9$k$H(B,
1415: ``$B;O$a(B'' $B%\%?%s$r$*$7$?$H$-(B, $BA*BrHO0O$N$_$,I>2A$5$l$k(B.
1416: $BA*BrHO0O$,$J$$>l9g$O%-%c%l%C%H0LCV$N9T$,<+F0A*Br$5$l$F<B9T$5$l$k(B.
1417: \command{{\tt Enter}} $B$HAH$_9g$o$;$F$3$N5!G=$r;H$&$H(B, $B%?!<%_%J%k$+$i(B
1418: asir $B$rMxMQ$9$k$N$K$A$g$C$H;w$F$/$k(B.
1419: $B?^(B\ref{fig:sl2}$B$O$3$N$h$&$J<B9T$r$7$F$$$kNc$G$"$k(B.
1420:
1421: %<C
1422: \begin{figure}[tbh]
1423: \scalebox{0.5}{\includegraphics{Figs/sl2.eps}}
1424: \caption{$B%?!<%_%J%kIw(B} \label{fig:sl2}
1425: \end{figure}
1426: %>C
1427:
1428:
1429: \noindent
1430: %%Doc: cfep/tests/2007-03-07-debug.rtfd
1431: \fbox{$B<ALd(B}
1432: 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
1433: $B$h$$$+(B? \\
1434: \fbox{$BEz$((B}
1435: cfep $B$O=i?4<T8~$-$N%$%s%?%U%'!<%9$J$N$G(B,
1436: $BBg5,LO$J%W%m%0%i%`3+H/$rA[Dj$7$F$$$J$$$,(B,
1437: $B;d$O<!$N$h$&$K%i%$%V%i%j$N3+H/$r$7$F$$$k(B.
1438:
1439: \begin{enumerate}
1440: \item $BI,MW$J4X?t$r=q$/(B. $B2<$NNc$G$O(B {\tt sum1}.
1441: \item $B4X?t$r%F%9%H$9$kF~NO$r%3%a%s%H$N7A$G$=$N4X?t$N6a$/$K=q$$$F$*$/(B.
1442: $B2<$NNc$G$O%3%a%s%H$K$"$k(B {\tt sum1(10,1); } $BEy(B.
1443: \end{enumerate}
1444:
1445:
1446: \begin{screen}
1447: \begin{verbatim}
1448: /*
1449: testinput: sum1(10,1);
1450: testinput: sum1(10,2);
1451: */
1452: def sum1(N,M) {
1453: S = 0; i=1;
1454: for (I=1; I<N; I++) {S = S+I^M; }
1455: return S;
1456: }
1457: \end{verbatim}
1458: \end{screen}
1459:
1460: \begin{enumerate}
1461: \item ``$B;O$a(B'' $B%\%?%s$G4X?tDj5A$r%m!<%I(B.
1462: $B$3$N;~E@$GJ8K!%(%i!<$J$I$,$"$l$P%a%C%;!<%8$K$7$?$,$C$F=$@5(B.
1463: \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.
1464: \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
1465: $B9T$&(B. \index{$B$($i!<(B@$B%(%i!<(B}
1466: \end{enumerate}
1467:
1468: %<C
1469: \begin{figure}[tb]
1470: \scalebox{0.5}{\includegraphics{Figs/howtoDebug1.eps}}
1471: \caption{``$BA*BrHO0O$N$_$r<B9T(B''$B$N3hMQ(B} \label{fig:howtoDebug1}
1472: \end{figure}
1473: %>C
1474:
1475:
1476: \section{$B%(%s%8%s$r5/F0$7$J$$(B}
1477: %%cfep/tests/2006-03-08-noEngine
1478:
1479: \noindent
1480: \fbox{$B<ALd(B}
1481: $B%F%-%9%HJT=8$^$?$O%F%-%9%H$N1\Mw$@$1$G7W;;$r$9$k$D$b$j$O$"$j$^$;$s$,(B. \\
1482: \fbox{$BEz$((B}
1483: ``$B<B9T(B'' $B%a%K%e!<$G(B ``$B%(%s%8%s$r<+F05/F0$7$J$$(B'' $B$rA*Br(B. \\
1484: %<C
1485: \scalebox{0.3}{\includegraphics{Figs/menuNoEngine.eps}} \\
1486: %>C
1487: $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. \\
1488: %<C
1489: \scalebox{0.3}{\includegraphics{Figs/popupRestart.eps}}
1490: %>C
1491:
1492:
1493: \section{OpenGL$B%$%s%?%W%j%?(B}
1494:
1495: \index{OpenGL}
1496: Cfep $B$K$O(B OpenGL $B%$%s%?%W%j%?!<$,AH$_9~$s$G$"$k(B.
1497: OpenGL $B$O(B3$B<!85%0%i%U%#%C%/%9$rMQ$$$k%=%U%H%&%(%":n@.$N$?$a$K(B
1498: $BMQ$$$i$l$kLs(B 150$B<oN`$N%3%^%s%I$+$i9=@.$5$l$F$$$k%Q%C%1!<%8$G(B
1499: 3$B<!85%0%i%U%#%C%/%9$NI8=`5,3J$N$R$H$D$G$b$"$k(B.
1500: cfep 1.1$B$G$O$=$NCf$N(B 10 $B<e$N%3%^%s%I$rMxMQ$G$-$k(B.
1501: $B>\$7$/$O(B
1502: {\tt cfep.app/OpenXM/lib/asir-contrib/cfep-opengl.rr} $B$r;2>H(B.
1503:
1504: \index{OpenGL$B$0$i$U$#$C$/$*$V$8$'$/$H(B@OpenGL$B%0%i%U%#%C%/%*%V%8%'%/%H(B}
1505: OpenGL $B$G$O$^$:(B OpenGL$B%0%i%U%#%C%/%*%V%8%'%/%H$rG[CV$7(B,
1506: $B$=$l$+$i;kE@$N0LCV$+$i8+$?2hA|$rIA2h$9$kJ}K!$rMQ$$$k(B.
1507: $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
1508: $B$7$F$$$k(B.
1509: {\tt glib\_remove\_last()} $BL?Na$O$=$N:G8e$NMWAG$r:o=|$9$kL?Na$G$"$k(B.
1510: {\tt cfep-opengl.rr} $B%i%$%V%i%j$G$O(B,
1511: {\tt opengl.metaRemoveLast()} $B4X?t$G:G8e$NMWAG$r:o=|$G$-$k(B.
1512: \index{opengl}
1513:
1514: %<C
1515: \begin{figure}[tb]
1516: \scalebox{0.6}{\includegraphics{Figs/twoPolygon.eps}}
1517: \caption{} \label{fig:twoPolygon}
1518: \end{figure}
1519: %>C
1520:
1521: \begin{screen}
1522: \begin{verbatim}
1523: import("cfep-opengl.rr");
1524: opengl.metaRemoveAll();
1525: opengl.init();
1526: opengl.glib3DefaultScene(0);
1527: opengl.redraw();
1528: opengl.glColor4f(0.0,0.0,1.0,0.3);
1529: opengl.glBegin(GL_POLYGON); Y=0.1;
1530: opengl.glVertex3f(-1.0, Y, 0.5);
1531: opengl.glVertex3f(-1.0, Y, -0.5);
1532: opengl.glVertex3f(1.0, Y, -0.5);
1533: opengl.glVertex3f(1.0, Y, 0.5);
1534: opengl.glEnd();
1535:
1536: opengl.glColor4f(1.0,0.0,0.0,0.5);
1537: opengl.glBegin(GL_POLYGON);
1538: opengl.glVertex3f(0.0, 0.5, 0.0);
1539: opengl.glVertex3f(0.0, 0.5, -0.4);
1540: opengl.glVertex3f(0.5, -0.2, -0.4);
1541: opengl.glVertex3f(0.5, -0.2, 0.0);
1542: opengl.glEnd();
1543: opengl.glFlush() ;
1544: opengl.metaShowListOfOpenGLCommands();
1545: \end{verbatim}
1546: \end{screen}
1547: $B$3$N%W%m%0%i%`$G$O(B 2 $BKg$ND9J}7A$rIA$$$F$$$k(B.
1548: $B$3$N%W%m%0%i%`$N=PNO$O?^(B\ref{fig:twoPolygon}.
1549: -----$B>\$7$$@bL@$O$^$@(B.
1550:
1551: OpenGL $B$N2hLL$K$OIaDL$N?t3X$N$h$&$K(B $(x,y)$ $B:BI8$,$O$$$C$F$*$j(B,
1552: $B2hLL$+$i<jA0B&$,(B $z$ $B:BI8$,@5$NJ}8~(B, $B2hLL$N8~$3$&B&$,(B
1553: $z$ $B:BI8$,Ii$NJ}8~$G$"$k(B.
1554: ``$BL\(B'' $B$+$i86E@J}8~$r8+$?2hA|$,(B
1555: $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,
1556: OpenGL$B%*%V%8%'%/%H$r$$$m$$$m$J3QEY$+$i$_$k$3$H$,2DG=$G$"$k(B.
1557: $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.
1558: $BL\$NF0$-$K47$l$k$K$O(B, $B<!$NFs$D$N%G%b2hLL$r$?$a$9$HLLGr$$$@$m$&(B.
1559: \begin{screen}
1560: \begin{verbatim}
1561: import("cfep-opengl.rr");
1562: opengl.glib3DefaultScene("mesa demo/ray");
1563: \end{verbatim}
1564: \end{screen}
1565:
1566: \begin{screen}
1567: \begin{verbatim}
1568: import("cfep-opengl.rr");
1.3 ! takayama 1569: opengl.glib3DefaultScene("cfep demo/icosahedron");
1.1 takayama 1570: \end{verbatim}
1571: \end{screen}
1572:
1573: \cleardoublepage
1574: \flushbottom
1575: \printindex
1576:
1577: \end{document}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>