Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Update description of the Cauchy cdf and its complement. #1237

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions doc/distributions/cauchy.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -105,28 +105,23 @@ In the following table __x0 is the location parameter of the distribution,

[table
[[Function][Implementation Notes]]
[[pdf][Using the relation: ['pdf = 1 / ([pi] * [gamma] * (1 + ((x - __x0) / [gamma])[super 2]) ]]]
[[pdf][Using the relation: ['pdf = 1 / ([pi] * [gamma] * (1 + ((x - __x0) / [gamma])[super 2])) ]]]
[[cdf and its complement][
The cdf is normally given by:

[expression p = 0.5 + atan(x)/[pi]]

But that suffers from cancellation error as x -> -[infin].
So recall that for `x < 0`:

[expression atan(x) = -[pi]/2 - atan(1/x)]
Instead, the mathematically equivalent expression based on the function atan2
is used:

Substituting into the above we get:
[expression p = atan2(1, -x)/[pi]]

[expression p = -atan(1/x) / [pi] ; x < 0]
By symmetry, the complement is

So the procedure is to calculate the cdf for -fabs(x)
using the above formula. Note that to factor in the location and scale
parameters you must substitute (x - __x0) / [gamma] for x in the above.
[expression q = atan2(1, x)/[pi]]

This procedure yields the smaller of /p/ and /q/, so the result
may need subtracting from 1 depending on whether we want the complement
or not, and whether /x/ is less than __x0 or not.
]]
[[quantile][The same procedure is used irrespective of whether we're starting
from the probability or its complement. First the argument /p/ is
Expand Down
Loading