f[1]:=0

f[a]:=b

?f

f[3]

head [ arg1, arg2, ]

Plot[Sin[x],{x,-Pi,Pi}]

{1, 2, a, 5} // FullForm

a+b // FullForm

expr[[ n]]

Plus[A, Times[4, b]][[2]]

Plus[A, Times[4, b]][[0]]

{1, 2, A}[[-1]]

expr[[{n1, n2, nm}]]

expr[[ n]][[ m]]

{{1, 2, 3}, {A, B, C}}[[2]][[3]]

3/a^2 + a/(2b^2)

% /. x_^2 -> x

%% // FullForm

FullForm[x_^2]

Clear[f]

f[a_Integer]:= a-1

f[5]

Head[u]

f[u]

f[1, 4]

f[a]:=a-1

f[5]

f[a]

aut=Automat[{1, 2, 3, 4}, {1 -> 2, 2 -> 3}]

States[a_]:=Length[a[[1]]]

States[5]

Clear[States]

States[a_Automat]:=Length[a[[1]]]

States[5]

States[aut]

IntegerQ[1]

IntegerQ[a]

IntegerQ[{a, 1}]

NumberQ[1]

NumberQ[3.5]

NumberQ[4/5]

NumberQ[Pi]

Pi > E

Pi > E //N

Clear[f]

f[x_?syma]:=1

f[_?syma]:=1

syma[x_]:=x===a

f[u]

syma[u]

f[a]

Clear[f]

f[x_Symbol?syma]:=x

f[1]

Head[1]

f[u]

f[a]

f[{u_List, n_Integer}]:=u[[n]]

f[{{A}, 1}]

f[A, 1]

f[{A, 1}, 2]

f[{A, 5}]

f[{{A, B}, 3}]

h[a|b]:=2

h[c]

h[a]

h[a]:=2

h[b]:=2

{a, b, c, d} /. {(a|c)->A}

{a[2],b[3],c[4],d[5]} /. {(f:(a|b))[x_]->r[f, x]}

f[1]:=1

f[n_ /; n>1]:=n f[n-1]

f[n_]:=n f[n-1] /; n>1

f[n_Integer]:=n f[n-1] /; n>1

f[n_]:=n f[n-1] /; IntegerQ[n] && n>1

f[n_Integer /; n>1]:=n f[n-1]

get[x_, n_:1]:=x[[n]]

get[{1, 2}]

get[{a, b}, 2]

get[{a, b}, 3]

Clear[get]

get[x_, n_:1]:=x[[n]] /; Length[x]>=n

get[{a, b}, 3]

get[{a, b}, E]

get[{a, b, c}, -2]

get[h[u, v], -3]

get[h[u, v], -2.6]

get[x_, n_Integer:1]:=x[[n]] /; Positive[n] && Length[x]>=n

get[x_, n_Integer?Positive:1]:=x[[n]] /; Length[x]>=n

get[x_, n:(_Integer?Positive):1]:=x[[n]] /; Length[x]>=n

Clear[h]

h[x__]:={x} /; Length[{x}]>2

h[a]

h[a, 1, b]

Clear[h]

h[x__]:={x} /; Length[x]>2

h[1, a, 2, b]

Clear[h]

h[x__Integer]:=x

h[a]

h[5]

h[5, 9]

h[{a_Integer, b_Integer, c_Integer, r___Integer}]:={a, b, c, r}

h[{1, 2}]

h[{1, 2, 3}]

h[{1, 2, 3, 4, 5, 6, 7}]

h[{a_Integer, b_Integer, c_Integer, r___Integer}]:=r

h[{1, 2, 3, 4, 5, 6, 7}]

h[x__, y__]:={x, y} /; Print[ x= x, y= y]

x1=x2+7; x2=7

x1

t:=0

x:=0 /; (t = t+1 ; t > 3)

x

x

x

x

h [e1, e2, en]

Clear[f]; Clear[g]

f[a_]:=a^2

g:=f

g[5]

f[arg1, argn]=rhs

f[arg1, argn]:=rhs

Clear[f]

f[{x_,y_}]:=x+y

Nest[f,{1,2},3]

Automat[1,0]:=4

Automat[1,1]:=3

Automat[2,0]:=1

Automat[2,1]:=3

Automat[3,_]:=4

Automat[4,_]:=2

evolve[aut_,initstate_,input_List]:= Fold[aut,initstate,input]

evolve[Automat,1,{0,0,1,1}]

Clear[f]

sq[x_]:=x^2

sq /@ Range[5]

f /@ {{1,2},{a,b}}

Map[f,{{1,2},{a,b}},{2}]

Map[f,{{1,2},{a,b}},2]

MapThread[f,{{a,b,c,},{1,2,3,}}]

Plus @@ Range[100]

And @@ {True, False, True}

Or @@ {True, False, True}

Thread[f[{1,2,3}]]

