Skip to content

Commit b53a270

Browse files
Add files via upload
1 parent 93b0fc4 commit b53a270

File tree

1 file changed

+43
-44
lines changed

1 file changed

+43
-44
lines changed

doc/specs/stdlib_stats_distribution_exponential.md

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: stats_distribution
33
---
44

5-
# Statistical Distributions -- Exponential Distribution Module
5+
# Statistical Distributions -- Exponential Module
66

77
[TOC]
88

@@ -22,33 +22,31 @@ With single argument, the function returns an exponential distributed random var
2222

2323
With two auguments the function returns a rank one array of random variates.
2424

25-
The rate parameter `lamda` must be greater than 0.
26-
2725
### Syntax
2826

29-
`result = [[stdlib_stats_distribution_expon(module):exponential_distribution_rvs(interface)]]([lamda] [[, array_size]])`
27+
`result = [[stdlib_stats_distribution_exponential(module):exponential_distribution_rvs(interface)]]([lamda] [[, array_size]])`
3028

3129
### Arguments
3230

33-
`lamda`: optional argument has `intent(in)` and is a scalar of type `real` or `complx`.
31+
`lamda`: optional argument has `intent(in)` and is a scalar of type `real` or `complex`.
3432

3533
`array_size`: optional argument has `intent(in)` and is a scalar of type `integer`.
3634

3735
### Return value
3836

39-
The result is a scalar or rank one array, with a size of `array_size`, of type `real` or `complx`.
37+
The result is a scalar or rank one array, with a size of `array_size`, of type `real` or `complex`.
4038

4139
### Example
4240

4341
```fortran
4442
program demo_exponential_rvs
4543
use stdlib_stats_distribution_PRNG, only : random_seed
46-
use stdlib_stats_distribution_expon, only: &
47-
rexp => exponential_distribution_rvs
44+
use stdlib_stats_distribution_exponential, only: &
45+
rexp => exponential_distribution_rvs
4846
4947
implicit none
5048
real :: a(2,3,4)
51-
complx :: scale
49+
complex :: scale
5250
integer :: seed_put, seed_get
5351
5452
seed_put = 1234567
@@ -64,20 +62,22 @@ program demo_exponential_rvs
6462
6563
print *, rexp(0.3, 10) !an array of 10 variates with lamda=0.3
6664
67-
! [1.84008647E-02, 3.59742008E-02, 0.136567295, 0.262772143, 3.62352766E-02,
68-
! 0.547133625, 0.213591918, 4.10784185E-02, 0.583882213, 0.671128035]
65+
! 1.84008647E-02 3.59742008E-02 0.136567295 0.262772143 3.62352766E-02
66+
! 0.547133625 0.213591918 4.10784185E-02 0.583882213 0.671128035
6967
7068
a(:,:,:) = 0.5
7169
print *, rexp(a) !a rank 3 array of 24 exponential random variates
7270
73-
! [0.219550118, 0.318272740, 0.426896989, 0.803026378, 0.395067871,
74-
! 5.93891777E-02, 0.809226036, 1.27890170, 1.38805652, 0.179149821,
75-
! 1.75288841E-02, 7.23171830E-02, 0.157068044, 0.153069839, 0.421180248,
76-
! 0.517792642, 2.09411430, 0.785641313, 0.116311245, 0.295113146,
77-
! 0.824005902, 0.123385273, 5.50238751E-02, 3.52851897E-02]
71+
! 0.219550118 0.318272740 0.426896989 0.803026378 0.395067871
72+
! 5.93891777E-02 0.809226036 1.27890170 1.38805652 0.179149821
73+
! 1.75288841E-02 7.23171830E-02 0.157068044 0.153069839 0.421180248
74+
! 0.517792642 2.09411430 0.785641313 0.116311245 0.295113146
75+
! 0.824005902 0.123385273 5.50238751E-02 3.52851897E-02
7876
7977
scale = (2.0, 0.7)
80-
print *, rexp(scale) !single complex exponential random variate with real part of lamda=2.0; imagainary part of lamda=0.7
78+
print *, rexp(scale)
79+
!single complex exponential random variate with real part of lamda=2.0;
80+
!imagainary part of lamda=0.7
8181
8282
! (1.41435969,4.081114382E-02)
8383
@@ -96,17 +96,15 @@ The probability density function of the continuous exponential distribution.
9696

9797
$$ f(x)=\begin{cases}lamda \times e^{-lamda \times x} &x\geqslant 0 \\\\ 0 &x< 0\end{} $$
9898

99-
x is supported on [0, \infty)
100-
10199
### Syntax
102100

103-
`result = [[stdlib_stats_distribution_expon(module):exponential_distribution_pdf(interface)]](x, lamda)`
101+
`result = [[stdlib_stats_distribution_exponential(module):exponential_distribution_pdf(interface)]](x, lamda)`
104102

105103
### Arguments
106104

107-
`x`: has `intent(in)` and is a scalar of type `real` or `complx`.
105+
`x`: has `intent(in)` and is a scalar of type `real` or `complex`.
108106

109-
`lamda`: has `intent(in)` and is a scalar of type `real` or `complx`.
107+
`lamda`: has `intent(in)` and is a scalar of type `real` or `complex`.
110108

111109
The function is elemental, i.e., all auguments could be arrays conformable to each other. All arguments must have the same type.
112110

@@ -119,13 +117,13 @@ The result is a scalar or an array, with a shape conformable to auguments, of ty
119117
```fortran
120118
program demo_exponential_pdf
121119
use stdlib_stats_distribution_PRNG, only : random_seed
122-
use stdlib_stats_distribution_expon, only : &
123-
exp_pdf => exponential_distribution_pdf, &
124-
rexp => exponential_distribution_rvs
120+
use stdlib_stats_distribution_exponential, only: &
121+
exp_pdf => exponential_distribution_pdf, &
122+
rexp => exponential_distribution_rvs
125123
126124
implicit none
127125
real :: x(2,3,4),a(2,3,4)
128-
complx :: scale
126+
complex :: scale
129127
integer :: seed_put, seed_get
130128
131129
seed_put = 1234567
@@ -143,15 +141,16 @@ program demo_exponential_pdf
143141
a(:,:,:) = 0.5
144142
print *, exp_pdf(x, a) ! a rank 3 standard expon probability density
145143
146-
! [0.457115263, 0.451488823, 0.492391467, 0.485233188, 0.446215510,
147-
! 0.401670188, 0.485127628, 0.316924453, 0.418474048, 0.483173639,
148-
! 0.307366133, 0.285812140, 0.448017836, 0.426440030, 0.403896868,
149-
! 0.334653258, 0.410376132, 0.485370994, 0.333617479, 0.263791025,
150-
! 0.249779820, 0.457159877, 0.495636940, 0.482243657]
144+
! 0.457115263 0.451488823 0.492391467 0.485233188 0.446215510
145+
! 0.401670188 0.485127628 0.316924453 0.418474048 0.483173639
146+
! 0.307366133 0.285812140 0.448017836 0.426440030 0.403896868
147+
! 0.334653258 0.410376132 0.485370994 0.333617479 0.263791025
148+
! 0.249779820 0.457159877 0.495636940 0.482243657
151149
152150
scale = (1.0, 2.)
153151
print *, exp_pdf((1.5,1.0), scale)
154-
! a complex expon probability density function at (1.5,1.0) with real part of lamda=1.0 and imaginary part of lamda=2.0
152+
! a complex expon probability density function at (1.5,1.0) with real part
153+
!of lamda=1.0 and imaginary part of lamda=2.0
155154
156155
! 6.03947677E-02
157156
@@ -170,17 +169,16 @@ Cumulative distribution function of the exponential continuous distribution
170169

