SHOW:
|
|
- or go back to the newest paste.
1 | function nst = bisekt (a, b, eps, f) | |
2 | - | disp(a); |
2 | + | |
3 | - | disp(b); |
3 | + | |
4 | disp(f(a)); | |
5 | disp(f(b)); | |
6 | return; | |
7 | endif | |
8 | - | return; |
8 | + | |
9 | c = (a+b)/2; | |
10 | fc = f(c); | |
11 | if (abs(fc) < eps) | |
12 | nst = c; | |
13 | else | |
14 | if (fc > 0) | |
15 | nst = bisekt(c, b, eps, f); | |
16 | else | |
17 | - | nst = bisekt(c, b, eps, f); |
17 | + | nst = bisekt(a, c, eps, f); |
18 | endif | |
19 | - | nst = bisekt(a, c, eps, f); |
19 | + | |
20 | endfunction |