307 Commits

Author SHA1 Message Date
Veeloxfire
10449b2326 Extend distance with support for n-dimensions 2020-01-04 21:03:53 +01:00
Bartosz Leoniak
1f10538588 Improve performance of factorial for BigNumbers (#1691) 2019-12-31 11:31:35 +01:00
Harry Sarson
462f46947f fix qr and sign edge cases (#1670)
* fix qr and sign edge cases

qr() was throwing an error if the pivots of a matrix were zero.
This commit fixes that and ensures that the results are consistant
with wolfram alpha.

Whilst doing this I found a bug in complex.js, I have added a work
around but we should flag this upstream.

I also addressed the long standing concerns about assert statements
within the body of the qr function.

Fixes #1669
Fixes #942

* further improvements to qr and sign

mainly fixing things I got wrong in previous commit

* add array test

* fix: remove only from tests and disallow

Uses mochas `--forbid-only` flag as advised by
https://github.com/standard/standard/issues/988
2019-11-18 20:03:09 +01:00
Arthur Guiot
34b676a1cc Improved performances for isPrime (#1641)
* Improved performances for isPrime

The prime test performance have been improved compared to previous version.

* Fixed build

* Fixed build for isPrime

* Removed extra semicolons to fix lint
2019-10-06 10:40:48 +02:00
Clinton Curry
69dd165afb Allow taking means of quantities with units. (#1644)
* Allow taking means of quantities with units.

* Fix silly error in test.

The test as written did not test anything about units.

* Fix same error again...
2019-10-03 20:28:25 +02:00
jos
a4f84512cd Fixed #1615: error in the docs of isNumeric 2019-09-11 10:10:46 +02: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
Harry Sarson
4cfef3ac34 fix no-case-declarations lint 2019-08-21 10:09:10 +01: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
35fc780d2a Refactor import to first flatten the functions and then import them, allowing to import dependency collections 2019-06-05 10:57:48 +02:00
jos
41efed79d3 Fix #1473: remove 'use strict' in every file 2019-05-26 20:21:18 +02:00
jos
9af5206a88 Make matrix dependency requried again for subset. Make IndexNodes dependencies explicit. Disable subset in number implementation for now 2019-05-22 11:08:12 +02:00
jos
80385325d8 Fix derivative and simplify not working in numbers version 2019-05-15 21:45:43 +02:00
jos
c8b02fb9f2 Make matrix dependency optional for now in subset (WIP) 2019-05-15 21:25:44 +02:00
jos
3e553e1d11 Remove dependency on matrix of function random 2019-05-15 17:54:39 +02:00
jos
6b6ae1383c Dropped fake BigNumber support from function erf 2019-05-15 10:54:02 +02:00
jos
52dfafe5be Use mathWithTransform instead of math where needed 2019-05-15 10:29:27 +02:00
jos
b4f2eb005e Merge remote-tracking branch 'origin/fix/1428' into develop
# Conflicts:
#	HISTORY.md
#	src/function/algebra/simplify.js
2019-05-04 10:07:39 +02:00
jos
33cead1327 Improved deprecation errors and warnings. Introduce lazy again for factories. 2019-04-22 09:45:57 +02:00
jos
6081360d6a Merged develop into modular_architecture 2019-04-13 16:51:51 +02:00
jos
3a34a57924 Auto generate dependenciesFull.js and dependenciesNumber.js (WIP) 2019-04-10 08:48:15 +02:00
jos
9f9bbbd4a3 Minor fixes and refinement of docs of row and column 2019-04-08 22:01:21 +02:00
jos
22bec13d10 Implement number factories, dependencies. Make matrix and bignumber optional where possible 2019-04-03 09:46:44 +02:00
jos
e6c5df5af5 Fix merge conflicts in row+column PR 2019-03-21 21:51:05 +01:00
bnlcas
0db42306ec Extend std var for variable dimensions request 999 (#1444)
* initial implementation of multidimensional std and var

* consolidated std function into var, cleaned up the interface for var, fixed bias correction

* added documentation of variable axis for std and var

* updated documentation for std and var

* changed the order of normalization and dimension for a three parameter input in the functions

* updated documentation for var and std

* add transform expressions for std and var with variable axis

* added test coverage for std and var with a variable axis

* update to documentation

* change n dim std to use apply function

* fixed tests, removed unnecessary code, updated docs

* fixed typo in docs

* update docs to remove a type

* changed location of apply function

* updated tests to use deepStrictEqual to pass linter

* adding test coverage for var.transform and std.transform
2019-03-20 15:21:55 +01:00
bnlcas
128ed3cd9f Create apply utility request 1359 (#1411)
* add placeholder for apply function

* added apply function

* add test coverage for apply utility

* stylsitic name change in apply source code

* stylistic format change to test

* improved description of function parameters

* moved the apply function to the public matrix functions

* update location and reference of unit test

* fixed function reference paths in apply for location in function

* changed path to apply in apply.test

* make apply a typed function, update unit test

* added typing error test to coverage

* remove apply.test.js from the utils test function

* added transform function for apply

* add unit test for apply.transform.js
2019-03-17 20:15:38 +01:00
Jos de Jong
f9201affba
Merge branch 'develop' into develop 2019-03-10 16:33:12 +01:00
Eric Mansfield
30b45d8633 Fuzzy range endpoint (#1434)
* Fixed unit base recognition and formatting for user-defined units

* Began writing tests for range

* Use fuzzy comparisons for detecting range endpoint
2019-03-10 13:39:13 +01:00
Eric Mansfield
c0ca6da6a4 Gracefully handle round-off errors in fix, ceil, and floor (#1432)
* Fixed unit base recognition and formatting for user-defined units

* Manually copied work from another branch

* Removed semicolons

* Replaced assert.equal with assert.strictEqual

* Added support for bignumber

* Replaced var with const
2019-03-10 13:36:50 +01:00
SzechuanSage
f7364372fb Merge branch 'develop' of https://github.com/SzechuanSage/mathjs into develop 2019-03-08 23:56:31 +10:00
SzechuanSage
4cd4fbba87 Add matrix functions for row and column 2019-03-08 22:26:04 +10:00
jos
6acadd71a0 Create number implementations of all functions in mainNumber.js 2019-03-06 21:49:30 +01:00
jos
5c263d3dff Fixed #1428: transform iterating over replaced nodes 2019-03-05 21:10:59 +01:00
sam-19
9bfdff1d06 Support pow() as an argument for derivative() (#1417)
* Support pow() as an argument for derivative()

Add support for the pow() function as an argument for math.derivative().

Fixes #1259.

* Unit tests for derivatives of pow()

* Support for derivate of pow() function
2019-03-02 10:37:43 +01:00
jos
70cbc3ec30 Replace http urls with https where supported 2019-02-27 13:08:42 +01:00
jos
241d45cbbe Improve use cases, POC of recipes 2019-02-24 15:29:44 +01:00
jos
7d00987a3f Fix #1404: inconsistent rounding of negative numbers 2019-02-20 16:54:10 +01:00
jos
892f8670ef Merge branch 'develop' into modular_architecture_merge
# Conflicts:
#	src/expression/embeddedDocs/index.js
2019-02-09 21:59:32 +01:00
jos
554d2243de Refactor hasNumericValue and sum.transform 2019-02-09 21:56:22 +01:00
jos
ec848b7624 Improve docs of hasNumericValue 2019-02-09 21:55:28 +01:00
jos
049f80248d Add embedded docs for hasNumericValue 2019-02-09 21:55:04 +01:00
jos
83df09800b Merge branch 'develop' into modular_architecture_merge
# Conflicts:
#	HISTORY.md
#	gulpfile.js
#	package-lock.json
#	package.json
#	src/core/function/typed.js
#	src/expression/transform/index.js
#	src/function/statistics/sum.js
#	src/function/utils/index.js
#	src/type/unit/Unit.js
#	src/version.js
#	test/expression/node/FunctionNode.test.js
#	test/type/unit/function/createUnit.test.js
#	test/utils/bignumber/formatter.test.js
#	test/utils/number.test.js
2019-02-09 21:26:25 +01:00
jos
99da53da0e Flatten everything in a mathjs instance to make it consistent with the ES6 exports. Create deprecation warnings for the old classes and functions 2019-02-07 21:24:51 +01:00
jos
e5ccd9cdf1 Remove support for factory names and dependencies containing paths 2019-02-06 11:49:09 +01:00
jos
25be459ed3 Merge math.expression.parse into math.parse 2019-02-03 20:30:43 +01:00
jos
129848f347 Flatten classes under expression.node 2019-02-02 17:52:21 +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