Bisekce[f_,{x_,a_,b_},eps_]:=
    Module[{x2=N[a]-N[b], k=0, xmin=N[a], xmax=N[b]},
          If[(f/.x->xmin) (f/.x->xmax)>0,
                   Print[" Zadany interval nesplnuje podminku
                   f(a).f(b)<0"],
           While[(f/.x->xmin) (f/.x->xmax)<0  && Abs[xmax-xmin]>eps 
                  && Abs[f/.x->x2]>eps,
                    x2=(xmin+xmax)/2;
                    k=k+1;
                    If[(f/.x->xmin) (f/.x->x2)<0, xmax=x2, xmin=x2]
                ];
                 Print["Koren je v bode ", x2];
                 Print["Pocet iteraci je ", k]
            ]
          ]

Secna[f_,{x_,a_,b_},eps_]:=
    Module[{x2=N[b]-N[a], k=0, xmin=N[a], xmax=N[b]},
          If[(f/.x->xmin)*(f/.x->xmax)>0,
                   Print[" Zadany interval nesplnuje podminku
                   f(a).f(b)<0"],
           While[(f/.x->xmin)*(f/.x->xmax)<0  && Abs[xmax-xmin]>eps 
                  && Abs[f/.x->x2]>eps,
                   x2=xmin-(xmax - xmin)/
                      ((f/.x->xmax) - (f/.x->xmin))*(f/.x->xmin);
                   k=k+1; 
                   If[(f/.x->xmin)*(f/.x->x2)<0, xmax=x2,xmin=x2] 
                ];
                 Print["Koren je v bode ", x2];
                 Print["Pocet iteraci je ", k]
             ]
          ]


Newton[f_,{x_,a_,b_},eps_]:=
    Module[{k=0, x0=0, x1=(N[a]+N[b])/2,fd=D[f,x]},
           While[Abs[x1-x0]>eps && Abs[f/.x->x1]>eps,
                    x0=x1;
                    x1=x1-(f/.x->x1)/(fd/.x->x1);
                    k=k+1;
                ];
                Print["Koren je v bode ", x1];
                Print["Pocet iteraci je ", k]
          ]


PuleniInt[f_,{x_,a_,b_},n_]:=
    Module[{x2, k=0, xmin=N[a], xmax=N[b]},
          If[(f/.x->xmin) (f/.x->xmax)>0,
                   Print[" Zadany interval nesplnuje podminku
                   f(a).f(b)<0"],
           While[(f/.x->xmin) (f/.x->xmax)<0  && k<n,
              Print[" Interval, ve kterem je koren:  <",xmin," , ", xmax,">"];
                    x2=(xmin+xmax)/2;
                    k=k+1;
                    If[(f/.x->xmin) (f/.x->x2)<0, xmax=x2, xmin=x2]
                ];
             If[(f/.x->xmin) == 0, Print["Koren je v bode ",xmin],
                   If[(f/.x->xmax) == 0, Print["Koren je v bode ",xmax],
                                       Print["Koren je v bode ",x2]
                     ]
               ]
            ]
          ]



Iteracni[fi_,{x_,x0_},n_]:=
    Module[{k=0, xx=N[x0]},
           While[k<n,
                    k=k+1;
                    xx=fi/.x->xx; Print[k,".krok - koren= ",N[xx]];
                ]
          ]