Inv romberg
Jump to navigation
Jump to search
inv_romberg
Syntax
$right_hand_endpoint = inv_romberg($rf_func, $left_hand_endpoint, $value) ;
Params
$rf_func
refers to a subroutine of one variable defining the function.$left_hand_endpoint
is the left hand endpoint of the integral.$value
is the desired value for the integral.
Returns
A number representing the right hand endpoint of the interval whose definite integral has the desired value.
Examples
$b = inv_romberg(sub { my $x=shift; (1/sqrt($PI) )*exp(-$x**2); }, 0, 1/4);
# find the upper limit b so that the area under the normal distribution on the inteval between 0 and b is 1/4.
Notes
Can be used, for example, to find intervals under a normal distribution curve that have a desired value. Used in many statistics problems.