Mathematica中table的几点用法
table内置函数是在mathematica中比较常用的函数,往往与其他函数嵌套使用,
要掌握难的嵌套,首先把最基本的用法搞清楚,然后在使用高级用法。
首先是用法:
In[1]:= Table[i^2, {i, 10}]
Out[1]= {1, 4, 9, 16, 25, 36, 49, 64, 81, 100}(A table of the first ten squares)
In[2]:= Table[f[i], {i, 0, 20, 2}]
Out[2]= {f(0),f(2),f(4),f(6),f(8),f(10),f(12),f(14),f(16),f(18),f(20)}
(A table with i running from 0 to 20 in steps of 2)
In[2]:= Table[x, {10}]
Out[2]= {x,x,x,x,x,x,x,x,x,x}(A list of ten x's)
In[1]:= Table[10 i + j, {i, 4}, {j, 3}]
Out[1]= (11 12 13
21 22 23
31 32 33
41 42 43)
上面的几个例子是doc上面的基本用法(更多的用法参看doc)
在项目这本书中,table和Line函数,Graphics函数嵌套,生成线段,然后线段连接,生成圆弧。
比如这个例子:
这个例子中Table函数列出了圆弧的参数方程,以及参数的增量,圆弧的中心位置。
转载于:https://www.cnblogs.com/dragonlive/archive/2012/03/29/2424022.html