88 Commits

Author SHA1 Message Date
Jos de Jong
e788c1d7f3 Fix #1990: improve pickRandom: return matrix output on matrix input, introduce new option elementWise, always return n number of random picks (see also #1976). 2020-10-18 12:25:02 +02:00
Jos de Jong
5f59174614 Fix unit test and missing import extension 2020-10-18 10:23:36 +02:00
Jos de Jong
83e1963cee Merge branch 'develop' into v8
# Conflicts:
#	HISTORY.md
#	src/function/probability/pickRandom.js
#	test/unit-tests/function/probability/pickRandom.test.js
2020-10-18 10:14:32 +02:00
Konrad Linkowski
a5cbb6aa37 pickRandom - flatten the array 2020-10-03 19:37:21 +02:00
Konrad Linkowski
ca05c25546 Allow any array in pickRandom function 2020-10-03 19:37:21 +02:00
Jos de Jong
6f00715754
Specify import require paths (continuation of #1941) (#1962)
* Add `.js` extension to source file imports

* Specify package `exports` in `package.json`

Specify package type as `commonjs` (It's good to be specific)

* Move all compiled scripts into `lib` directory

Remove ./number.js (You can use the compiled ones in `./lib/*`)

Tell node that the `esm` directory is type `module` and enable tree shaking.

Remove unused files from packages `files` property

* Allow importing of package.json

* Make library ESM first

* - Fix merge conflicts
- Refactor `bundleAny` into `defaultInstance.js` and `browserBundle.cjs`
- Refactor unit tests to be able to run with plain nodejs (no transpiling)
- Fix browser examples

* Fix browser and browserstack tests

* Fix running unit tests on Node 10 (which has no support for modules)

* Fix node.js examples (those are still commonjs)

* Remove the need for `browserBundle.cjs`

* Generate minified bundle only

* [Security] Bump node-fetch from 2.6.0 to 2.6.1 (#1963)

Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. **This update includes a security fix.**
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Cleanup console.log

* Add integration tests to test the entry points (commonjs/esm, full/number only)

* Create backward compatibility error messages in the files moved/removed since v8

* Describe breaking changes in HISTORY.md

* Bump karma from 5.2.1 to 5.2.2 (#1965)

Bumps [karma](https://github.com/karma-runner/karma) from 5.2.1 to 5.2.2.
- [Release notes](https://github.com/karma-runner/karma/releases)
- [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md)
- [Commits](https://github.com/karma-runner/karma/compare/v5.2.1...v5.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

Co-authored-by: Lee Langley-Rees <lee@greenimp.co.uk>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-20 18:01:29 +02:00
PoppinL
943f1dbe70
Replace seed-random by seedrandom (#1955) 2020-09-06 10:25:41 +02:00
Nick Ewing
859cfa208a
Replace recursive calls in typed-functions with this-style calls (#1903)
* Fix #1902: typo in an example in the documentation

* Replace recursive calls in typed-functions with `this`-style calls

* Replace more recursive calls in typed-functions with `this`-style calls

* Refactor compareNatural to use this-style recursion

Co-authored-by: josdejong <wjosdejong@gmail.com>
2020-07-13 17:37:30 +02:00
josdejong
23e38bea60 Remove all deprecated code and warnings 2020-05-06 21:57:33 +02:00
Bartosz Leoniak
1f10538588 Improve performance of factorial for BigNumbers (#1691) 2019-12-31 11:31:35 +01:00
Waseem Yusuf
430a00f7b2 Refactor combinations.js to be more readable (#1607) 2019-08-31 09:54:56 +02:00
Waseem Yusuf
c0e87c4b71 Make combinationsWithRep.js more efficient (#1602)
* Implemented the `multicombinations` function

* Write unit tests for `multicombinations` function

* Integrate the `multicombinations` function throughout codebase

1. Include multicombinations factory function in factoriesAny.js and factoriesNumber.js
2. Write embedded docs for multicombinations
3. Added latex support
4. Refer to multicombinations in the "see also"-section of related functions

* Change name from `multichoose` to `combinationsWithRep`

* Update combinationsWithRep.js

Instead of always cancelling `n-1 factorial` from the denominator and ignoring `k factorial`, added a conditional to cancel the the larger of the two, therefore further reducing redundant calculations.

* Revert "Update combinationsWithRep.js"

This reverts commit efef6d3bd4c381aa12f00869a7624a622268805c.

* Update combinationsWithRep.js

Instead of always cancelling `n-1 factorial` from the denominator and ignoring `k factorial`, added a conditional to cancel the the larger of the two, therefore further reducing redundant calculations.

* Add one more test for the case: k > n-1

* Refactor single for-loop into two separate ones
2019-08-28 15:10:24 +02:00
Waseem Yusuf
4cee37232f Added a combinationsWithRep function to calculate combinations with repitition (#1588)
* Implemented the `multicombinations` function

* Write unit tests for `multicombinations` function

* Integrate the `multicombinations` function throughout codebase

1. Include multicombinations factory function in factoriesAny.js and factoriesNumber.js
2. Write embedded docs for multicombinations
3. Added latex support
4. Refer to multicombinations in the "see also"-section of related functions

* Change name from `multichoose` to `combinationsWithRep`
2019-08-15 11:35:51 +02:00
jos
d8a4f3a00a Update to standard@13.0.2 2019-07-20 13:46:31 +02:00
jos
41efed79d3 Fix #1473: remove 'use strict' in every file 2019-05-26 20:21:18 +02:00
jos
3e553e1d11 Remove dependency on matrix of function random 2019-05-15 17:54:39 +02:00
jos
33cead1327 Improved deprecation errors and warnings. Introduce lazy again for factories. 2019-04-22 09:45:57 +02:00
jos
3a34a57924 Auto generate dependenciesFull.js and dependenciesNumber.js (WIP) 2019-04-10 08:48:15 +02:00
jos
22bec13d10 Implement number factories, dependencies. Make matrix and bignumber optional where possible 2019-04-03 09:46:44 +02:00
jos
6acadd71a0 Create number implementations of all functions in mainNumber.js 2019-03-06 21:49:30 +01:00
jos
869d4960f9 Create and use factory.js to import all dependencies in main instance. Deprecate all old nested index.js files. 2019-01-30 14:38:47 +01:00
jos
c42844a5d8 Flatten all type.* dependencies 2019-01-30 13:47:45 +01:00
jos
5e8f0cbea5 Fix checking whether size is a Matrix 2019-01-05 18:17:32 +01:00
jos
4d037c103c Refactored random, randomInt, and pickRandom in more compact typed functions 2019-01-05 18:15:46 +01:00
jos
1eee1f30dc Move the contents of distribution.js into random, randomInt, and pickRandom 2019-01-05 16:49:07 +01:00
jos
016e10109d Fix functions having the actual config values.
Fix classes not listening for changes in config.
Decouple creating classes from `core`.
2018-12-30 20:41:06 +01:00
jos
a05d15e1db Remove partial and memoization. Gives too much complications. 2018-12-23 15:01:29 +01:00
jos
c32d410565 Refactor functions create and core. Use the new index files from all unit tests 2018-12-19 18:08:01 +01:00
jos
01a230a996 Add /* #__PURE__ */ everywhere to enable tree-shaking in webpack 2018-12-01 11:21:36 +01:00
jos
942218f0e1 Refactory typed into a regular factory function without special registrations. Remove most listeners. 2018-11-24 18:19:18 +01:00
jos
c7e0d211b7 All functions use plain object config properties, and use a copy of the config (finalize them) 2018-11-21 21:09:20 +01:00
jos
9750beb841 Cleanup redundant local variables 2018-11-21 18:18:10 +01:00
jos
19275e5eaa Moved all toTex properties to latex util file 2018-11-21 18:08:21 +01:00
jos
bb9bf78eff Refactored all probability functions 2018-11-09 13:51:22 +01:00
jos
d7ed170ba5 Converted all function transforms, expression functions, and embedded docs 2018-11-09 11:16:55 +01:00
jos
9faf91f697 Convert all data types, converted all algebra functions. Fixes in order of importing factories. 2018-11-08 15:02:18 +01:00
jos
2d7a407ee2 Create mainAll.js. Change algorithm functions to be internal factory functions (not injected). Convert more functions and data types. 2018-11-07 16:43:06 +01:00
jos
94e9668b4a Refactor functions into ES6 import/export 2018-10-31 20:53:01 +01:00
jos
9800f25b35 Reorganized utils functions and refactored to ES6 import/export 2018-10-31 19:58:33 +01:00
jos
7bc1dd3c8c Move isBigNumber, isMatrix, and isCollection into is.js 2018-10-31 18:56:41 +01:00
jos
e3211a7efc Move all is* functions like isComplex into is.js 2018-10-31 15:28:51 +01:00
greenkeeper[bot]
c5971b371a Update standard to the latest version 🚀 (#1226)
* chore(package): update standard to version 12.0.0

* update to new lint version with --fix

I believe this mainly adds whitespace to `{}`'s.

* Replace assert.equal with assert.strictEqual

This breaks a lot of tests which I will endevour to fix in the next
commits.

* Fix most errors due to assert.strictEquals

Some instances of `strictEquals` are replaced by `deepEquals`.
`toString` has been used to make some string comparisions explicit.
Tests will still fail untill #1236 and #1237 are fixed.

* Fix assertion erros due to -0

With node 10, assert.strictEqual no longer considers `0 === -0`.
I missed these first time round as I was using node 8.

* Put toString correct side of bracket

I was converting the constructor to a string rather
than the result of the computation. Oops.

* Fixed #1236: quantileSeq has inconsistant return

* Update package-lock

* Fixed #1237: norm sometimes returning a complex number instead of number

* Fix cli tests

* More changes for standardjs, and fixes in unit tests
2018-09-08 16:33:58 +02:00
Honeybar
a13f0ca7c6
style fix 2018-07-15 11:54:11 -07:00
Honeybar
4fb547cb7e
Delete productrange.js 2018-07-15 11:48:34 -07:00
Honeybar
f27ed3bb28
style fix 2018-07-15 11:47:38 -07:00
Honeybar
9ae26197c8
change filename and optimizing division by 2 2018-07-15 11:43:16 -07:00
Honeybar
45fde8b348
style fix 2018-07-15 00:35:44 -07:00
Honeybar
126bfbff6b
improving speed of factorial function 2018-07-14 23:40:12 -07:00
Honeybar
996922c46e
remove productBig function 2018-07-14 21:19:15 -07:00
Honeybar
77bd559b19
improving factorial function
speed up factorial function for number
2018-07-14 21:17:05 -07:00