Mathematica: making a table

  • Mathematica
  • Thread starter matiasmorant
  • Start date
  • #1
I want to make a Table[] but aI don't want this function to evaluate its argument each time. for example, I want to make the table {12,22,32,42,...}, instead of {1,4,9,16,.....}


how?
 

Answers and Replies

  • #2
313
1
Two (out of many) possible approaches

In[1]:= Table[With[{nn=n},Defer[nn^2]],{n,1,10}]
Out[1]= {1^2,2^2,3^2,4^2,5^2,6^2,7^2,8^2,9^2,10^2}
In[2]:= Table[Superscript[n,2],{n,1,10}]
Out[2]= {1^2,2^2,3^2,4^2,5^2,6^2,7^2,8^2,9^2,10^2}

The advantage of the first one, is that if copied and pasted, it will evaluate as normal.
 
  • #3
Thanks a lot, I could do what I wanted
 

Related Threads on Mathematica: making a table

  • Last Post
Replies
2
Views
2K
Replies
2
Views
2K
Replies
2
Views
3K
Replies
2
Views
3K
Replies
6
Views
2K
Replies
1
Views
507
Replies
4
Views
3K
Replies
2
Views
16K
Replies
2
Views
4K
Top