## Demonstration of various programming techniques for finding the root of a function f(x) in interval [a,b]

### Demonstration in matlab

 - *bisect.m*: very simple demo with manual zooming 
 - *bisect_vis.m*: bisection implemented and visualized.  
    Bisection point is chosen from 3 options: midpoint, linear, quadratic


### C++
Download the [zip](https://imsc.uni-graz.at/haasegu/Lectures/Kurs-C/SS26/Bisect.zip)

 - *Bisect1.cpp*: recursive bisection, f(x) is directly implemented in bisection function.  
   f(a)>0>f(b) is required.
 - *Bisect2.cpp* added: f(x) as global function used in bisection.  
    Accurracy `EPS` as global variable. **Dont't do that!**
 - *Bisect3.cpp* added: pass function f(x) as argument to bisection.
 - *Bisect3_counter.cpp* added: counter for nested bisections [thanks to Zahra Nazemian for asking].
   - `Bisect3()`: uses global variable `cnt_bisect` as counter.  
   (+) interface remains unchanged;  
   (-) dependency on global variables causes trouble in larger codes.
   - `Bisect3_while()`: non-recursive implementation of bisection and counter `cnt` as function parameter
 - *Bisect3_lambda.cpp* added: pass a lambda-function with additional arguments as f(x) to bisection without changing the interface.  
   Additional arguments can be, e.g., the coefficients of a polynom.
 - *Bisect4.cpp* added: no changing sign for fa, fb is required, no longer f(a)>0 required.
 - *Bisect5.cpp* added: choose f(x) from a predefined pool of functions.
 - *Bisect6.cpp* demonstration of function signature: 3 different bisection functions with differing parametre lists.
 - *Bisect7.cpp* added: array of functions. Use of map to assign function.
 - *Bisect7_dc.cpp* added: apllication to discontinuous function `dc`.

