\(\(\(
\)\( (*Here\ are\ some\ experiments\ designed\ to\ indicate\ the\ idea\ of\ "order" . \ 
          The\ run\ time\ for\ an\ algorithm, 
say\ f \((n)\) is\ often\ a\ function\ with\ several\ terms*) \)\(
\)\(\ \ \)\( (*We\ want\ to\ compare\ f\ to\ a\ simpler\ function\ G . \ 
            This\ means\ that\ we\ want\ to\ find\ a\ constant
\ K\  > \ 
        0\ such\ that\ 
\ \ f \((n)\)\  ≤ \ 
        K\ *G \((n)\)\ 
except\ possibly\ for\ "small"\ values\ of\ n\ \((more\ precisely, \ 
              except\ for
finitely\ many\ values\ of\ n)\) . 
If\ this\ is\ the\ case, \ 
      we\ say
that\ f \((n)\)\ has\ the\ order\ of\ G \((n)\), \ in\ symbols, 
\ \ \ \ \ \ \ \ \ \ \ f \((n)\)\ is\ O \((G \((n)\))\)\ \ \ \ \ \ \ *) \)\(
\)\( (*Throughout\ the\ course\ the\ run - 
        time\ orders\ that\ show\ up\ repeatedly\ are\ 
log \((n)\), \ n, \ n*log \((n)\), \ 
      and\ n^2*) \)\(
\)\( (*For\ graphing\ purposes, \ 
      we\ think\ of\ f\ as\ a\ function\ of\ a\ real\ variable\ x, 
but\ in\ our\ programs\ x\ only\ takes\ on\ values\ of\ a\ positive\ integer\ n*) \)\(
\)\( (*Example\ 1*) \)\)\)

f[x_] :=  3  x^2  +  200  x  +  1000

g[x_] :=  50  x^2

Plot[{f[x], g[x]}, {x, 0, 20}]

N[Solve[f[x] == g[x], x]]

g[x_] :=  5  x^2

N[Solve[f[x] == g[x], x]]

Plot[{f[x], g[x]}, {x, 0, 150}]

f[x_] :=  3  x^2  +  10  x  +  30

g[x_] :=  5  x^2

NSolve[f[x] == g[x], x]

Plot[{f[x], g[x]}, {x, 0, 
        20}]

f[
      x]

g[x_] := 3.1  x^2

NSolve[f[x] == g[x], x]

Plot[{f[x], g[x]}, {x, 0, 10}]

Plot[{f[x], g[x]}, {x, 100000, 200000}]

f[x_] :=  3  Log[x]  + 6

g[x_] :=  4  Log[x]

Solve[f[x] == g[x], x]

N[%]

Plot[{f[x], g[x]}, {x, 0, 1000}]

f[x_] :=  3  Log[x]  +  50

Solve[f[x] == g[x], x]

(*It takes much longer for g (x) to overtake f (x) *)

(*Try a small value of K in a log example: *)

f[x_] :=  3 Log[x] + 6

g[x_] :=  3.1 Log[x]

Solve[f[x] == g[x], x]

(*It takes a long time for g (x) to overtake f (x)*)

f[x_] :=  2 x Log[x]  +  5  x  +  3

g[x_] :=  3 x Log[x]

NSolve[f[x] == g[x], x]

Plot[{f[x], g[x]}, {x, 1, 300}]

g[x_] :=  2.1 x Log[x]

NSolve[f[x] == g[x], x]

f[x_] :=  2 x Log[x]  +  50  x  +  300

g[x_] :=  3 x Log[x]

NSolve[f[x] == g[x], x]