Skip to content

Commit e58756c

Browse files
committed
Fix: README and main.c (Issue #7141f46)
1 parent 18ad933 commit e58756c

File tree

2 files changed

+16
-73
lines changed

2 files changed

+16
-73
lines changed

lib/node_modules/@stdlib/stats/base/dists/geometric/cdf/README.md

Lines changed: 15 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<!--
2-
32
@license Apache-2.0
43
54
Copyright (c) 2018 The Stdlib Authors.
@@ -15,7 +14,6 @@ distributed under the License is distributed on an "AS IS" BASIS,
1514
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1615
See the License for the specific language governing permissions and
1716
limitations under the License.
18-
1917
-->
2018

2119
# Cumulative Distribution Function
@@ -24,33 +22,22 @@ limitations under the License.
2422
2523
<section class="intro">
2624

27-
The [cumulative distribution function][cdf] for a [geometric][geometric-distribution] random variable is
28-
29-
<!-- <equation class="equation" label="eq:geometric_cdf" align="center" raw="F(x;p)= \begin{cases} 0 & \text{ for } x < 0 \\ 1-(1 - p)^{\left\lfloor x \right\rfloor+1} & \text{ otherwise} \end{cases}" alt="Cumulative distribution function for a geometric distribution."> -->
25+
The [cumulative distribution function][cdf] for a [geometric][geometric-distribution] random variable is:
3026

3127
```math
32-
F(x;p)= \begin{cases} 0 & \text{ for } x < 0 \\ 1-(1 - p)^{\left\lfloor x \right\rfloor+1} & \text{ otherwise} \end{cases}
28+
F(x;p)= \begin{cases} 0 & \text{for } x < 0 \\ 1-(1 - p)^{\left\lfloor x \right\rfloor+1} & \text{otherwise} \end{cases}
3329
```
3430

35-
<!-- <div class="equation" align="center" data-raw-text="F(x;p)= \begin{cases} 0 &amp; \text{ for } x &lt; 0 \\ 1-(1 - p)^{\left\lfloor x \right\rfloor+1} &amp; \text{ otherwise} \end{cases}" data-equation="eq:geometric_cdf">
36-
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@51534079fef45e990850102147e8945fb023d1d0/lib/node_modules/@stdlib/stats/base/dists/geometric/cdf/docs/img/equation_geometric_cdf.svg" alt="Cumulative distribution function for a geometric distribution.">
37-
<br>
38-
</div> -->
39-
40-
<!-- </equation> -->
41-
4231
where `0 <= p <= 1` is the success probability. `x` denotes the number of _failures_ before the first success.
4332

4433
</section>
4534

46-
<!-- /.intro -->
47-
4835
<section class="usage">
4936

5037
## Usage
5138

5239
```javascript
53-
var cdf = require( '@stdlib/stats/base/dists/geometric/cdf' );
40+
var cdf = require('@stdlib/stats/base/dists/geometric/cdf');
5441
```
5542

5643
#### cdf( x, p )
@@ -87,7 +74,7 @@ y = cdf( 2.0, 1.5 );
8774

8875
#### cdf.factory( p )
8976

90-
Returns a function for evaluating the [cumulative distribution function][cdf] of a [geometric][geometric-distribution] distribution with success probability `p`
77+
Returns a function for evaluating the [cumulative distribution function][cdf] of a [geometric][geometric-distribution] distribution with success probability `p`.
9178

9279
```javascript
9380
var mycdf = cdf.factory( 0.5 );
@@ -100,17 +87,13 @@ y = mycdf( 1.0 );
10087

10188
</section>
10289

103-
<!-- /.usage -->
104-
10590
<section class="examples">
10691

10792
## Examples
10893

109-
<!-- eslint no-undef: "error" -->
110-
11194
```javascript
112-
var randu = require( '@stdlib/random/base/randu' );
113-
var cdf = require( '@stdlib/stats/base/dists/geometric/cdf' );
95+
var randu = require('@stdlib/random/base/randu');
96+
var cdf = require('@stdlib/stats/base/dists/geometric/cdf');
11497

11598
var p;
11699
var x;
@@ -127,29 +110,18 @@ for ( i = 0; i < 10; i++ ) {
127110

128111
</section>
129112

130-
<!-- /.examples -->
131-
132-
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
133-
134113
<section class="references">
135114

136-
<!-- C interface documentation. -->
137-
138-
* * *
139-
140-
<section class="c">
141-
142-
## C APIs
143-
144-
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
115+
## References
145116

146-
<section class="intro">
117+
- [Cumulative distribution function (Wikipedia)](https://en.wikipedia.org/wiki/Cumulative_distribution_function)
118+
- [Geometric distribution (Wikipedia)](https://en.wikipedia.org/wiki/Geometric_distribution)
147119

148120
</section>
149121

150-
<!-- /.intro -->
122+
<section class="c">
151123

152-
<!-- C usage documentation. -->
124+
## C APIs
153125

154126
<section class="usage">
155127

@@ -168,29 +140,8 @@ double out = stdlib_base_dists_geometric_cdf( 2.0, 0.5 );
168140
// returns 0.875
169141
```
170142

171-
The function accepts the following arguments:
172-
173-
- **x**: `[in] double` input value.
174-
- **p**: `[in] double` probability of success.
175-
176-
```c
177-
double stdlib_base_dists_geometric_cdf( const double x, const double p );
178-
```
179-
180-
</section>
181-
182-
<!-- /.usage -->
183-
184-
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
185-
186-
<section class="notes">
187-
188143
</section>
189144

190-
<!-- /.notes -->
191-
192-
<!-- C API usage examples. -->
193-
194145
<section class="examples">
195146

196147
### Examples
@@ -203,7 +154,7 @@ double stdlib_base_dists_geometric_cdf( const double x, const double p );
203154

204155
static double random_uniform( const double min, const double max ) {
205156
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
206-
return min + ( v*(max-min) );
157+
return min + ( v * (max - min) );
207158
}
208159

209160
int main( void ) {
@@ -223,24 +174,16 @@ int main( void ) {
223174
224175
</section>
225176
226-
<!-- /.references -->
227-
228-
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
229-
230-
<section class="related">
231-
232177
</section>
233178
234-
<!-- /.related -->
235-
236-
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
237-
238179
<section class="links">
239180
240181
[cdf]: https://en.wikipedia.org/wiki/Cumulative_distribution_function
241-
242182
[geometric-distribution]: https://en.wikipedia.org/wiki/Geometric_distribution
243183
244184
</section>
245185
186+
<!-- /.examples -->
187+
<!-- /.c -->
246188
<!-- /.links -->
189+

lib/node_modules/@stdlib/stats/base/dists/geometric/cdf/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @param x input value
2929
* @param p success probability
30-
* @returns evaluated CDF
30+
* @return evaluated CDF or NaN
3131
*
3232
* @example
3333
* double y = stdlib_base_dists_geometric_cdf( 2.0, 0.5 );

0 commit comments

Comments
 (0)