loadMacros( "MathObjects.pl", "PGML.pl", "niceTables.pl" ); $x1 = random(-5,5,1); $x2 = random($x1+1,$x1+5,1); $f = Formula("x/2+1"); # # The first row of the table is headers for the columns # (formatted using LaTeX) # @xy = ([['\(x\)', header=>'CH'], ['\(y\)', header=>'CH']]); # # Add the rows to the table. The values are put between # \( and \) so they will be formatted as mathematics # for $x ($x1..$x2) { push(@xy, ['\('.$x.'\)', '\('.$f->eval(x => $x).'\)']); } # # Create the table using DataTable(). The three stars are # so that the LaTeX will be formatted after being inserted. # BEGIN_PGML [@ DataTable( [ @xy ], align => "|c|c|", midrules=>1) @]*** END_PGMLHope that gets you where you need to go.
Here is an example that creates a table with rows for each x between two randomly selected values. Perhaps that will be sufficient for you to modify it for your needs: