kriukov / interval-methods

GNU General Public License v3.0
0 stars 2 forks source link

Krawczyk quits with "division by thin zero" error when derivative is 0 at midpoint of interval #5

Open kriukov opened 9 years ago

kriukov commented 9 years ago

Example:

f(x) = -2.001 + 3x - x^3 a = Interval(-4, 2)

Changing the midpoint helps. Needs implementation.

dpsanders commented 9 years ago

What do you mean by "changing the midpoint helps"? What would the implementation be?

kriukov commented 9 years ago

If we grow one of the ends of the original interval once by a tiny amount (like in the Newton algorithm), the midpoint will change by half of that amount and will no longer cause a problem.

dpsanders commented 9 years ago

On Mon, Oct 6, 2014 at 6:01 PM, kriukov notifications@github.com wrote:

If we grow one of the ends of the original interval once by a tiny amount (like in the Newton algorithm), the midpoint will change by half of that amount and will no longer cause a problem.

I do not like that solution. I think you can just check if the mid-point is zero, and choose a different point if it is. I don't think the user should have to fiddle with the interval they want to use if the algorithm throws a random, strange error.

— Reply to this email directly or view it on GitHub https://github.com/kriukov/interval-methods/issues/5#issuecomment-58113599 .

http://sistemas.fciencias.unam.mx/~dsanders

Cubículo / office: #414, 4o. piso del Depto. de Física

Tel.: +52 55 5622 4965

kriukov commented 9 years ago

I implemented the check and if the midpoint is zero, it takes a different value. It passes the tests.

David Sanders wrote:

On Mon, Oct 6, 2014 at 6:01 PM, kriukov notifications@github.com wrote:

If we grow one of the ends of the original interval once by a tiny amount (like in the Newton algorithm), the midpoint will change by half of that amount and will no longer cause a problem.

I do not like that solution. I think you can just check if the mid-point is zero, and choose a different point if it is. I don't think the user should have to fiddle with the interval they want to use if the algorithm throws a random, strange error.

— Reply to this email directly or view it on GitHub

https://github.com/kriukov/interval-methods/issues/5#issuecomment-58113599

.

http://sistemas.fciencias.unam.mx/~dsanders

Cubículo / office: #414, 4o. piso del Depto. de Física

Tel.: +52 55 5622 4965

— Reply to this email directly or view it on GitHub https://github.com/kriukov/interval-methods/issues/5#issuecomment-58114018.