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函數列出了圓弧的參數方程,以及參數的增量,圓弧的中心位置。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM