Diferente pentru blog/your-bisection-search-is-wrong intre reviziile #13 si #14

Nu exista diferente intre titluri.

Diferente intre continut:

Let's choose f(x) = x^3^ - c. f is continuous and x is the cubic root of c, when f(x) = 0. Thus, we can apply the bisection method.
== code(python) |
def cubicRoot(c): {
def cubicRoot(c):
  lo, hi = 0.0, c
  while lo * lo * lo != c:
    mid = (lo + hi) / 2;
    mid = (lo + hi) / 2
    if mid * mid * mid < c:
       lo = mid
    else:
def cubicRoot(c): {
  lo, hi = 0.0, c
  while lo * lo * lo != c:
    mid = (lo + hi) / 2;
    mid = (lo + hi) / 2
    if mid * mid * mid < c:
       lo = mid
    else:
bq. I'm curious, did your solution have any of these problems?
notes:
 
* Thanks Tomek for the feedback.
* We’ve addressed negative numbers, numbers in (0, 1), overflow problems, absolute and relative error problems.
* Instead of |(a - b) / b| < eps we can use |(a - b) / max(a, b)| < eps. Since a, b >=0 in our problem, we won’t get the nasty cases I was talking about previously, except for the c = 0 case.

Nu exista diferente intre securitate.

Topicul de forum nu a fost schimbat.