171170
$$ F(x)=\begin{cases}1 - e^{-lamda \times x} &x\geqslant 0 \\\\ 0 &x< 0\end{} $$
172171

173-
x is supported on [0, \infty)
174172

175173
### Syntax
176174

177-
`result = [[stdlib_stats_distribution_expon(module):exponential_distribution_cdf(interface)]](x, lamda)`
175+
`result = [[stdlib_stats_distribution_exponential(module):exponential_distribution_cdf(interface)]](x, lamda)`
178176

179177
### Arguments
180178

181-
`x`: has `intent(in)` and is a scalar of type `real` or `complx`.
179+
`x`: has `intent(in)` and is a scalar of type `real` or `complex`.
182180

183-
`lamda`: has `intent(in)` and is a scalar of type `real` or `complx`.
181+
`lamda`: has `intent(in)` and is a scalar of type `real` or `complex`.
184182

185183
The function is elemental, i.e., all auguments could be arrays conformable to each other. All arguments must have the same type.
186184

@@ -193,13 +191,13 @@ The result is a scalar or an array, with a shape conformable to auguments, of ty
193191
```fortran
194192
program demo_exponential_cdf
195193
use stdlib_stats_distribution_PRNG, only : random_seed
196-
use stdlib_stats_distribution_expon, only : &
194+
use stdlib_stats_distribution_exponential, only : &
197195
exp_cdf => exponential_distribution_cdf, &
198196
rexp => exponential_distribution_rvs
199197
200198
implicit none
201199
real :: x(2,3,4),a(2,3,4)
202-
complx :: scale
200+
complex :: scale
203201
integer :: seed_put, seed_get
204202
205203
seed_put = 1234567
@@ -218,15 +216,16 @@ program demo_exponential_cdf
218216
a(:,:,:) = 0.5
219217
print *, exp_cdf(x, a) ! a rank 3 array of standard exponential cumulative
220218
221-
! [8.57694745E-02, 9.70223546E-02, 1.52170658E-02, 2.95336246E-02,
222-
! 0.107568979, 0.196659625, 2.97447443E-02, 0.366151094, 0.163051903,
223-
! 3.36527228E-02, 0.385267735, 0.428375721, 0.103964329, 0.147119939,
224-
! 0.192206264, 0.330693483, 0.179247737, 2.92580128E-02, 0.332765043,
225-
! 0.472417951, 0.500440359, 8.56802464E-02, 8.72612000E-03, 3.55126858E-02]
219+
! 8.57694745E-02 9.70223546E-02 1.52170658E-02 2.95336246E-02
220+
! 0.107568979 0.196659625 2.97447443E-02 0.366151094 0.163051903
221+
! 3.36527228E-02 0.385267735 0.428375721 0.103964329 0.147119939
222+
! 0.192206264 0.330693483 0.179247737 2.92580128E-02 0.332765043
223+
! 0.472417951 0.500440359 8.56802464E-02 8.72612000E-03 3.55126858E-02
226224
227225
scale = (0.5,1.0)
228226
print *, exp_cdf((0.5,0.5),scale)
229-
!complex exponential cumulative distribution at (0.5,0.5) with real part of lamda=0.5 and imaginary part of lamda=1.0
227+
!complex exponential cumulative distribution at (0.5,0.5) with real part of
228+
!lamda=0.5 and imaginary part of lamda=1.0
230229
231230
! 8.70351046E-02
232231

0 commit comments

Comments
 (0)