Skip to content

Commit 8a91100

Browse files
fix: updated the reviewed changes
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: missing_dependencies - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: passed - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed ---
1 parent ad2a113 commit 8a91100

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

lib/node_modules/@stdlib/stats/base/dists/cauchy/quantile/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ for ( i = 0; i < 10; i++ ) {
149149

150150
<!-- /.examples -->
151151

152-
<!-- /.examples -->
153-
154152
<!-- C interface documentation. -->
155153

156154
* * *
@@ -179,7 +177,7 @@ for ( i = 0; i < 10; i++ ) {
179177

180178
#### stdlib_base_dists_cauchy_quantile( p, x0, gamma )
181179

182-
Evaluates the [quantile function][quantile-function] of a [Cauchy][cauchy-distribution] distribution with location parameter x0 and scale parameter gamma.
180+
Evaluates the [quantile function][quantile-function] of a [Cauchy][cauchy-distribution] distribution with location parameter `x0` and scale parameter `gamma`.
183181

184182
```c
185183
double out = stdlib_base_dists_cauchy_quantile( 0.3, 2.0, 2.0 );
@@ -188,7 +186,7 @@ double out = stdlib_base_dists_cauchy_quantile( 0.3, 2.0, 2.0 );
188186

189187
The function accepts the following arguments:
190188

191-
- **p**: `[in] double` probability
189+
- **p**: `[in] double` probability.
192190
- **x0**: `[in] double` location parameter.
193191
- **gamma**: `[in] double` scale parameter.
194192

@@ -226,18 +224,18 @@ static double random_uniform( const double min, const double max ) {
226224
}
227225
228226
int main( void ) {
229-
double p;
230227
double gamma;
231228
double x0;
232229
double y;
230+
double p;
233231
int i;
234232
235233
for ( i = 0; i < 25; i++ ) {
236234
p = random_uniform( 0.0, 1.0 );
237235
x0 = random_uniform( 0.0, 10.0 ) - 5.0;
238236
gamma = random_uniform( 0.0, 20.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
239237
y = stdlib_base_dists_cauchy_quantile( p, x0, gamma );
240-
printf( "x0: %lf, gamma: %lf, F(x0;gamma): %lf\n", x0, gamma, y );
238+
printf( "p: %lf, x0: %lf, γ: %lf, Q(p;x0,γ): %lf\n", p, x0, gamma, y );
241239
}
242240
}
243241
```

lib/node_modules/@stdlib/stats/base/dists/cauchy/quantile/examples/c/example.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ static double random_uniform( const double min, const double max ) {
2727
}
2828

2929
int main( void ) {
30-
double p;
3130
double gamma;
3231
double x0;
3332
double y;
33+
double p;
3434
int i;
3535

3636
for ( i = 0; i < 25; i++ ) {
3737
p = random_uniform( 0.0, 1.0 );
3838
x0 = random_uniform( 0.0, 10.0 ) - 5.0;
3939
gamma = random_uniform( 0.0, 20.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
4040
y = stdlib_base_dists_cauchy_quantile( p, x0, gamma );
41-
printf( "x0: %lf, gamma: %lf, F(x0;gamma): %lf\n", x0, gamma, y );
41+
printf( "p: %lf, x0: %lf, gamma: %lf, Q(p;x0,gamma): %lf\n", p, x0, gamma, y );
4242
}
4343
}

lib/node_modules/@stdlib/stats/base/dists/cauchy/quantile/include/stdlib/stats/base/dists/cauchy/quantile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
* Returns the differential quantile of a Cauchy distribution.
30+
* Returns a quantile function for a Cauchy distribution with probaility `p`, location parameter `x0` and scale parameter `gamma`.
3131
*/
3232
double stdlib_base_dists_cauchy_quantile( const double p, const double x0, const double gamma );
3333

lib/node_modules/@stdlib/stats/base/dists/cauchy/quantile/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#include "stdlib/constants/float64/pi.h"
2323

2424
/**
25-
* Returns the differential entropy of a Cauchy distribution.
25+
* Evaluates the quantile function for a Cauchy distribution with probability `p`, location parameter `x0` and scale parameter `gamma`.
2626
*
27-
* @param p input value
27+
* @param p input probability
2828
* @param x0 location parameter
2929
* @param gamma scale parameter
3030
* @return evaluated entropy

lib/node_modules/@stdlib/stats/base/dists/cauchy/quantile/test/test.native.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', op
101101
t.end();
102102
});
103103

104-
tape( 'the function evaluates the quantile function at `p` given `x0` and `gamma` ( large `gamma`)', opts, function test( t ) {
104+
tape( 'the function evaluates the quantile function at `p` given `x0` and `gamma` (large `gamma`)', opts, function test( t ) {
105105
var expected;
106106
var gamma;
107107
var delta;
@@ -138,6 +138,29 @@ tape( 'the function evaluates the quantile function at `p` given `x0` and `gamma
138138
var y;
139139
var i;
140140

141+
/*
142+
* Higher tolerance than EPS because Julia gives slightly different results for
143+
* |x| ~<= 3*pi/4:
144+
*
145+
* Example 1:
146+
* x = -1.35646279095478;
147+
* Julia (tan): -4.593961172862999
148+
* stdlib (tan): -4.593961172863
149+
* Mathematica: -4.59396117286300026311049650877442413097818001966176559315
150+
*
151+
* Example 2:
152+
* x = 1.4710248292410089
153+
* Julia (tan): 9.989623320530624
154+
* stdlib (tan): 9.989623320530626
155+
* Mathematica: 9.989623320530629158499137574831736702146195199133529403233
156+
*
157+
* Example 3:
158+
* x = 1.528545878614728
159+
* Julia (tan): 23.654302824341386
160+
* stdlib (tan): 23.65430282434139
161+
* Mathematica: 23.65430282434144042648214719732782590575979471046811610915...
162+
*/
163+
141164
expected = positiveMedian.expected;
142165
p = positiveMedian.p;
143166
x0 = positiveMedian.x0;

0 commit comments

Comments
 (0)