SetDirectory["FileName" /. NotebookInformation[
              EvaluationNotebook[]] /. FrontEnd`FileName[
              d_List, nam_, ___] :> 
            ToFileName[d]];
Off[General::"spell1"];

ClearAll[f];
f[x_] := Sin[(x^2)];
Plot[f[x], {x, 0, 2  Pi}, 
        AxesLabel -> {"x", "f[x]"}];

ClearAll[p];
p[f_, r_] := 
        Plot[Evaluate[f[x]], {x, -r, r}, 
          AxesLabel -> {"x", "f[x]"}, 
          PlotStyle -> {Hue[0], Thickness[0.008]}, 
          PlotRange -> All, 
          PlotPoints -> 100];
p[f, Pi];

ClearAll[MyAbs];
MyAbs[x_] := x /; x ≥ 0;
MyAbs[x_] := -x /; x < 0;
p[MyAbs, Pi];

ClearAll[g];
g[x_] := 
        1 - MyAbs[x] /; -1 < x ≤ 
            1;
g[x_] := 
        g[x + 2] /; x ≤ -1;
g[x_] := g[x - 2] /; x > 1;
p[g, 5];

Trace[g[1.2]]

ClearAll[f];
f[x_Real] := Sin[x];
f[x_Integer] := 5;
f[0.1]
f[0]
f[0. ]

?Positive

ClearAll[f];
f[x_?Positive] := Sin[x];
f[x_?Negative] := 5;
f[0]
p[f, Pi];

ClearAll[HorniMez, integrand];
integrand[x_] = Exp[-(x^2)];
HorniMez[danyint_] := 
        Module[{int = 0, krok, x = 0. , minΔx = (10^(-4)), 
            maxΔx = (10^(-6))}, 
          While[danyint ≥ int, 
            krok = maxΔx*Tanh[danyint - int] + 
                minΔx; 
            int = int + 
                (krok/6)*(integrand[x] + 4*integrand[x + krok/2] + 
                      integrand[x + krok]); x = x + krok]; 
          x];

HorniMez[0.8]
NIntegrate[integrand[x], {x, 0, %}]

ClearAll[f];
\(\(f := Sin[#\^2] &;\)\)
p[f, Pi];

ClearAll[f];
f[x_?(# ≥ 0 &)] := 
        Sin[x];
f[x_?(# < 0 &)] := 5;
p[f, Pi];

ClearAll[f];
f := #(1^2) - #(2^2) &;
Plot3D[f[x, y], {x, 0, 1}, {y, 0, 1}, 
        AxesLabel -> {"x", " y", "f[x,y]  "}];

listik = {1, 2, {4}, {5, {auto}}};
listik[[0]]
listik[[-1]]
listik[[-1, -1, 0]]

listik = Table[Random[], {10}]
Length[listik]
Union[listik]
Select[listik, # > 0.5 &]
Cases[listik, x_?(# > 0.5 &)]

expr = 
        (1/4) + c + (E^(-(x^2))) + Exp[(y^3)] + (u^4) + 
          (w^((5^x))) + (1/(z^2));
FullForm[expr]
\(Cases[expr, x_\^y_]\)
\(Cases[expr, a_\^b_, {0, ∞}]\)

xmin = -5;
xmax = 5;
krokx = 0.2;
data = 
        Table[{x, (x^2) + x*Random[]}, {x, xmin, xmax, 
            krokx}];
pl1 = 
      ListPlot[data, AxesLabel -> {"x", "f[x]"}, 
        PlotStyle -> {PointSize[0.02]}]
ClearAll[interp];
interp[x_] = Interpolation[data][x];
pl2 = p[interp, xmax];
Show[pl1, pl2];

ClearAll[nahr];
nahr[x_] = Fit[data, {1, x, (x^2)}, x];
p[{nahr[#], interp[#]} &, xmax];

<< Statistics`NonlinearFit`;
data = 
        Table[{x, 2*Exp[-3*(x^2)] + x + Random[] - 0.5}, {x, xmin, xmax, 
            krokx}];
NonlinearFit[data, a*Exp[-b*(x^2)] + c*x + d, 
      x, {a, b, c, d}]

ClearAll[f];
f[x_] := Sin[(x^3)]
D[f[x], x]
f'[x]

Plot[f'[x], {x, 0, 1}]

Plot[D[f[x], x], {x, 0, 1}]

Sin'

DSolve[{y''[x] + y[x] == Sin[314  x], 
        y[xmin] == 0, y'[xmin] == 1}, y[x], x]

res = 
      NDSolve[{y''[x] + y[x] == Sin[314  x], 
          y[xmin] == 0, y'[xmin] == 1}, 
        y[x], {x, xmin, xmax}]
reseni[x_] = y[x] /. res[[1]]
p[reseni, xmax];

Nest[Cos, x, 5]

NestList[Cos, x, 5]

NestList[Cos, 0. , 15]

NestList[Cos, 0. , 50] // 
        ListPlot[#, PlotStyle -> {Hue[0], PointSize[0.02]}, 
            PlotRange -> All] &;

Nesting

?NestWhileList

f =. ; f[x_] = (x^2)*Sin[x] + 3*x*Cos[x]; 
    Plot[f[x], {x, 0, 2  Pi}, 
      AxesLabel -> {"x", "f[x]"}]

NewtonianStep[x_] = x - f[x]/(f')[x]; x0 = 4. ; n = 5; 
    NestList[NewtonianStep, x0, n]

NestWhileList[NewtonianStep, x0, Abs[f[#]] > (10^(-6)) &]

NestWhileList[NewtonianStep, x0, Unequal, All]

NestWhileList[NewtonianStep, x0, (Abs[#1 - #2] > (10^(-6))) &, 
      2]

startPoints = 
      Solve[(x^3) == 1. ] /. {Rule[u_, v_]} -> {Re[v], 
            Im[v]}

Step[Q_] :=  .5*(Q + startPoints[[Random[Integer, {1, 3}]]]); 
    data = NestList[Step, {0, 0}, 10000];

ListPlot[data, AspectRatio -> Automatic]

obj0 = {Line[{{0, 0}, {0, 1}}]};k =  .65;T[obj_, t_]:=obj/.Line[{u_, v_}]:>Sequence[Line[{v,v+k*(({{Cos[t], Sin[t]}, {-Sin[t], Cos[t]}})).(v - u)}],Line[{v,v+k*(({{Cos[t], -Sin[t]}, {Sin[t], Cos[t]}})).(v - u)}]];newobj = NestList[T[#, Pi/2] &, obj0, 11];Show[Graphics[newobj], PlotRange -> All, 
        AspectRatio -> Automatic];