127 Commits

Author SHA1 Message Date
Vrushaket Chaudhari
1ee8733832
added correlation function to statistics (#3015)
* 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
2023-09-01 13:38:49 +02:00
Jos de Jong
e36f90e1a8
Implement function Riemann Zeta (#2975, #2950)
* 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>
2023-08-23 15:50:11 +02:00
David Contreras
8fe5e517d6
feat: support units in range (#2997)
* 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>
2023-07-19 11:55:53 +02:00
Aly Khaled
8475ab997b
zpk2tf and freqz functions implementation (#2988)
* 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>
2023-07-13 17:23:50 +02:00
Jos de Jong
6db3df2eee fix: #2972 type definitions of Unit.divide(Unit) have a wrong return type 2023-06-20 11:40:40 +02:00
Jos de Jong
29db0fb288 fix: #2971 improve typings of statistics functions min, max, mean, median, mode, std, sum, prod, variance 2023-06-20 11:33:38 +02:00
Kiku
1b06ec4b81
fix #2964: distance from point to line (#2965)
some additional unit tests, types and doc fix for distance function

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2023-06-13 11:02:57 +02:00
Maxim Mazurok
5b53fff681
feat: better min/max return type (#2955) 2023-05-22 21:39:41 +02:00
Jos de Jong
db3e62e5c3
feat: extend functions fraction, bignumber, and number with support for units, see #2918 (#2926)
* 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)
2023-04-03 13:48:24 +02:00
brunoSnoww
079300f183
Fix gcd type (#2922)
* refactor gcd type

* add tests

* just refactor gcd...

* little change on test

* update gcd chain
2023-03-27 09:49:19 +02:00
brunoSnoww
2a050cd154
chore: refactor index.d.ts (#2913)
* refactor index.d.ts

* testTypes fixes

* add string to unaryPlus type

* add string to unaryPlus chain type

* use mathnumerictype instead and remove fraction from trigonometric functions

* code review

* code review
2023-03-14 08:35:35 +01:00
Jos de Jong
218ae5a3e9 Update history and authors (see #2897) 2023-02-16 16:59:45 +01:00
Jaeu Jeong
375a1477ae
[fix] intersect method parameter type (#2897) 2023-02-16 16:57:06 +01:00
Jos de Jong
391677f9e0 fix #2888: update type definitions of function unit to allow creating a unit from a fraction or complex number 2023-02-02 10:32:06 +01:00
brunoSnoww
654e1b7357
Refactor dotMultiply, dotPow and dotDivide types (#2890)
* refactor types

* refactor on chain types

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2023-01-31 17:21:36 +01:00
Jay Wang
78a593bbb5
Change types in matrix map() and forEach() (#2887)
* Change types in matrix map() and forEach()

* Add new line in the end of index.d.ts

Signed-off-by: Jay Wang <xiao.hk1997@gmail.com>

---------

Signed-off-by: Jay Wang <xiao.hk1997@gmail.com>
2023-01-31 17:15:22 +01:00
Ari Markowitz
ac0ffb7d15
Add numeric types to complex() type declaration (#2886) 2023-01-30 11:31:13 +01:00
Jos de Jong
c7160589b7 fix linting issue of #2864 2023-01-06 11:28:08 +01:00
Evan Miller
cb5a4e9743 lint 2023-01-05 09:07:03 -05:00
Evan Miller
17cfd8b944 Add type signature for lusolve(LUDecomposition, ...) 2023-01-04 14:00:54 -05:00
brunoSnoww
0c6e832ab7
Fix: Add "rotationMatrix" function type (#2860)
* fix: add rotation matrix type

* remove mistaken test

* code-review: refactor type and add tests for it
2022-12-09 16:33:58 +01:00
Jos de Jong
eb9b56db88 Publish v11.5.0, update devDependencies, fix linting issue 2022-12-05 10:54:14 +01:00
Henry Chan
360ce0125b
Fix correct types for multiply() (#2852)
Fix correct types for `multiply( number[][], number[] )`, `multiply( number[], number[][] )` and `multiply( number[][], number[][] )`

Type errors were introduced with https://github.com/josdejong/mathjs/pull/2623/files which used MathArray directly (where MathArray could be number[] or number[][]), causing the return type to be number[] | number[][].

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2022-12-05 10:46:30 +01:00
Glen Whitney
f6d3e9ea8d
feat: add polynomialRoot function (#2839)
* 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
2022-11-18 15:53:45 +01:00
Jos de Jong
b050d5ed5d Fix the docs and types of forEach, which returns void (see #2840) 2022-11-18 10:18:59 +01:00
Lucas Egidio
a2e85ca698
Added functions: schur, sylvester, and lyap (#2646)
* 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>
2022-11-17 17:16:21 +01:00
Jos de Jong
b9678ca029 Fix #2840: a bug in the type definition of Node.traverse, and update history 2022-11-16 09:21:19 +01:00
Jos de Jong
0a810abba3 Fix a regression in the type definitions of FunctionNode, introduced in v11.3.2. See #2733 2022-11-07 10:09:16 +01:00
Matt Vague
f79517f166
Types/add generics to remaining node types (#2733)
* Add generic args for FunctionNode

* Add generic args for AccessorNode

* Add generic args for ArrayNode

* Add generic args for AssignmentNode

* Add generic args for BlockNode

* Add generic args for ConditionalNode

* Add generic args for ConstantNode

* Add generic args for FunctionAssignmentNode

* Add generic args for IndexNode

* Add generic args for ObjectNode

* Add generic args for RangeNode

* Add generic args for RelationalNode

* Change default constant node type to number
2022-10-20 09:18:05 +02:00
Jos de Jong
9ca8f2d2ad Fix type definition reported in #2609 2022-10-19 15:10:21 +02:00
Jos de Jong
5e439be0a8
Fix #2809: code completion issues in some IDE's (#2812)
* Move types/index.ts to test/typescript-tests/testTypes.ts (WIP)

* Fix the paths for the test:types script

* Move tsconfig.json to the root
2022-10-19 08:23:14 +02:00
BOUYA Med. Salim
c6883db0d3
fix #2603: added type definition for onUndefinedSymbol & onUndefinedFunction (#2610)
* fix #2603: added type definition for SymbolNode.onUndefinedSymbol and FuctionNode.onUndefinedFunction

* fix return type of onUndefinedFunction

* fix return type of onUndefinedFunction

* fix onUndefinedSymbol & onUndefinedFunction types, added examples

* update onUndefinedFunction ts example
2022-10-18 10:42:50 +02:00
Hanchai Nonprasart
822ea2a1c7
fix(pinv): write a typescript definition and test (#2804)
* fix(pinv): write a typescript definition

* fix(pinv): write a typescript test

* fix(pinv): format types/index.ts

* fix(pinv): format types/index.ts

* fix(pinv): format types/index.d.ts

* fix(pinv): format types/index.ts

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2022-10-11 11:14:58 +02:00
Matt Vague
2294ebded7 Switch MathNode and MathNodeCommon 2022-09-12 12:29:42 -07:00
Matt Vague
8e116a36f1 Fix target 2022-09-12 12:26:31 -07:00
Matt Vague
2de83dde17 Fix specs 2022-09-12 12:26:16 -07:00
Matt Vague
2c4dd5e88e Make it possible to extend base Node type without typescript being angry 2022-09-12 12:26:15 -07:00
Jos de Jong
194725727a Fix type definition and TS example of chained pickRandom (see #2770) 2022-09-09 14:37:57 +02:00
Jos de Jong
00f3e485ef Fix linting issues 2022-09-09 12:51:18 +02:00
Matt Vague
fcabc9722b Whoops change types to how mathjs actually works 2022-09-08 17:46:48 -07:00
Matt Vague
be97efa9a0 Add pickRandom types for chain too 2022-09-08 17:43:15 -07:00
Matt Vague
546d03c427 Add examples for pickRandom types 2022-09-07 10:14:58 -07:00
Matt Vague
b2e83e6bd7 Fix types for pickRandom
The TS type for pickRandom currently restricts the given array to numbers, however (AFAIK) it doesn't actually care what the array given to it contains.

This PR:
- Uses a generic to type the given array
- Varies the return type (T or T[]) depending on the given args
2022-09-06 19:14:48 -07:00
Abdullah Adeel
dbfce94f7a
🔧 fixed typos in min func type defs (#2768) 2022-09-06 14:36:39 +02:00
Jos de Jong
4e58ccc666 Merge branch 'utils/add-is-relational-node-function' of github.com:goodproblems/mathjs into goodproblems-utils/add-is-relational-node-function 2022-09-02 16:24:41 +02:00
Isaac B
f4f44a84aa Rebased with main 2022-08-30 17:12:22 -07:00
Isaac B
6e6f726a2f Update test and definitions 2022-08-30 17:10:27 -07:00
Ajinkya Chikhale
5649892952
Added missing types 'largerEq' and 'or' in OperatorNodeMap (#2681) 2022-08-30 17:34:05 +02:00
Isaac B
b990bd2be4
Merge branch 'develop' into utils/add-is-relational-node-function 2022-08-29 10:15:35 -07:00
Isaac B
47a12807d4 Add isRelationalNode function 2022-08-29 10:13:48 -07:00