* changes made to the following files:
- mod.js
- gcd.js
* updated BigNumber implementation and added validating tests
* added validating test cases
* updated test cases
* formatted code
* Made updates according to requirement
used mathjs floor in mod.js
imported mod in gcd.js
made mod work for negative divisors
wrote and updated tests to validate new behavior
* updated mod in arithmetic.js
* added tests for modNumber function
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* broadcasting
* Simplified broadcasting
* Updated for broadcasting
* Changed to camel case
* Camel case and auto formating
* Added comments
* Skip if matrices have the same size
* Fixed issue with undefined variable
missing dot in `A._size`
* Implemented broadcasting in all functions
* Added helper functions
* Added function to check for broadcasting rules
* Tests for broadcasted arithmetic
* Fixed issue with matrix the size of a vector
* Documented and updated broadcasting
* Included broadcast.test
* Included math to syntax when missing
* Added print transform and tests
* Simplify conditional
* Included regex in an util
---------
Co-authored-by: David Contreras <david.contreras@guentner.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* added correlation function to statistics
* added implemenation for signature Matrix, Matrix and support for BigNumbers
* reverted changes to default for version numbers of devDepenencies
* reverted changes to default for version numbers of devDepenencies in package-lock.json
* change variable name from xArray, yArray to x and y
* added Matrix as param in index.d.ts
* corrected the file and function names for correlation function
* renamed createCorrelation to createCorr in factoriesNumber.js
* fixed failing test case for matrix and added params and return in corr
* Riemann Zeta Function
* Big Number zeta and added docs
* Original algorithm paper credited
* Update index.d.ts
* Update riemannZeta.js
* Update index.d.ts
* Renamed files to reflect zeta
* chore: make all the tests pass
* chore: refactor `zeta` (WIP)
* chore: reuse the validation logic of both number and BigNumber
* fix: type definitions of `zeta`
* fix: test the accuracy with numbers and BigNumbers (WIP)
* chore: make linter happy
* docs: fix example outputs
* docs: update history
* docs: update history
* docs: describe the limited precision of `zeta`
---------
Co-authored-by: BuildTools <anikpatel1322@gmail.com>
Co-authored-by: Anik Patel <74193405+Bobingstern@users.noreply.github.com>
* Included math to syntax when missing
* Included solveODE
* renamed initialStep as firstStep
* Included tests for solveODE
* Test the full state instead of the final state
* Fixed issue with tolerance
* Added unit signature for y0
* Included units test also for y0
* Included embedded docs and more tests
* Included error for tspan
* It works with bignumbers
* reduced calling bignumber
* extended the search for bignumbers
* The jsdocs is less ambiguous
* included tests for step options
* Allowed for 0 minStep
* Optimization to avoid checking the sign every step
* added dim to quantile
* Included transform
* Removed modification of the docs
I made an unwanted modification
---------
Co-authored-by: David Contreras <david.contreras@guentner.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Included math to syntax when missing
* Included solveODE
* renamed initialStep as firstStep
* Included tests for solveODE
* Test the full state instead of the final state
* Fixed issue with tolerance
* Indexing with an array of booleans
* Indexing with booleans and with empty
* Changed index embedded docs
* removed solveODE
* typos on tests
* included config.predictable
* Throws an error if the size doesn't match
* Included config predictable to get subset
* Can do replacement by broadcasting
* DenseMatrix set can broadcast first
* Added tests for broadcasted subset in the parser
* Faster cloning of deep arrays
* Included docs and better test coverage
* Test coverage for `subset`
* Removed config predictable from subset
* Removed config from index and sparseMatrix
* Redaction and typos
* Cleanup unnecesary changes
* fixed issue when there is no need to broadcast
* Inline ifs
* Included specific broadcasting test
* Reduced repetition
---------
Co-authored-by: David Contreras <david.contreras@guentner.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* fix: #2990 DenseMatrix can mutate input arrays
* chore: simplify internal function `preprocess`
* chore: document ugly workaround of using `matrix.subset` to mutate a nested Array
* chore: better solution for `assign`
* chore: fix linting issue
* chore: add a unit test for `multiply` testing whether the operation is immutable
* chore: fix linting issue
---------
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
* reange refactoring
* update authors
* Made _range to work also for _bigNumbers
* Range with units
* Included some Unit type in _range
* Included TypeScript types for function range
* Formatting
---------
Co-authored-by: David Contreras <david.contreras@guentner.com>
* Add Zpk2tf function
* Add zpk2tf function documentation
* Fix
* Add freqz function implementation
* Fix format
* Add freqz function documentation
* Fix
* Fix format
* Update index.d.ts
* Fix Dependency error
* Fix
* Fix index.d.ts
* Fix Documentation
* Fix Lint
* Fix index.d.ts
* Fix The Matrix parameter support and index.d.ts
* Fix Format
* Add Unit Tests for Matrix cases
* Fix Docs and Lint
* Add tests for coverage
* Fix Format
* Update AUTHORS
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Included math to syntax when missing
* Included solveODE
* renamed initialStep as firstStep
* Included tests for solveODE
* Test the full state instead of the final state
* Fixed issue with tolerance
* Added unit signature for y0
* Included units test also for y0
* Included embedded docs and more tests
* Included error for tspan
* It works with bignumbers
* reduced calling bignumber
* extended the search for bignumbers
* The jsdocs is less ambiguous
* included tests for step options
* Allowed for 0 minStep
* Optimization to avoid checking the sign every step
---------
Co-authored-by: David Contreras <david.contreras@guentner.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Test for roundoff error due to offset
* Set result to exactly 0 if it is within config.epsilon of 0
* Add more offset conversion tests
* Represent degR unit value as a Fraction(5, 9)
* Accurately convert from fraction to bignumber
* Add more tests demonstrating the improved offset conversions
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* test: format bignumber to engineering bug
Add tests for correctly handling starting with more then 3 sig figs and targeting 1 or 2 sig figs
* lint:
* lint: reduce number literal sig figs
* fix: engineering notation for bignumber input
Corrects handling of cases where the input has 3 or more sig figs and the output is set to 1 or 2 sig figs.
* test: add negative format bignumber precision test
* fix: use BigNumber for all branches in toEngineering
Also, remove string type option from JSDoc for toEngineering since string does support the required interface for the function (the .e property, .mul member function, and the .constructor property would not be correct after this change)
* fix: precision 0 for fixed notation and bignumber
This fix differentiates precision === 0 and precision === undefined to.
After fix, format bignumber for precision 0 matches format number for precision 0.
Tests added as well
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* feat: extend function `fraction` with support for units (see #2918)
* fix: update the TypeScript definitions with the new `math.fraction(value: Unit)` support
* feat: implement `math.bignumber(value: Unit)`
* feat: update type definitions of function `math.bignumber`
* fix: linting issue
* feat: implement support for `math.number(unit)` (was formerly throwing an exception)
* #2567: accept array as parameter for gcd()
* #2567: accept 1d matrix as gcd() argument
* #2567: support nested 1d array in gcd
* #2567: simplify matrix signature
* [fix] intersect method parameter type (#2897)
* Update history and authors (see #2897)
* feat: added chirp-z transform to calculate non-power-of-2 fft (#2900)
* added chirp-z transform to calculate non-power-of-2 fft
* simplify/remove _ifft function inside _czt function
* chore: remove an unused dependency from `simplifyConstant`
* fix: quantileSeq not accepting a matrix as second argument `prob` (see #2902)
* fix a broken example of function `to`
* fix a typo in the examples functions `distance`, `getMatrixDataType`, `subset`, and `max` (see #2902)
* fix linting issue
* Broadcasting (#2895)
* broadcasting
* Simplified broadcasting
* Updated for broadcasting
* Changed to camel case
* Camel case and auto formating
* Added comments
* Skip if matrices have the same size
* Fixed issue with undefined variable
missing dot in `A._size`
* Implemented broadcasting in all functions
* Added helper functions
* Added function to check for broadcasting rules
* Tests for broadcasted arithmetic
* Fixed issue with matrix the size of a vector
* Documented and updated broadcasting
* Included broadcast.test
---------
Co-authored-by: David Contreras <david.contreras@guentner.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Update history and authors
* Update devDependencies
* publish v11.6.0
* fix#2906: improve description of the behavior of `subset` for scalar values in the docs
* fix#2907: determinant of empty matrix should be 1
* chore: add a few more unit tests to `det`
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
Co-authored-by: Jaeu Jeong <wodndb@gmail.com>
Co-authored-by: cyavictor88 <100557319+cyavictor88@users.noreply.github.com>
Co-authored-by: David Contreras <dvd.cnt@gmail.com>
Co-authored-by: David Contreras <david.contreras@guentner.com>
* broadcasting
* Simplified broadcasting
* Updated for broadcasting
* Changed to camel case
* Camel case and auto formating
* Added comments
* Skip if matrices have the same size
* Fixed issue with undefined variable
missing dot in `A._size`
* Implemented broadcasting in all functions
* Added helper functions
* Added function to check for broadcasting rules
* Tests for broadcasted arithmetic
* Fixed issue with matrix the size of a vector
* Documented and updated broadcasting
* Included broadcast.test
---------
Co-authored-by: David Contreras <david.contreras@guentner.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Simplify: add two (term collection) noncommutative context std. rules
These additions permit the valid application of rules to exprs
including:
- For new rule 'vd + n*vd -> (1+n)*vd'
'a+2*a' -> '(1+2)*a'
- And new rule 'cd + cd*n -> cd*(1+n)'
'4+4*b' -> '4*(1+b)'
* Simplify: add non-commutative context term factoring rule
'n^n1 * n -> n^(n1+1)'
Also updates extant NC-context simplify tests which now apply this rule
successfully
* Add and restructure non-default context simplify tests
In addition to refactoring and splitting current tests into
describe/it blocks, also adds test block:
'should still validly apply (term factoring and collection) rules'
For ensuring simplify rules marked with
'context.[add/multiply].commutative: false' apply; simultaneously
validating that simplifications still occur as expected in these
contexts.
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Improve standard simplify rule matches in non-commutative contexts
Addresses the rule application limitation aspect as highlighted in
issue #2825; such that a broader set of successful standard replacement
rules are applied to multi-arg/associative expressions in
non-commutative contexts.
* Remove 'clone()' operations on expanded simplify rules
since original rule nodes (including expanded variations) are essentially
readonly objects, cloning of expanded rule LHS' is unnecessary during
canonicalization
* Hoist non-commutative context expanded rule app. in simplify (applyRule)
* Add two simplify non-commutative ctx. test cases
* feat: add polynomialRoot function
This is intended as a benchmark for general arithmetic/basic algebra
functionality of mathjs, but was chosen to be something of potential
independent utility as well, worth adding to mathjs in its own right.
Currently ol=nly computes the numerical roots for real or complex
polynomials of degree three or less.
As usual, adds documentation, embedded documentation, tests, TypeScript
declaration, and TypeScript tests.
Also updates doc.test.js to make it easier to specify an array of complex
numbers as the expected output, and comapres with the appropriate fuzz
in such cases.
Finally, adds a benchmark that computes the roots of all cubics with
nonnegative integer coefficients no larger than five.
* doc: fix typo in polynomialRoot embedded docs
Thanks, SamuelTLG
* style: avoid slightly cryptic Boolean flag stand-in
* Added matrix functions `schur`, `sylvester` and `lyap`
* Added docs for `schur`, `sylvester` and `lyap`
* Added unit tests for `schur`, `sylvester` and `lyap`
* Fixed lint and tests errors
* fixed typescript and added Matrix + Array tests
* lint fixed
* fixed example in sylvester.js doc
* Fixed docs and ci
* fixed definition of lyap and sylvester
* remark on diff defs for lyap
* rm a trailing space
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Create wildcards.js and implement basic type detections
* Remove isUnit from isConstantExpression wildcard
isUnit would never be encountered because units are stored as a part of ConstantNodes.
* Add matching for the new wildcard rules
* Add tests for the new wildcard rules
* Remove comment regarding Unit
* Seperate wildcard import into individual imports
* Update comments at top and change '*i' to '*d'
* Seperate Unit Tests
* Update simplify documentation comment
* Add unit test for #1406
* Update imports for new build system
* Update simplify test with new rules syntax
* Fix small documentation errors
* Update simplify rules to use new wildcards
* Add tests for rules updated with new wildcards
* Remove duplicated comment information
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Simplify: improve constant op. eval. in non-commutative contexts
Addresses the constant evaluation aspect as discussed in #2825.
Changes in simplifyConstant.js are accredited to @gwhitney
* Add simplifyConstant test for expr. with a non-evaluable constant
(uncomments a pre-existing test suggestion for an 'incomplete'
simplification example, more specifically)
Additionally adds commented TODO tests for additional expr. variations
with current incomplete simplification (non-commutative context)
* fix#2818: throw an error when a function assignment has duplicate parameter names
* fix linting and code issue
* fix broken unit test
* Make linter happy
* Add a test case `['x', { name: 'x' }]`