Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

datasets-cavendish-density-of-earth

1.0.0 • Public • Published

Density of Earth

NPM version Build Status Coverage Status Dependencies

Dataset from Cavendish's experiments which measured the density of the earth relative to the density of water.

In 1798, Henry Cavendish conducted experiments to indirectly calculate the gravitational constant in Newton's law of universal gravitation between two bodies having mass m_1 and m_2. Letting M = m_1 and m = m_2,

Law of universal gravitation.

where M is the earth's mass, G is the gravitational constant, and r is the distance between the two center of masses. If the earth is modeled as a sphere having radius R, Newton's law may be expressed

Alternate form of the law of universal gravitation.

where g is the acceleration due to gravity and D is the earth's density. Accordingly, the density is inversely proportional to the gravitational constant G.

Relationship between density and the gravitational constant.

Installation

$ npm install datasets-cavendish-density-of-earth

For use in the browser, use browserify.

Usage

var data = require( 'datasets-cavendish-density-of-earth' );

data

Raw dataset from Cavendish's experiments which measured the density of the earth relative to the density of water.

console.log( data );
// returns [ 5.5, 5.61, 4.88, ... ]

data.analyzed

When performing his analysis, Cavendish treated the third value 4.88 as 5.88. This dataset acknowledges Cavendish's treatment and replaces the third value.

console.log( data.analyzed );
// returns [ 5.5, 5.61, 5.88, ... ]

data.edited

While conducting his measurements, Cavendish changed his experimental apparatus after the sixth measurement. To remove confounding factors, an edited dataset is included which sets the first 6 values as missing values encoded as null.

console.log( data.edited );
// returns [ null, null, ..., 5.36, ... ]

Notes

  • All measurement values are unit-less, as they are relative measures.

Examples

var mean = require( 'compute-mean' ),
    data = require( 'datasets-cavendish-density-of-earth' );
 
// Remove the missing values from the edited dataset...
for ( var i = 0; i < 6; i++ ) {
    data.edited.shift();
}
 
// Calculate the sample means of each dataset...
console.log( mean( data ) );
// returns ~5.448 => true value is 5.517
 
console.log( mean( data.analyzed ) );
// returns ~5.482 => true value is 5.517
 
console.log( mean( data.edited ) );
// returns ~5.483 => true value is 5.517

To run the example code from the top-level application directory,

$ node ./examples/index.js

References

  • Cavendish, Henry. (1798). "Experiments to determine the density of the earth." Philosophical Transactions of the Royal Society of London, 88 (Part II), 469-527. Reprinted in A. S. Mackenzie (ed.), The Laws of Gravitation, 1900, New York: American.
  • Stigler, Stephen M. (1977), "Do robust estimators work with real data?", Annals of Statistics, 5, 1055-1098.

Tests

Unit

Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ make view-cov

License

MIT license.

Copyright

Copyright © 2015. The Compute.io Authors.

install

npm i datasets-cavendish-density-of-earth

Downloadsweekly downloads

0

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability