Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions examples/index.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not have been modified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert these changes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planetshifter told to change that file as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, he meant the examples/index.js in the namespace package, not in the root directory.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok I will fix the files accordingly and revert the necessary files back

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick doubt how should i handle this, i am getting this error in examples/index.js in root as well as the namespace package

  25:1  warning  Unexpected console statement                                     no-console
  28:1  error    All 'var' declarations must be at the top of the function scope  vars-on-top
  29:1  warning  Unexpected console statement                                     no-console

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,48 @@

'use strict';

var arcsine = require( '@stdlib/stats/base/dists/arcsine' );
var stdlib = require( './../lib' );

var keys;
var y;
var cdfValue;
var pdfValue;
var mean;
var variance;
var medianValue;
var modeValue;
var entropy;

// List sub-namespaces:
var keys = stdlib.utils.objectKeys( stdlib );
console.log( keys );
keys = stdlib.utils.objectKeys(stdlib);
console.log(keys);

// Compute the value of sine:
var y = stdlib.math.base.special.sin( 3.14 );
console.log( y );
y = stdlib.math.base.special.sin(3.14);
console.log(y);

// Example 1: Calculate the Cumulative Distribution Function (CDF)
cdfValue = arcsine.cdf(0.5, 0, 1);
console.log('CDF value at 0.5:', cdfValue);

// Example 2: Calculate the Probability Density Function (PDF)
pdfValue = arcsine.pdf(0.5, 0, 1);
console.log('PDF value at 0.5:', pdfValue);

// Example 3: Calculate the Mean and Variance
mean = arcsine.mean(0, 1);
variance = arcsine.variance(0, 1);
console.log('Mean:', mean, 'Variance:', variance);

// Example 4: Calculate the Median
medianValue = arcsine.median(0, 1);
console.log('Median of the distribution:', medianValue);

// Example 5: Calculate the Mode
modeValue = arcsine.mode(0, 1);
console.log('Mode of the distribution:', modeValue);

// Example 6: Calculate the Entropy
entropy = arcsine.entropy(0, 1);
console.log('Entropy:', entropy);
28 changes: 27 additions & 1 deletion lib/node_modules/@stdlib/stats/base/dists/arcsine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,36 @@ var mu = dist.mean;
<!-- eslint no-undef: "error" -->

```javascript
// Display Available Functions
var objectKeys = require( '@stdlib/utils/keys' );
var arcsine = require( '@stdlib/stats/base/dists/arcsine' );

console.log( objectKeys( arcsine ) );

// Calculate the Median for the arcsine distribution in the range [0, 1]
var medianValue = arcsine.median(0, 1);
console.log('The median of the distribution is', medianValue);

// Calculate the Mode for the arcsine distribution in the range [0, 1]
var modeValue = arcsine.mode(0, 1);
console.log('The mode of the distribution is', modeValue);

// Calculate the Entropy for the arcsine distribution in the range [0, 1]
var log = require( '@stdlib/math/base/special/log' );
var entropy = arcsine.entropy(0, 1);
console.log('Entropy:', entropy);

// Calculate the Cumulative Distribution Function (CDF) for value 0.5 in the range [0, 1]
var cdfValue = arcsine.cdf(0.5, 0, 1);
console.log('The CDF value at 0.5 is', cdfValue);

// Calculate the Probability Density Function (PDF) for value 0.5 in the range [0, 1]
var pdfValue = arcsine.pdf(0.5, 0, 1);
console.log('The PDF value at 0.5 is', pdfValue);

// Use the Mean and Variance for the arcsine distribution in the range [0, 1]
var mean = arcsine.mean(0, 1);
var variance = arcsine.variance(0, 1);
console.log('Mean:', mean, 'Variance:', variance);
```

</section>
Expand Down