Thread[f[{a,b,c},{1,2,3}]]

Thread[f[{A,B,C},{a,b,c},{1,2,3}]]

Thread[f[a,{1,2,3},A]]

sq[x_]:=x^2

sq /@ {a,b}

(#^2)& /@ {a,b}

Nest[f, x, 3]

Clear[x]

Function[x, x/2][4]

Function[x, x/2][4, 6]

Function[x, x/2][x]

x=2; Function[x, x/2][x]

#/2 & [4]

#/2 & 6

pow[n_Integer] := Function[x, x^n]

pow[2]

% [4]

pow[3][3]

f[#]& /@ {a, b, c}

Inner[f, {a1, b1, n1 }, {a2, b2, n2},g]

Inner[Times, {a1,a2,a3}, {b1,b2,b3}, Plus]

Outer[f,{a, b, c}]

Outer[f, {a,b}, {1, 2, 3}]

Outer[f,{A,B},{1,2,3},{a,b}]

n:=12

forestList=Table[Random[Integer],{n}]

treeGrowIgnite[0]:=Floor[1+p-Random[]]

treeGrowIgnite[1]:=Floor[2+f-Random[]]

f:=0.3; p:=0.75

forestList=treeGrowIgnite /@ forestList

forestBurn[{a___,2,1,b___}]:=forestBurn[{a,2,2,b}]

forestBurn[{a___,1,2,b___}]:=forestBurn[{a,2,2,b}]

forestBurn[{1,a___,2}]:=forestBurn[{2,a,2}]

forestBurn[{2,a___,1}]:=forestBurn[{2,a,2}]

forestBurn[forestList]

%[[1]] /. 2->0

treeGrowIgnite /@ %

doForestCycle[forestList_List]:= forestBurn[treeGrowIgnite /@ l][[1]] /. 2->0

woodlife[n_Integer, m_Integer]:= Nest[doForestCycle, Table[Random[Integer],{n}],m]

forestBurn[l_List]:=l /. 2->0

?forestBurn

doForestCycle[l_List]:= forestBurn[treeGrowIgnite /@ l]

SetAttributes[treeGrowIgnite, Listable]

Clear[x]

SetAttributes[x, Listable]

x[{a,b,c}]

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

doForestCycle[l_List]:=forestBurn[treeGrowIgnite[l]]

woodLife[n_Integer, m_Integer]:= Nest[ ( # /.{0:>Floor[1+p-Random[]], 1:>Floor[2+f-Random[]]} //.{{a___,1,2,b___} -> {a,2,2,b}, {a___, 2, 1, b___} -> {a, 2, 2, b}, {1, a___, 2} -> {2, a, 2}, {2, a___, 1} -> {2, a, 2}} /. 2 -> 0 ) &, Table[Random[Integer],{n}], m ]

Head[5]

Head[4.2]

Head[{A,1}]

Head[Pi]

Exp[ Op[]+Op[] ]^:= Exp[Op[]] Exp[Op[]] /; Inner[Times,A,B,Plus]==0

Op[{a1, a2, a3}, {a2, a1+a3, a2}]

ToMatrix[op:Op[basic_List,image_List]] := Outer[project, basis,image]

project[a_, b_ + c__] := project[a,b] + project[a,c]

project[a_, n_ a_ ] := n

project[a_, a_] := 1

project[a_, b_] := 0

project[b_ +c_, a_] := project[b,a] + project[c,a]

Outer [project, {a1, a2, a3}, {a2, a1+a3, a2}]

HermiteQ[ Op[ b_List, i_List] ] := Module[ m=ToMatrix[ Op[b, i] ], Conjugate[Transpose[m]] == m ]

Op[ b_, i_] + Op[b_, j_] := Op[b, i+j]

Unprotect[Plus]

Op[b_, i_] + Op[b_, j_ ] := Op[b, i+j]

Protect[Plus]

??Plus

Dimension [Op [b_, _]] := Length [b]

?Dimension

Clear[Dimension]

Dimension[Op[b_,_]]^:= Length [b]

?Dimension

?Op

Op[b_, i_] + Op[b_, j_] ^:= Op [b, i+j ]

Lambda Op [b_, i_] ^:= Op[b, Lambda i]

EigenValues[op:Op[b_, i_]] ^:= Eigenvalues[ToMatrix[op]]

Clear[f]; Clear[g]; Clear[h]

g[ f[x_] ] ^:= gfup[x]

g[ f[x_] ] := gfdown[x]

f[ g[x_] ] := fg[x]

f[g[f[1]]]

f[g[h[1]]]

g[f[1]]

g[f[g[1]]]

g[f[x_]] ^:= gfup[x]

g[h_[x_]] := gdown[h, x]

$ContextPath

$Context

h[x_]:= 2x

?h

ToMatrix[l_List]:=l

?ToMatrix

<<LinOp.m