define downbend {line right 0.1 $1; arrow down}
define read {[
- FRAME: box ht 0.5 wid 1.0 $1 invis
+ FRAME: box invis ht 0.5 wid 1.0 $1
line from FRAME.ne to 0.8<FRAME.ne,FRAME.nw>
line from last line.end to 0.8<FRAME.sw,FRAME.nw>
line from last line.end to FRAME.sw
line from FRAME.se to FRAME.ne
line from FRAME.se to FRAME.sw
- "READ" at FRAME.n - (0, 0.1)
]}
define printme {[
- FRAME: box wid $1 ht $2 invis
+ FRAME: box invis $1
line from FRAME.ne to FRAME.nw
- $3 at FRAME.c
L: line from FRAME.nw to FRAME.sw
R: line from FRAME.ne to 0.85<FRAME.ne,FRAME.se>
HILEFT: 0.9<FRAME.sw,FRAME.nw>
HIRIGHT: 0.9<FRAME.se,FRAME.ne>
MID: FRAME.s
- arc from L.end to MID
- arc from R.end to MID rad 0.5*$1
- "PRINT" at FRAME.n - (0, 0.1)
+ arc from L.end to MID rad FRAME.width*0.75
+ arc from R.end to MID rad FRAME.width*0.75
]}
define throughbox{[
<!ENTITY simpsfunc SYSTEM "../madhouse/simpsfunc.mad">
<!ENTITY simpsmain SYSTEM "../madhouse/simpsmain.mad">
<!ENTITY findroot SYSTEM "../madhouse/findroot.mad">
+<!ENTITY transfunc SYSTEM "../madhouse/transfunc.mad">
<!ENTITY scope1 SYSTEM "scope1.xml">
<!ENTITY scope2 SYSTEM "scope2.xml">
<!ENTITY scope3 SYSTEM "scope3.xml">
arithmetic can be done more simply and efficiently, usually with less
round-off error, than arithmetic on non-integers. [Numbers which may
have fractional parts are usually written in the so-called "scientific
-notation", such as 3.1 x 10<superscript>-6</superscript> are called
+notation", such as 3.1 × 10<superscript>-6</superscript> are called
floating point numbers.] Numbers are assumed to be in the
floating-point mode unless otherwise declared, as in the INTEGER
statement in the example. The WHENEVER statement above is to be
D.</para></listitem>
<listitem><para>Negation, written as "-", e.g., -ALOHA, meaning the
-"negative of ALOHA." Thus-X.P.-.5
-means-(X<superscript>-.5</superscript>).
+"negative of ALOHA." Thus -X.P.-.5
+means -(X<superscript>-.5</superscript>).
<!-- in the original, 'graph continued with ", the negative of the" -->
</para></listitem>
</orderedlist>
subscript is assumed to have a subscript of zero.</para>
<para>Two dimensional matrices are stored internally by rows, i.e., an
-m x n matrix will be stored in the order: a<subscript>11</subscript>,
+m × n matrix will be stored in the order: a<subscript>11</subscript>,
a<subscript>12</subscript>, a<subscript>13</subscript>, ...,
a<subscript>1n</subscript>, a<subscript>21</subscript>, ...,
a<subscript>2n</subscript>, ... a<subscript>mn</subscript>. In
general, matrices are stroed in the order determined by varying the
right-most subscript first, then the next right-most, etc. Thus, an m
-x n x p x q matrix would be stored in the order:
+× n × p × q matrix would be stored in the order:
a<subscript>1111</subscript>, a<subscript>1112</subscript>, ...,
a<subscript>111q</subscript>, a<subscript>1121</subscript>,
a<subscript>1122</subscript>, ... a<subscript>112q</subscript>, ...,
TRANSFER TO READ
FUNCTION NAME S
</programlisting>
-<!-- beginpage -->
-
</sect2>
+<!-- beginpage -->
<sect2><title>Example 4</title>
<!-- FIXME -->
*DATA
1. 2. .01
</programlisting>
+</sect2>
+<!-- pagebreak -->
+<sect2><title>Example 5</title>
+
+<para><emphasis>Problem:</emphasis> Find the transpose A' of an n×n
+matrix A = (a<subscript>ij</subscript>).</para>
+
+<para><emphasis>Analysis:</emphasis> If we write A' =
+(b<subscript>ij</subscript>) then b<subscript>ij</subscript> =
+a<subscript>ji</subscript>. We challe inter­change
+symmetrically-placed pairs of elements, leaving untouched elements on
+the main diagonal. The program will be in the form of an external
+function.</para>
+
+<para><emphasis>Flow diagram:</emphasis></para>
+
+<note><para>There are two minor errors in this flow diagram,
+reproduced faithfully from the original. Can you spot them?</para></note>
+
+<mediaobject>
+ <imageobject>
+ <imagedata fileref='fig11.png'/>
+ </imageobject>
+</mediaobject>
+
+<para><emphasis>Program:</emphasis></para>
+
+<programlisting>
+&transfunc;
+</programlisting>
+
+<para>Note: No dimension information is needed for A, since it is an
+argument in a function <emphasis>definition</emphasis> program. The
+function would be <emphasis>called</emphasis> with a statement of the
+form EXECUTE TRANS.(A, N).</para>
+</sect2>
+<!-- pagebreak -->
+<sect2><title>Example 6</title>
+
+<para><emphasis>Problem:</emphasis> Multiply the matrix A =
+(a<subscript>ij</subscript>) by the matrix B =
+(b<subscript>ij</subscript>) to produce the matrix X =
+(c<subscript>ij</subscript>), i.e. C = A · B. Assume tha A has
+dimensions m × n with m · n ≤ 1500, B has dimensions n
+× p with n · p ≤ 1500, and C has dimensions m ×
+p with m · p ≤ 1500.</para>
+
+<para><emphasis>Analysus:</emphasis> An element c<subscript>ij</subscript>
+of C is computed by the formula</para>
+
+<mediaobject>
+ <imageobject>
+ <imagedata fileref='equation6.png'/>
+ </imageobject>
+</mediaobject>
+
+<para><emphasis>Flow diagram:</emphasis></para>
+
+<mediaobject>
+ <imageobject>
+ <imagedata fileref='fig12.png'/>
+ </imageobject>
+</mediaobject>
+
<!-- pagebreak -->
</sect2>