That's alright, I'm so rusty with math, I think a log is something for the fireplace.
Originally Posted by unicorn
A very simple and straight forward approach would be something like: (in rough code)
All the above is good, but it may not ever resolve on y's value. Especially if the step value is not oh-so-tiny.
double step = *VERY* tiny incremental amount or step.
double y = incredibly small value. It MUST be less than y + step's real value.
y += step;
log y = -4.4132+0.0302y
}while (log y != -4.4132+0.0302y);
A more elaborate idea would be to have two loops, in separate functions. StepUp, would be the above loop, StepDown would be just like that do loop, EXCEPT the stop condition would be like:
Now you call these functions, and then give you an approximation for y, but not exact. Now you call those same functions back, but with much tighter granularity for step, for both functions.
}while (log y <= -4.4132+0.0302y);
and for StepDown:
y = incredibly large value. MUST be greater than y - step's real value.
y -= step; /* <--note the minus just before the = sign here */
}while (log y >= -4.4132+0.0302y);
Repeat calls to these functions, alternating back and forth, until y is resolved. Step would be come smaller and smaller after every run through of the two functions, and y's starting value would be raised by StepUp, and lowered by StepDown, each time through them, as well.