How to display values of a sequence in Maple 12

347 Views Asked by At

I want your help to arrange the values of a sequence or function in a tabular form automatically by giving the "seq" command in maple 12.

e.g. $f(n)=n^2$

$$ \begin{array}{|l|l|} \hline n&f(n)\\ \hline0 & 0\\ \hline 1 & 1\\ \hline 2&4\\ \hline 3&9\\ \hline \vdots&\vdots\\\hline \end{array} $$

1

There are 1 best solutions below

5
On BEST ANSWER

The seq command alone doesn't do it, but you can try something like this:

> chart:= proc (head::list, vals::list)   
      Matrix([head, seq(eval(subs(head[1] = vals[i],head)),
         i = 1 .. nops(vals))])
     end proc;

Then, for example:

> chart([x,x^2],[$0..5]);

$$\left[ \begin {array}{cc} x&{x}^{2}\\ 0&0\\ 1&1\\ 2&4\\ 3&9\\ 4 &16\\ 5&25\end {array} \right] $$