%% This file is generated by preprocessor!
%% Do not edit it by hand.
%% Edit the source file cpp/arithtab.cpp.

\language{es}
\author{XIAO, Gang}
\email{xiao@unice.fr}
\format{html}
 \title{Tabla aritmética 3x3}
\integer{rows=3}
\integer{cols=3}
\integer{tot=(3*3)}

\integer{confparm1=\confparm1=?1}
\integer{confparm2=\confparm2=?1}
\text{o1=item(\confparm2,1,1,2,2)}
\text{o2=item(\confparm2,1,2,1,2)}
\text{op1=item(\o1,+,*)}
\text{op2=item(\o2,+,*)}
\text{Name1=item(\o1,Suma,Producto)}
\text{Name2=item(\o2,Suma,Producto)}
\text{names=item(\confparm2,sum,
        sum or product,
        sum or product,
        product)}
\text{vars=shuffle(a,b,c,d,r,s,t,x,y,z)}
\text{rt=sqrt(random(2,3,5))}
\text{list=wims(record \confparm1 of src/data)}
\text{nature=row(1,\list)}
\text{parms=row(2,\list)}
\text{obj=\parms[1]}
\text{sizex=\parms[2]}
\text{sizey=\parms[3]}
\text{sizex=\sizex =? 60}
\text{sizey=\sizey=? 35}
\text{size=\sizex \sizey}
\text{list=wims(rows2lines row(3..-1,\list))}
\integer{n=items(\list)}
\if{\n<=3}{
 \text{a=\list[1]}
 \text{b=\list[2]}
 \text{c=\list[3]}
 \text{randtype=computed}
 \if{\c<0}{
  \text{sh1=wims(values \c*x,-(\c)*x for x=\a to \b)}
 }{
  \text{sh1=wims(values \c*x for x=\a to \b)}
 }
 \text{sh=item(1..\tot,shuffle(\sh1))}
}{
 \text{randtype=listed}
 \text{sh=item(1..\tot,shuffle(\list))}
}
\text{sh=wims(mathsubst f=\vars[1] in \sh)}
\text{sh=wims(mathsubst g=\vars[2] in \sh)}
\text{sh=wims(mathsubst rt=\rt in \sh)}
\text{empty=}

\text{goodlist=(\sh[1]),(\sh[2]),(\sh[3]),(\sh[4]),
(\sh[5]),(\sh[6]),(\sh[7]),(\sh[8]),
(\sh[9]),(\sh[10]),(\sh[11]),(\sh[12]),
(\sh[13]),(\sh[14]),(\sh[15]),(\sh[16])}

\text{rowvals=}
\for{x=1 to \rows}{
 \text{r=wims(replace , by \op1 in \goodlist[(\x-1)*\cols+1..\x*\cols])}
 \text{r=maxima(expand(\r))}
 \text{rowvals=wims(append item \r to \rowvals)}
}

\text{colvals=}
\for{y=1 to \cols}{
 \text{c=wims(replace , by \op2 in \goodlist[wims(values \cols*(x-1)+\y for x=1 to \rows)])}
 \text{c=maxima(expand(\c))}
 \text{colvals=wims(append item \c to \colvals)}
}


 \text{replies=item(1..\tot,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16)}
 \steps{\replies}






\statement{<em>\nature</em>.



<p>Rellene la tabla arrastrando dentro de ella los números o las expresiones de abajo,

de manera que cada fila y cada columna produzcan el resultado indicado:
<p>
<table border=2 cellpadding=5>
<tr><td>
\for{cc=1 to 3}{<th><small>columna \cc</small></th>}
<th>\Name1</th></tr>
\for{rr=1 to 3}{
<tr><th><small>fila \rr
 \for{cc=1 to 3}{






  <td align=center>\embed{\replies[(\rr-1)*\cols+\cc],\size}</td>

}
<td align=center>\(\rowvals[\rr])</td></tr>
}
<tr><th>\Name2</th>
\for{cc=1 to 3}{<td align=center>\(\colvals[\cc])</td>}
</tr></table>
}



\answer{Box 1}{\r1;\(\sh[1])}{type=dragfill}
\answer{Box 2}{\r2;\(\sh[2])}{type=dragfill}
\answer{Box 3}{\r3;\(\sh[3])}{type=dragfill}
\answer{Box 4}{\r4;\(\sh[4])}{type=dragfill}
\answer{Box 5}{\r5;\(\sh[5])}{type=dragfill}
\answer{Box 6}{\r6;\(\sh[6])}{type=dragfill}
\answer{Box 7}{\r7;\(\sh[7])}{type=dragfill}
\answer{Box 8}{\r8;\(\sh[8])}{type=dragfill}
\answer{Box 9}{\r9;\(\sh[9])}{type=dragfill}
\answer{Box 10}{\r10;\(\sh[10])}{type=dragfill}
\answer{Box 11}{\r11;\(\sh[11])}{type=dragfill}
\answer{Box 12}{\r12;\(\sh[12])}{type=dragfill}
\answer{Box 13}{\r13;\(\sh[13])}{type=dragfill}
\answer{Box 14}{\r14;\(\sh[14])}{type=dragfill}
\answer{Box 15}{\r15;\(\sh[15])}{type=dragfill}
\answer{Box 16}{\r16;\(\sh[16])}{type=dragfill}

\text{rvals=wims(replace internal \ by \empty in
  \r1,\r2,\r3,\r4,\r5,\r6,\r7,\r8,\r9,\r10,\r11,\r12,\r13,\r14,\r15,\r16)}

\text{crows=}
\for{x=1 to \rows}{
 \text{r2=wims(replace , by \op1 in \rvals[(\x-1)*\cols+1..\x*\cols])}
 \if{\randtype issametext computed}{
  \real{cr=\rowvals[\x]-(\r2)}
 }{
  \text{cr=maxima(expand((\rowvals[\x])-(\r2)))}
 }
 \text{cr=\cr issametext ?NaN}
 \text{crows=wims(append item \cr to \crows)}
}

\text{ccols=}
\for{y=1 to \cols}{
 \text{c2=wims(replace , by \op2 in \rvals[wims(values \cols*(x-1)+\y for x=1 to \rows)])}
 \if{\randtype issametext computed}{
  \real{cc=\colvals[\y]-(\c2)}
 }{
  \text{cc=maxima(expand((\colvals[\y])-(\c2)))}
 }
 \text{cc=\cc issametext ?NaN}
 \text{ccols=wims(append item \cc to \ccols)}
}

\condition{\Name1 of row 1 equals \(\rowvals[1])}{\crows[1] = 0}
\condition{\Name1 of row 2 equals \(\rowvals[2])}{\crows[2] = 0}

\condition{\Name1 of row 3 equals \(\rowvals[3])}{\crows[3] = 0}





\condition{\Name2 of column 1 equals \(\colvals[1])}{\ccols[1] = 0}
\condition{\Name2 of column 2 equals \(\colvals[2])}{\ccols[2] = 0}

\condition{\Name2 of column 3 equals \(\colvals[3])}{\ccols[3] = 0}
