Skip to content

Commit 2c002ec

Browse files
committed
feat: add readme contain for c
1 parent 89e6607 commit 2c002ec

File tree

1 file changed

+92
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/arcsine/pdf

1 file changed

+92
-0
lines changed

lib/node_modules/@stdlib/stats/base/dists/arcsine/pdf/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,98 @@ for ( i = 0; i < 25; i++ ) {
135135

136136
</section>
137137

138+
<!-- C interface documentation. -->
139+
140+
* * *
141+
142+
<section class="c">
143+
144+
## C APIs
145+
146+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
147+
148+
<section class="intro">
149+
150+
</section>
151+
152+
<!-- /.intro -->
153+
154+
<!-- C usage documentation. -->
155+
156+
<section class="usage">
157+
158+
### Usage
159+
160+
```c
161+
#include "stdlib/stats/base/dists/arcsine/pdf.h"
162+
```
163+
164+
#### stdlib_base_dists_arcsine_pdf( x, a, b )
165+
166+
Evaluates the probability density function (PDF) for an arcsine distribution.
167+
168+
```c
169+
double out = stdlib_base_dists_arcsine_pdf( 0.5, 0.0, 4.0 );
170+
// returns ~0.159
171+
```
172+
173+
The function accepts the following arguments:
174+
175+
- **x**: `[in] double` input value.
176+
- **a**: `[in] double` minimum support.
177+
- **b**: `[in] double` maximum support.
178+
179+
```c
180+
double stdlib_base_dists_arcsine_pdf( const double x, const double a, const double b );
181+
```
182+
183+
</section>
184+
185+
<!-- /.usage -->
186+
187+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
188+
189+
<section class="notes">
190+
191+
</section>
192+
193+
<!-- /.notes -->
194+
195+
<!-- C API usage examples. -->
196+
197+
<section class="examples">
198+
199+
### Examples
200+
201+
```c
202+
#include "stdlib/stats/base/dists/arcsine/pdf.h"
203+
#include <stdlib.h>
204+
#include <stdio.h>
205+
206+
static double random_uniform( const double min, const double max ) {
207+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
208+
return min + ( v*(max-min) );
209+
}
210+
211+
int main( void ) {
212+
double x;
213+
double a;
214+
double b;
215+
double y;
216+
int i;
217+
218+
for ( i = 0; i < 25; i++ ) {
219+
x = random_uniform( -10.0, 10.0 );
220+
a = random_uniform( -20.0, 0.0 );
221+
b = random_uniform( a, a+40.0 );
222+
y = stdlib_base_dists_arcsine_pdf( x, a, b );
223+
printf( "x: %lf, a: %lf, b: %lf, f(x;a,b): %lf\n", x, a, b, y );
224+
}
225+
}
226+
```
227+
228+
</section>
229+
138230
<!-- /.examples -->
139231

140232
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

0 commit comments

Comments
 (0)