2
2
title : stats_distribution
3
3
---
4
4
5
- # Statistical Distributions -- Exponential Distribution Module
5
+ # Statistical Distributions -- Exponential Module
6
6
7
7
[ TOC]
8
8
@@ -22,33 +22,31 @@ With single argument, the function returns an exponential distributed random var
22
22
23
23
With two auguments the function returns a rank one array of random variates.
24
24
25
- The rate parameter ` lamda ` must be greater than 0.
26
-
27
25
### Syntax
28
26
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]]) `
30
28
31
29
### Arguments
32
30
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 ` .
34
32
35
33
` array_size ` : optional argument has ` intent(in) ` and is a scalar of type ` integer ` .
36
34
37
35
### Return value
38
36
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 ` .
40
38
41
39
### Example
42
40
43
41
``` fortran
44
42
program demo_exponential_rvs
45
43
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
48
46
49
47
implicit none
50
48
real :: a(2,3,4)
51
- complx :: scale
49
+ complex :: scale
52
50
integer :: seed_put, seed_get
53
51
54
52
seed_put = 1234567
@@ -64,20 +62,22 @@ program demo_exponential_rvs
64
62
65
63
print *, rexp(0.3, 10) !an array of 10 variates with lamda=0.3
66
64
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
69
67
70
68
a(:,:,:) = 0.5
71
69
print *, rexp(a) !a rank 3 array of 24 exponential random variates
72
70
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
78
76
79
77
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
81
81
82
82
! (1.41435969,4.081114382E-02)
83
83
@@ -96,17 +96,15 @@ The probability density function of the continuous exponential distribution.
96
96
97
97
$$ f(x)=\begin{cases}lamda \times e^{-lamda \times x} &x\geqslant 0 \\\\ 0 &x< 0\end{} $$
98
98
99
- x is supported on [ 0, \infty)
100
-
101
99
### Syntax
102
100
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) `
104
102
105
103
### Arguments
106
104
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 ` .
108
106
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 ` .
110
108
111
109
The function is elemental, i.e., all auguments could be arrays conformable to each other. All arguments must have the same type.
112
110
@@ -119,13 +117,13 @@ The result is a scalar or an array, with a shape conformable to auguments, of ty
119
117
``` fortran
120
118
program demo_exponential_pdf
121
119
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
125
123
126
124
implicit none
127
125
real :: x(2,3,4),a(2,3,4)
128
- complx :: scale
126
+ complex :: scale
129
127
integer :: seed_put, seed_get
130
128
131
129
seed_put = 1234567
@@ -143,15 +141,16 @@ program demo_exponential_pdf
143
141
a(:,:,:) = 0.5
144
142
print *, exp_pdf(x, a) ! a rank 3 standard expon probability density
145
143
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
151
149
152
150
scale = (1.0, 2.)
153
151
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
155
154
156
155
! 6.03947677E-02
157
156
@@ -170,17 +169,16 @@ Cumulative distribution function of the exponential continuous distribution
170
169
171
170
$$ F(x)=\begin{cases}1 - e^{-lamda \times x} &x\geqslant 0 \\\\ 0 &x< 0\end{} $$
172
171
173
- x is supported on [ 0, \infty)
174
172
175
173
### Syntax
176
174
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) `
178
176
179
177
### Arguments
180
178
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 ` .
182
180
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 ` .
184
182
185
183
The function is elemental, i.e., all auguments could be arrays conformable to each other. All arguments must have the same type.
186
184
@@ -193,13 +191,13 @@ The result is a scalar or an array, with a shape conformable to auguments, of ty
193
191
``` fortran
194
192
program demo_exponential_cdf
195
193
use stdlib_stats_distribution_PRNG, only : random_seed
196
- use stdlib_stats_distribution_expon , only : &
194
+ use stdlib_stats_distribution_exponential , only : &
197
195
exp_cdf => exponential_distribution_cdf, &
198
196
rexp => exponential_distribution_rvs
199
197
200
198
implicit none
201
199
real :: x(2,3,4),a(2,3,4)
202
- complx :: scale
200
+ complex :: scale
203
201
integer :: seed_put, seed_get
204
202
205
203
seed_put = 1234567
@@ -218,15 +216,16 @@ program demo_exponential_cdf
218
216
a(:,:,:) = 0.5
219
217
print *, exp_cdf(x, a) ! a rank 3 array of standard exponential cumulative
220
218
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
226
224
227
225
scale = (0.5,1.0)
228
226
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
230
229
231
230
! 8.70351046E-02
232
231
0 commit comments