3 ms·
This doesn't work if the output of the function you're checking is a noisy black box. For example, if fn() creates a finite element model, analyses it with an e
by sparky_z 11y ago
This doesn't work if the output of the function you're checking is a noisy black box. For example, if fn() creates a finite element model, analyses it with an external software package, and post-processes the results to get an output value, you're gonna need a pretty high tolerance for your stopping condition.
- anon4 11y agoWell, he did say if the function is smooth and you have a reasonably small interval to start from.
- jwmerrill 11y agoIf your function isn't a mathematical function (i.e. its output is not completely determined by its arguments), then it's a little confusing to figure out what isolating a root would mean. But even in that case, bisect_root terminates, because it always halves the interval at each step, even if your input procedure is returning nonsense. Witness julia> bisect_root((x) -> rand() - 1/2, 1.0, 2.0) (1.1980511149266218,1.198051114926622) julia> bisect_root((x) -> rand() - 1/2, 1.0, 2.0) (1.595600613503659,1.5956006135036591)
- sparky_z 11y ago"...it's a little confusing to figure out what isolating a root would mean. " Well, to take an example from some of my past work as a structural engineer, say you wanted to find out how much wind load a structure could sustain until it buckled under its own weight. So you create a finite element model of the structure that applies the wind load and then ramps up the gravity until the structure fails. The input is the magnitude of the wind pressure. The output is the total gravity at failure (in units of g). subtract 1 from the output, and you have a function where the root is the level of wind load you're looking for. You're point about it always terminating when you use the bisection method is well taken, however. I was using a hybrid that included some Newton's method iterations to reduce the total number of steps, since each "function evaluation" took a lot of computer time.