Exit[]

Pure Functions

Other function definitions:  "Function"  and  "# &"

Function[{x},x^2] is the definition.   [3] is the argument.

Function[{x},x^2]

Function[{x},x^2][3]

f1=Function[{x,y},Sin[x^2+y^2]/Sqrt[(x^2+y^2)]];

f1[3,4]

Plot3D[Function[{x,y},Sin[x^2+y^2]/Sqrt[(x^2+y^2)]][x,y],
{x,0,Pi},
{y,0,Pi}
]

Plot3D[Sin[x^2+y^2]/Sqrt[(x^2+y^2)],
{x,0,Pi},
{y,0,Pi}
]

As before, #^2 & is the function definition,  [3] is the argument.

#^2&

#^2&[3]

a

#^3-#^2&[a]

#2 refers to the second input argument

#2&[2,3]

#2&[3]

## catches the entire list of arguments

2{##}&[2,3,a,b]

Length[{##}]&[2,3,a,b]

(*
{a1,x1}, {a2,x2} ....
->
Point[{Abs[a1],x1}], Point[{Abs[a2],x2}], ...
*)

pt[{x_,y_}]:=Point[{Abs[x],y}]

pt[{a,b}]

Point[{Abs[#[[1]]],#[[2]]}]& [{a,b}]

Point[{Abs[#1],#2}]& [a,b]

Plot3D[Cos[#1]+Sin[#1 #2]&[x,y],{x,0,Pi},{y,0,Pi}]

Plot3D[Cos[x]+Sin[x y],{x,0,Pi},{y,0,Pi}]

h[f_,k_Integer]:=f[#]^k&

h[Sin,3]

Sin[2.]^10

h[Sin,10][2.]

{h[Sin,2][1.3],Sin[1.3]^2}

Plot[{
h[# Sin[#]&,1][x],
h[#Sin[#]&,2][x],
h[#Sin[#]&,3][x]
},
{x,-2,3},
AspectRatio->Automatic]

Table[exp i + j,{i,{a,b,-1,10}},{j,2,3,.5},{2}]//Dimensions

M[i_,i_]:=

M[i_,j_]:=

Table[M[i,j],{},{}]

Plot[
Table[
h[# Sin[#]&,i][x],
{i,3}],
{x,-2,3}]

letsPlot[f_,n_]:=
Plot[
Table[
f[x]^i,
{i,n}],
{x,-2,3}]

letsPlot[Sin,4]

letsPlot[f_,list_]:=
Plot[
Table[
f[x]^i,
{i,list}],
{x,-2,3}]

letsPlot[Sin,{1,3,5,15}]

(*
iter[f_,n_]:=   
f[f[f[...f[#]]]]& 
*)

Clear[iter]

iter[f_,n_]:= 
f[iter[f,n-1]]

iter[Sin,3]

iter[f_,1]:= f

iter[Sin,3][2]

iter[Sin,3][2.]

Clear[iter]

iter[f_,1]:= f[#]&

iter[f_,n_]:=
f[iter[f,n-1]]

iter[Sin,3][2.]

iter[f_,n_]:=
f[iter[f,n-1][#]]&

iter[Sin,3][2.]

Sin[Sin[Sin[2.]]]

iter[#+1/#&,2][.2]

Plot[iter[Sin[#]&,10][x],{x,0,6Pi}]

letsPlotIter[f_,list_]:=
Plot[
Table[
iter[f,i][x],
{i,list}],
{x,-2 Pi,4 Pi}]

letsPlotIter[Sin, {1,2,4,10}]

Lists

{a,b,c,d,e,f}

l = {a,b,c,4,Pi,,{},-3.5}

ColumnForm[l]

FullForm[l]

TreeForm[l]

l

l[All]

l[[All]]

l[[1]]

First[l]

l[[0]]

Rest[l]

l[[-1]]

Last[l]

l[[Length[l]]]

Length[l]

l[[8]]
l[[9]]

Table[0,{9}]

Table[Sqrt[i],{i,10}]

Table[i^i,{i,5,10}]

Table[i,{i,15,-10,-1}]

Table[i^2,{i,{"t","h","e","s","e",,"a","r","e",,Sqrt[12],"entries"}}]

Table[i,{i,Pi/3,Sqrt[Pi],Pi/E^3}]

Table[i,{i,Pi/3,4.45,Pi/E^3}]

Table[i,{i,Pi/3.,N[Sqrt[Pi]],Pi/E^3}]

Table[Sin[i^2],{i,-5,14,.2}]//Length

l0=Table[RandomInteger[10],{6}]

?RandomInteger

RandomInteger[{0,10},6]

Table[Exp[-i Pi j],{j,l0}]

Table[f[Pi],{f,{Sin,Cos,Exp,g,#^2&}}]

Range[5]

Range[Pi,3/2Pi,1/10]

Array[g,6]

?Range

?Array

Table[i+j,{i,3},{j,Pi,2Pi,Pi/4}]//MatrixForm

Table[i+j,{i,3},{j,Pi,2Pi,Pi/4}]//TableForm

Table[{i,j,i+j},{i,Pi,2Pi,Pi/4},{j,3}]//Dimensions

M={{1,2,3,4},{5,6,7,8},{9,10,11,12}};

M//MatrixForm

M=Table[((Subscript[A, i])^j),{i,1,5},{j,1,6}]

{{(Subscript[A, 1]),(Subscript[A, 1]^2),(Subscript[A, 1]^3),(Subscript[A, 1]^4),(Subscript[A, 1]^5),(Subscript[A, 1]^6)},{(Subscript[A, 2]),(Subscript[A, 2]^2),(Subscript[A, 2]^3),(Subscript[A, 2]^4),(Subscript[A, 2]^5),(Subscript[A, 2]^6)},{(Subscript[A, 3]),(Subscript[A, 3]^2),(Subscript[A, 3]^3),(Subscript[A, 3]^4),(Subscript[A, 3]^5),(Subscript[A, 3]^6)},{(Subscript[A, 4]),(Subscript[A, 4]^2),(Subscript[A, 4]^3),(Subscript[A, 4]^4),(Subscript[A, 4]^5),(Subscript[A, 4]^6)},{(Subscript[A, 5]),(Subscript[A, 5]^2),(Subscript[A, 5]^3),(Subscript[A, 5]^4),(Subscript[A, 5]^5),(Subscript[A, 5]^6)}}

M=Table[(Subscript[A, i,j]),{i,1,5},{j,1,6}]

Inverse[M]//MatrixForm

MatrixForm[M]

M[[1]]

M[[-2]]

M[[1]][[3]]

M[[1,3]]

Part[M,1,3]

{1,2,34,4}[[1,2]]

(x+y+z)[[2]]

M[[{1,3}]]//MatrixForm

M[[1;;3]]

M[[3,All]]

M[[All,3]]

M[[2;;-2]]

M[[2;;3,2;;3]]

M

Transpose[M]//MatrixForm

Length[M]

Length[M//Transpose]

Dimensions[M]

M={{1,2,3},{4,5,6,10},{7,8,9}}//MatrixForm

{a,b,c}
{{a},{b},{c}}
{{a,b,c}}

Transpose[{{a,b,c}}]

Transpose[{a,b,c}]

Quick detour into visualization.

ListPlot[
Table[Sin[i^2],{i,-5,4,.02}]
]

Table[{i,Sin[i^2]},{i,-5,4,1}]

ListPlot[%]

ListPlot[
Table[{i,Sin[i^2]},{i,-5,4,.02}]
]

Plot[Sin[x^2],{x,-5,4}]

l = {a,b,c,4,Pi,,{},-3.5}

Take[l,3]

Take[l,-3]

Take[l,{-3}]

Take[l,{-4,-2}]

Drop[l,-3]

Reverse[l]

Clear[m]

m = {Pi,2,{1,Pi},c,d}

TreeForm[m]

l

m

Join[l,m]

Join[m,l]

Union[l,m]

Length[l]+Length[m]==Length[Union[l,m]]

Intersection[l,m]

Append[l,m]

Prepend[l,m]

m//ColumnForm

ReplacePart[m,{x,y,z},2]//ColumnForm

m

m//ColumnForm

(m = ReplacePart[m,{x,y,z},{3,1}])//ColumnForm

m//ColumnForm

(m1=Insert[m,{1,2,3,4},-1])//ColumnForm

(m2=Insert[m1,{-1,-2,-3,-4},1])//ColumnForm

Delete[m2,{4,2}]//ColumnForm

m2

TreeForm[m2]

Flatten[m2]

Flatten[m2]//TreeForm

Flatten[m2,1]

Flatten[m2,1]//TreeForm

m2

FlattenAt[m2,{4,1}]//TreeForm

FlattenAt[m2,{4,1}]