f[x_, 2 x_]:= x

{
f[Pi, 2 Pi],
f[2, 2 2],
f[Sin[1],2 Sin[1]],
f[x, 2x]
}//ColumnForm

Map[
FullForm,
{2 x_, 2 Pi, 2 2,2Sin[1],2 x}
]//ColumnForm

f[Pi, 4 Pi/2]

FullForm[4 Pi/2]

Exit[]

g[x_,y_/;y==2x]:= x

{
g[Pi, 2 Pi],
g[2, 2 2],
g[Sin[1],2 Sin[1]],
g[x, 2x]
}//ColumnForm

g[x_,y_]/;y==2x:= x

{
g[Pi, 2 Pi],
g[2, 2 2],
g[Sin[1],2 Sin[1]],
g[x, 2x]
}//ColumnForm

?f

f[ {x_} ] := Pi

f[ 4 ]

f[{4}]

f[{1,2,3}]

g[x_]

g[1,2,3]

f[fun_[x_]]:= fun[fun[x]]

f[Sin[3]]

f[Sin[3.]]

(t=Table[i j,{i,7},{j,4}])//MatrixForm

t

t[[1,2]]

f[a_^b_]

#^2 &

FullForm[#^2 &]

#^2 &[E]

Plot[#^3+Sin[#]-#&[t],{t,0,2 Pi}]

Function[{x,y},x^2+y^2]

Function[{x,y},x^2+y^2]//FullForm

Function[{x,y},x^2+y^2][a,4]

Plot3D[Function[{x,y},x^2+y^2][v,w],{v,-1,2},{w,-1,2}]

#1 + #2^2 &[a,b]

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

Length[{##}] &

Length[{##}] &[a,b,c,d,e]

Length[##] &[a,b,c,d,e]

Length[{##}] &[{a,b,c,d,e}]

Length[##] &[{a,b,c,d,e}]

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

h[Sin,3]

h[Sin,10][4]
h[Sin,10][4.]

Sin[4.]^10

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

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

Table[i j k w v,
{i,4.5},
{j,2,4},
{k,-1,1,.1},
{w, {a, b, 4,5,-3}},
{5}
]//Dimensions

letsPlot[f_,list_]:=
Plot[
Table[
h[f,i][x],
{i,list}
],
{x,0.,3}
]

letsPlot[# + 1/#&,{1,3,5,8}]

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

1st attempt

Clear[iter]

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

iter[f_,0]:=#&

iter[ Sin, 3]

iter[ Sin, 3][2.]

Sin[Sin[Sin[2.]]]

2nd attempt

Clear[iter]

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

iter[f_,0]:=#&

iter[ Sin, 3]

iter[ Sin, 3][2.]

3rd attempt

Clear[iter]

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

iter[f_,0]:=#&

iter[Sin,3]

iter[Sin,3][2.]

Clear[iter]

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

iter[f_,0]:=#&

iter[Sin,3]

iter[Sin,3][2.]

iter[Sin,13][2]

?Nest

?iter

Plot[iter[Sin,10][t],{t,0,4 Pi}]

g[x_]:=Sin[.5 x^2]

Union[{a,b,c,d},{1,2,3}]

Union[{a,b,c,5,d,a},{1,2,a,3},{a,a,a,1,2,3,4}]

gaux[x_]:=(evals=Union[evals,{x}]; g[x])

evals={};

pl=Plot[gaux[x],{x,0,2Pi},PlotStyle->Yellow, Background->Brown,PlotRange->{-.5,1}]

evals//Length

evals//Short

(* Show, Graphics *)

Show[
Graphics[
{Point[{1,2}],
Point[{2,2}]}
],Axes->True, AxesOrigin->{0,0}
]

Options[Graphics]

evals//Short

Clear[f]

Map[
Point[{#,g[#]}]&,
evals]//Short

pt=Graphics[{
AbsolutePointSize[1],Blue,
Map[
Point[{#,g[#]}]&,
evals]
}
]

Show[{pl,pt}]

pt=Graphics[
Map[
{AbsolutePointSize[1],Blue,Point[{#,g[#]}]}&,
evals]
]

g3D[x_,y_]:=Sin[x^2+y^2]

g3Daux[x_,y_]:=(evals3D=Union[evals3D,{{x,y}}];g3D[x,y])

evals3D={};

Plot3D[g3Daux[v,w],{v,0,3 Pi/2},{w,0,Pi},PlotPoints->30,BoxRatios->Automatic]

Length[evals3D]

evals3D//Short

{x,y}

g[x,y]

Map[
Point[{#[[1]],#[[2]] , Apply[g3D,#]}]&,
evals3D
]

Graphics3D[Map[{AbsolutePointSize[1.2],
Point[{#[[1]],#[[2]] , Apply[g3D,#]}]}&,
evals3D
]]