class12 - PHYS 5900 Class 12 (9/21/2009) Zi-Wei Lin...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
PHYS 5900 Class 12 (9/21/2009) Zi-Wei Lin Homework #2 will be available after this class and due in a week. 2.4 Lists Defining Lists Lists are sequences of Mathematica objects separated by commas and enclosed by curly brackets. The objects are usually, but not necessarily, of the same type. In[1]:= Solve @8 x^2 y == 0, x + y == 2 < , 8 x, y <D Out[1]= 88 y 1, x 1 < , 8 y 4, x →− 2 << In[2]:= Options @ Plot D Generating Lists We can use Table, Range, Array In[3]:= ? Table In[4]:= ? Range In[5]:= ? Array In[6]:= myTable = Table @ x^i + y^j, 8 i, 3 < , 8 j, 4 <D Out[6]= 99 x + y, x + y 2 ,x + y 3 + y 4 = , 9 x 2 + y, x 2 + y 2 2 + y 3 2 + y 4 = , 9 x 3 + y, x 3 + y 2 3 + y 3 3 + y 4 == In[7]:= Range @ 10, 10, 3 D Out[7]= 8 10, 7, 4, 1, 2, 5, 8 < In[8]:= Array @ c, 10 D Out[8]= 8 c @ 1 D ,c @ 2 D @ 3 D @ 4 D @ 5 D @ 6 D @ 7 D @ 8 D @ 9 D @ 10 D< In[9]:= cube @ x_ D : = x^3 In[10]:= cubeList = Array @ cube, 10 D Out[10]= 8 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000 < In[11]:= Table @ cube @ i D , 8 i, 10 <D Out[11]= 8 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000 <
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Displaying Lists We can use ColumnForm, MatrixForm, TableForm In[12]:= ColumnForm @ cubeList D Out[12]= 1 8 27 64 125 216 343 512 729 1000 In[13]:= ColumnForm @ myTable D Out[13]= 9 x + y, x + y 2 ,x + y 3 + y 4 = 9 x 2 + y, x 2 + y 2 2 + y 3 2 + y 4 = 9 x 3 + y, x 3 + y 2 3 + y 3 3 + y 4 = In[14]:= MatrixForm @ myTable D Out[14]//MatrixForm= x + yx + y 2 x + y 3 x + y 4 x 2 + 2 + y 2 x 2 + y 3 x 2 + y 4 x 3 + 3 + y 2 x 3 + y 3 x 3 + y 4 In[15]:= TableForm @ myTable D Out[15]//TableForm= x + + y 2 x + y 3 x + y 4 x 2 + 2 + y 2 x 2 + y 3 x 2 + y 4 x 3 + 3 + y 2 x 3 + y 3 x 3 + y 4 Determine sizes of Lists we can use Length, Dimensions, Count In[16]:= ? Length
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/25/2010 for the course PHYS 5900 taught by Professor Lin during the Fall '09 term at East Carolina University .

Page1 / 8

class12 - PHYS 5900 Class 12 (9/21/2009) Zi-Wei Lin...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online