mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
Removed broken (redundant) unit test
This commit is contained in:
parent
3e6445a6d0
commit
c19befd7c2
@ -86,49 +86,6 @@ describe('import', function() {
|
||||
|
||||
});
|
||||
|
||||
it('should extend math with numbers', function() {
|
||||
// extend math.js with numbers.js
|
||||
// examples copied from https://github.com/sjkaliski/numbers.js/blob/master/examples/statistic.js
|
||||
math.import(require('numbers'), {wrap: true, silent: true});
|
||||
|
||||
assert.equal(math.fibonacci(7), 13);
|
||||
|
||||
// Consider a data representing total follower count of a
|
||||
// variety of users.
|
||||
var followers = math.matrix([100, 50, 1000, 39, 283, 634, 3, 6123]);
|
||||
|
||||
// We can generate a report of summary statistics
|
||||
// which includes the mean, 1st and 3rd quartiles,
|
||||
// and standard deviation.
|
||||
var report = math.report(followers);
|
||||
approx.deepEqual(report, {
|
||||
mean: 1029,
|
||||
firstQuartile: 44.5,
|
||||
median: 191.5,
|
||||
thirdQuartile: 817,
|
||||
standardDev: 1953.0897316815733
|
||||
});
|
||||
|
||||
// Maybe we decide to become a bit more curious about
|
||||
// trends in follower count, so we start conjecturing about
|
||||
// our ability to "predict" trends.
|
||||
// Let's consider the number of tweets those users have.
|
||||
var tweets = math.matrix([100, 10, 400, 5, 123, 24, 302, 2000]);
|
||||
|
||||
// Let's calculate the correlation.
|
||||
var correlation = math.correlation(tweets, followers);
|
||||
approx.equal(correlation, 0.98054753183666);
|
||||
|
||||
// Now let's create a linear regression.
|
||||
var linReg = math.linearRegression(tweets, followers);
|
||||
|
||||
// linReg is actually a function we can use to map tweets
|
||||
// onto followers. We'll see that around 1422 followers
|
||||
// are expected if a user tweets 500 times.
|
||||
var estFollowers = linReg(500);
|
||||
approx.equal(estFollowers, 1422.431464053916);
|
||||
});
|
||||
|
||||
it('should throw an error in case of wrong number of arguments', function () {
|
||||
assert.throws (function () {math.import()}, /ArgumentsError/);
|
||||
assert.throws (function () {math.import('', {}, 3)}, /ArgumentsError/);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user