pyrex.RayTracer.angle_search¶
-
static
RayTracer.
angle_search
(true_r, r_function, min_angle, max_angle, tolerance=1e-12, max_iterations=100)¶ Calculates the angle where r_function (angle) == true_r.
Runs the brentq root-finding algorithm on r_function with an offset of true_r to find the angle at which they are equal.
- Parameters
- true_rfloat
Desired value for the radial distance.
- r_functionfunction
Function to calculate the radial distance for a given launch angle.
- min_anglefloat
Minimum allowed angle for the r_function.
- max_anglefloat
Maximum allowed angle for the r_function.
- tolerancefloat, optional
Tolerance in the root value for convergence.
- max_iterationsint, optional
Maximum number of iterations the root finder will attempt.
- Returns
- float
The launch angle which will satisfy the condition r_function (angle) == true_r.
- Raises
- RuntimeError
If the root finder doesn’t converge.