1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
comment
Shows how to print numbers, so that they can appear in a TeX table.
texprint(x,d); prints the matrix x with d decimal places.
itexprint(x,d); the same for interval matrices.
endcomment
function texprint (x,d=5)
form="\hfill %0."|printf("%g",d)|"g & ";
form1="\quad %0."|printf("%g",d)|"g & ";
filler=printf(form1,1/300000000000);
n=cols(x); m=rows(x)
s="\settabs\+ \qquad \quad & ";
loop 1 to n
s=s|filler;
end
s|"\cr",
loop 1 to m;
i=#; s="\+ & ";
loop 1 to n
s=s|printf(form,x[i,#]);
end;
s|"\cr",
end;
return ""
endfunction
function itexprint (x,d=5)
lform="\hfill [%0."|printf("%g",d)|"g";
rform=",%0."|printf("%g",d)|"g] & ";
form1="%0."|printf("%g",d)|"g";
f=printf(form1,1/30000000000);
filler="\quad "|f|f|" & ";
n=cols(x); m=rows(x)
s="\settabs\+ \qquad \quad & ";
loop 1 to n
s=s|filler;
end
s|"\cr",
loop 1 to m;
i=#; s="\+ & ";
loop 1 to n
s=s|printf(lform,left(x[i,#]))|printf(rform,right(x[i,#]));
end;
s|"\cr",
end;
return ""
endfunction
|