## Please enable JavaScript to view this site.

This guide is for an old version of Prism. Browse the latest version or update Prism
 How Prism interpolates

If you ask Prism to compute Y for a given X, it does so by evaluating the equation that defines the curve. That is very straightforward.

If you ask Prism to compute X for a given Y, it is more complicated. Prism does not try to solve the equation algebraically but rather does the interpolation numerically. The results are accurate to at least 6-7 decimal places.

Prism decides on the range of X values to consider. To allow for extrapolation a bit beyond the range of the data, Prism creates an interpolation/extrapolation range that includes the range of the data, and extends in each direction by a distance equal to half the difference between Xmax and Xmin. There are two special cases. When all the data are positive (or zero), that range is clipped to exclude negative numbers. Similarly, when the data are all negative (or zero), the interpolation/extrapolation range is clipped to exclude positive numbers.

Prism then divides that interpolation/extrapolation range into 1000 line segments.

For each value to be interpolated or extrapolated, Prism first tries to interpolate within the range of the X values of the data.

1.It starts with the lowest X value (scans from left to right on the graph). If more than one line segment includes the Y value, Prism only finds the first (lowest X value).

2.Prism then interpolates within that line segment to determine X as accurately as possible. In most cases, it does this by binary bisection. It divides the segment in half and figures out which contains Y. Then it divides that half in half again. And again. This continues until X is determined as accurately as possible given the numerical precision of the computer. In rare cases, it is possible that Y is not monotonic within the range determined in step 1. In this case, Prism uses linear interpolation rather than binary bisection.

If Prism is not able to interpolate a Y value that corresponds to the entered X value within the X range of the data, it will try to extrapolate a value to the extended range mentioned above. It first looks at X values below the minimum X value in the data, and then at X values above the maximum X value in the data.

When Prism interpolates a value (the X value is in the range of the data), it will also compute a confidence interval if you request it to do so. It does this by determining where the two confidence bands intersect the Y value you entered. When Prism extrapolates a value from the curve, it will not compute a confidence interval for that extrapolated value.