Kurs Komputerowy S
System Symboliczny
Mathematica

Dodatek

Struktura

FullForm[]
TreeForm[]
Timing[]
Apply[]

w=3x^2+5x-4

FullForm[w]

w[[1]]

w[[2]]

w[[2,1]]

w[[3,2,1]]

w[[0]]

w[[0]]=List

w

FullForm[w]

TreeForm[w]

a=2x

Apply[Power,a]

Apply[List,%]

b=Range[50000];

Timing[Sum[b[[i]],{i,1,Length[b]}]]

Timing[Apply[Plus,b]]

a=Table[x[i],{i,1,10}]
n=7

Timing[Prepend[Map[Rest,Rest[Apply[List,Expand[(2(1+Apply[Plus,a]))^n]]]],1]][[1]]

x=Table[{RandomInteger[5],RandomInteger[5]},{4},{4}]

ListPlot[x]

Graphics[Map[Point,x]]

Graphics[Apply[Line,{Flatten[x,1]}]]

Pakiety

BeginPackage[]
    czesc publiczna
Begin[]
    czesc prywatna
End[]
EndPackage[]

SetDirectory["e:\\kks\\2009"]

FilePrint["spirograph.m"]

<<spirograph.m

?Spirograph`*

Context[]

Context[SpirographIn]

SpirographIn[20,17,3]

FilePrint["a.m"]

<<a.m

?SpirographIn

?Spirograph`SpirographIn

Clear[a,b]

SpirographIn[{a,b,c},{d,e,f}]

SpirographOut[{a,b,c},{d,e,f}]

Spirograph`SpirographOut[10,8,2]