Skip to content

Commit 5e613ad

Browse files
committed
docs: replace manual for loop in examples
1 parent 3ef117f commit 5e613ad

File tree

16 files changed

+136
-116
lines changed

16 files changed

+136
-116
lines changed

lib/node_modules/@stdlib/math/base/special/besselj0/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,17 @@ v = j0( NaN );
8383
<!-- eslint no-undef: "error" -->
8484

8585
```javascript
86-
var randu = require( '@stdlib/random/base/randu' );
87-
var j0 = require( '@stdlib/math/base/special/besselj0' );
86+
var uniform = require( '@stdlib/random/array/uniform' );
87+
var logEachMap = require( '@stdlib/console/log-each-map' );
88+
var besselj0 = require( '@stdlib/math/base/special/besselj0' );
8889

8990
var x;
90-
var i;
9191

92-
for ( i = 0; i < 100; i++ ) {
93-
x = randu() * 10.0;
94-
console.log( 'j0(%d) = %d', x, j0( x ) );
95-
}
92+
x = uniform( 100, 0.0, 100.0, {
93+
'dtype': 'float64'
94+
});
95+
96+
logEachMap( 'besselj0(%0.4f) = %0.4f', x, besselj0 );
9697
```
9798

9899
</section>

lib/node_modules/@stdlib/math/base/special/besselj0/examples/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random/base/randu' );
21+
var uniform = require( '@stdlib/random/array/uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var besselj0 = require( './../lib' );
2324

2425
var x;
25-
var i;
2626

27-
for ( i = 0; i < 100; i++ ) {
28-
x = randu() * 100.0;
29-
console.log( 'besselj0(%d) = %d', x, besselj0( x ) );
30-
}
27+
x = uniform( 100, 0.0, 100.0, {
28+
'dtype': 'float64'
29+
});
30+
31+
logEachMap( 'besselj0(%0.4f) = %0.4f', x, besselj0 );

lib/node_modules/@stdlib/math/base/special/besselj1/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,17 @@ v = j1( NaN );
8383
<!-- eslint no-undef: "error" -->
8484

8585
```javascript
86-
var randu = require( '@stdlib/random/base/randu' );
87-
var j1 = require( '@stdlib/math/base/special/besselj1' );
86+
var uniform = require( '@stdlib/random/array/uniform' );
87+
var logEachMap = require( '@stdlib/console/log-each-map' );
88+
var besselj1 = require( '@stdlib/math/base/special/besselj1' );
8889

8990
var x;
90-
var i;
9191

92-
for ( i = 0; i < 100; i++ ) {
93-
x = randu() * 10.0;
94-
console.log( 'j1(%d) = %d', x, j1( x ) );
95-
}
92+
x = uniform( 100, 0.0, 100.0, {
93+
'dtype': 'float64'
94+
});
95+
96+
logEachMap( 'besselj1(%0.4f) = %0.4f', x, besselj1 );
9697
```
9798

9899
</section>

lib/node_modules/@stdlib/math/base/special/besselj1/examples/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random/base/randu' );
21+
var uniform = require( '@stdlib/random/array/uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var besselj1 = require( './../lib' );
2324

2425
var x;
25-
var i;
2626

27-
for ( i = 0; i < 100; i++ ) {
28-
x = randu() * 100.0;
29-
console.log( 'besselj1(%d) = %d', x, besselj1( x ) );
30-
}
27+
x = uniform( 100, 0.0, 100.0, {
28+
'dtype': 'float64'
29+
});
30+
31+
logEachMap( 'besselj1(%0.4f) = %0.4f', x, besselj1 );

lib/node_modules/@stdlib/math/base/special/bessely0/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,17 @@ v = y0( NaN );
9090
<!-- eslint no-undef: "error" -->
9191

9292
```javascript
93-
var randu = require( '@stdlib/random/base/randu' );
94-
var y0 = require( '@stdlib/math/base/special/bessely0' );
93+
var uniform = require( '@stdlib/random/array/uniform' );
94+
var logEachMap = require( '@stdlib/console/log-each-map' );
95+
var bessely0 = require( '@stdlib/math/base/special/bessely0' );
9596

9697
var x;
97-
var i;
9898

99-
for ( i = 0; i < 100; i++ ) {
100-
x = randu() * 10.0;
101-
console.log( 'y0(%d) = %d', x, y0( x ) );
102-
}
99+
x = uniform( 100, 0.0, 100.0, {
100+
'dtype': 'float64'
101+
});
102+
103+
logEachMap( 'bessely0(%0.4f) = %0.4f', x, bessely0 );
103104
```
104105

105106
</section>

lib/node_modules/@stdlib/math/base/special/bessely0/examples/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random/base/randu' );
21+
var uniform = require( '@stdlib/random/array/uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var bessely0 = require( './../lib' );
2324

2425
var x;
25-
var i;
2626

27-
for ( i = 0; i < 100; i++ ) {
28-
x = randu() * 100.0;
29-
console.log( 'bessely0(%d) = %d', x, bessely0( x ) );
30-
}
27+
x = uniform( 100, 0.0, 100.0, {
28+
'dtype': 'float64'
29+
});
30+
31+
logEachMap( 'bessely0(%0.4f) = %0.4f', x, bessely0 );

lib/node_modules/@stdlib/math/base/special/bessely1/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,17 @@ v = y1( NaN );
9191
<!-- eslint no-undef: "error" -->
9292

9393
```javascript
94-
var randu = require( '@stdlib/random/base/randu' );
95-
var y1 = require( '@stdlib/math/base/special/bessely1' );
94+
var uniform = require( '@stdlib/random/array/uniform' );
95+
var logEachMap = require( '@stdlib/console/log-each-map' );
96+
var bessely1 = require( '@stdlib/math/base/special/bessely1' );
9697

9798
var x;
98-
var i;
9999

100-
for ( i = 0; i < 100; i++ ) {
101-
x = randu() * 10.0;
102-
console.log( 'y1(%d) = %d', x, y1( x ) );
103-
}
100+
x = uniform( 100, 0.0, 100.0, {
101+
'dtype': 'float64'
102+
});
103+
104+
logEachMap( 'bessely1(%0.4f) = %0.4f', x, bessely1 );
104105
```
105106

106107
</section>

lib/node_modules/@stdlib/math/base/special/bessely1/examples/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random/base/randu' );
21+
var uniform = require( '@stdlib/random/array/uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var bessely1 = require( './../lib' );
2324

2425
var x;
25-
var i;
2626

27-
for ( i = 0; i < 100; i++ ) {
28-
x = randu() * 100.0;
29-
console.log( 'bessely1(%d) = %d', x, bessely1( x ) );
30-
}
27+
x = uniform( 100, 0.0, 100.0, {
28+
'dtype': 'float64'
29+
});
30+
31+
logEachMap( 'bessely1(%0.4f) = %0.4f', x, bessely1 );

lib/node_modules/@stdlib/math/base/special/betainc/README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,25 @@ var y = betainc( 0.5, 2.0, -2.0 );
102102
<!-- eslint no-undef: "error" -->
103103

104104
```javascript
105-
var randu = require( '@stdlib/random/base/randu' );
105+
var uniform = require( '@stdlib/random/array/uniform' );
106+
var logEachMap = require( '@stdlib/console/log-each-map' );
106107
var betainc = require( '@stdlib/math/base/special/betainc' );
107108

108-
var i;
109109
var x;
110110
var a;
111111
var b;
112112

113-
for ( i = 0; i < 100; i++ ) {
114-
x = randu();
115-
a = randu() * 10.0;
116-
b = randu() * 10.0;
117-
console.log( 'x: %d, \t a: %d, \t b: %d, \t f(x,a,b): %d', x.toFixed( 4 ), a.toFixed( 4 ), b.toFixed( 4 ), betainc( x, a, b ).toFixed( 4 ) );
118-
}
113+
x = uniform( 100, 0.0, 1.0, {
114+
'dtype': 'float64'
115+
});
116+
a = uniform( 100, 0.0, 10.0, {
117+
'dtype': 'float64'
118+
});
119+
b = uniform( 100, 0.0, 10.0, {
120+
'dtype': 'float64'
121+
});
122+
123+
logEachMap( 'x: %0.4f, \t a: %0.4f, \t b: %0.4f, \t f(x,a,b): %0.4f', x, a, b, betainc );
119124
```
120125

121126
</section>

lib/node_modules/@stdlib/math/base/special/betainc/examples/index.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,22 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random/base/randu' );
21+
var uniform = require( '@stdlib/random/array/uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var betainc = require( './../lib' );
2324

24-
var i;
2525
var x;
2626
var a;
2727
var b;
2828

29-
for ( i = 0; i < 100; i++ ) {
30-
x = randu();
31-
a = randu() * 10.0;
32-
b = randu() * 10.0;
33-
console.log( 'x: %d, \t a: %d, \t b: %d, \t f(x,a,b): %d', x.toFixed( 4 ), a.toFixed( 4 ), b.toFixed( 4 ), betainc( x, a, b ).toFixed( 4 ) );
34-
}
29+
x = uniform( 100, 0.0, 1.0, {
30+
'dtype': 'float64'
31+
});
32+
a = uniform( 100, 0.0, 10.0, {
33+
'dtype': 'float64'
34+
});
35+
b = uniform( 100, 0.0, 10.0, {
36+
'dtype': 'float64'
37+
});
38+
39+
logEachMap( 'x: %0.4f, \t a: %0.4f, \t b: %0.4f, \t f(x,a,b): %0.4f', x, a, b, betainc );

0 commit comments

Comments
 (0)