4617 Commits

Author SHA1 Message Date
Jos de Jong
fca1d492fd Fix tests on IE11 2022-04-19 14:15:10 +02:00
Jos de Jong
65e3df98d7 Fix isInternetExplorer test 2022-04-19 14:06:24 +02:00
Jos de Jong
da4fdd465d Make IE11 happy 2022-04-19 13:54:59 +02:00
Jos de Jong
cc193bf96b Add some extra, temporary output to approx equal 2022-04-19 13:49:22 +02:00
Jos de Jong
1628d37ece Test lgamma on IE11 with less precision (next try...) 2022-04-19 13:37:34 +02:00
Jos de Jong
3462f3d881 Test lgamma on IE11 with less precision 2022-04-19 13:32:16 +02:00
Jos de Jong
90a34959d8
Test lgamma on IE11 with less precision (#2527)
* Test lgamma on IE11 with less precision

* Fix testing whether on IE when on Nodejs 12 😂
2022-04-19 13:26:48 +02:00
Jos de Jong
cbeb916c35 Update history 2022-04-14 20:11:10 +02:00
Glen Whitney
80571b7f50
fix(sin): Update to latest complex.js to improve sin(z) for small im(z) (#2525)
Resolves #2523
2022-04-13 07:32:27 -07:00
Divya Yeruva
ac332e6754
Removed the incorrect mail of mine (#2524)
(But we still need to take steps to prevent it from recurring.)
2022-04-12 17:31:27 -07:00
Jos de Jong
ff2f7f089f
test: change mocha reporter to dot (#2520)
Alleviates excessively long log files. Also remove a stray console.log from one of the tests.
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2022-04-11 20:31:34 -07:00
yifanwww
b3f564f266
feat: Implement lgamma function -- log(gamma(z))) -- for number and Complex (#2417)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2022-04-11 20:00:16 -07:00
Jos de Jong
c2183c7943 Update history 2022-04-11 12:23:28 +02:00
HanchaiN
c3003be560
Optimize functions (det) (#2516)
* Optimize `det`

Use Bareiss algorithm.
The performance is preserved but lessen the round-off errors.

* Optimize `det`

Use index mapping instead of swapping the rows directly.
Run the benchmark to compare the performance.

* Edit test file

Replace `approx.equal` with `assert.strictEqual`.
The test will fail with the previously implemented LU decomposition.

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2022-04-11 12:20:38 +02:00
HanchaiN
7480c11bf7
feat: implement negative integer exponents for square matrices (#2517)
Resolves #2463

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2022-04-08 12:15:54 -07:00
Jos de Jong
36e7e46289 Publish v10.4.3 v10.4.3 2022-04-08 10:21:03 +02:00
Jos de Jong
29555c04d5 Update history 2022-04-05 17:53:24 +02:00
Jos de Jong
9e2c13ae9f Update history 2022-04-05 09:11:05 +02:00
Glen Whitney
2051fb1412
fix: Allow base argument to log in number-only module (#2515)
Provides a number-only factory for `log` with both signatures 'number'
  and 'number,number'.

  Resolves #2514.
2022-04-04 17:51:41 +02:00
Glen Whitney
f33414a8f7
test(Unit): record questionable cases for unit multiplication (#2513)
This commit captures the cases raised in #2500 as a pending test,
  so that it will be easy to re-check them once UnitMath has been
  adopted.
2022-04-02 22:15:15 -07:00
Glen Whitney
6fbdf767ef
docs(syntax): Highlight ; and update implicit multiplication (#2512)
Partially responsive to #2511.
2022-04-02 09:14:08 -07:00
Jos de Jong
c91d34d634 Update history 2022-04-01 16:25:13 +02:00
Glen Whitney
ecbd877643
fix(combinatorics): Improve precision of stirlingS2 (#2509)
* fix(combinatorics): Improve precision of stirlingS2

  Previously the computation of stirlingS2 used the closed form, which
  suffers numerically by dividing a sum of very large terms by a large
  factorial, causing roundoff errors for unnecessarily small inputs.

  This commit switches to using the recurrence relation for the stirling
  numbers of the second kind, and caching the partial results for future
  calls. This has the advantage that all intermediate results are smaller
  than the final value.

  Also adds tests for much larger values of the stirlingS2 function and of
  bellNumbers, whose computation depends on stirlingS2.

  Resolves #2508.

* fix(stirlingS2): Correct lint errors.
2022-04-01 16:23:53 +02:00
Jos de Jong
f89ee9cd83 Publish v10.4.2 v10.4.2 2022-03-29 08:58:01 +02:00
David Contreras
26a0eb7dc5
Included example for embedded documentation (#2507)
Included example as a reference that works inside the expression parser
2022-03-29 08:38:12 +02:00
Jos de Jong
52d195a0ef Update history 2022-03-28 11:54:15 +02:00
Glen Whitney
aa5c9eef76
fix(Unit): Avoid using unit offsets too much (#2501)
Incorporating unit offsets into the internal "value" of the unit
  causes more problems than it solves. This commit ends that practice
  and instead only uses the offset when converting units or when
  computing the absolute value of a unit.
  Further, it makes it an error to compute the sign of a unit with an
  offset, since that is inherently ambiguous: there is no way to tell
  whether "-5 degC" is a temperature change, in which case it is definitely
  negative, or if it is a specific temperature of something, in which case
  it is "positive" in the sense of being above absolute zero.
  (Unclear how valuable this latter concept is anyway, given that there are
  no negative temperatures possible in that sense...)
  Adds several tests for the various problems the former practice caused,
  including all four basic arithmetic operations on units with offsets.

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2022-03-28 11:51:41 +02:00
Jos de Jong
16a191b9ee Update history 2022-03-28 11:05:08 +02:00
Glen Whitney
c9354ee1a9
chore: Bump complex.js to version 2.1.0 (#2505)
Also adds tests for math.log() of complex numbers in which the imaginary
  part is much larger in absolute value than the real part.
  Resolves #2503.

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2022-03-28 11:02:52 +02:00
yifanwww
6562edfb21
feat: Improve approx.deepEqual, to support epsilon (#2504)
fix(approx): Make `approx.deepEqual` respect tolerance argument

  Tests already contained calls of the form 
  `approx.deepEqual(A, B, epsilon)` but the comparison tolerance
  argument epsilon was being silently ignored. This commit fixes
  that oversight and corrects a couple of tests to reflect the finer-
  grained testing.

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2022-03-27 22:32:59 -07:00
Jos de Jong
936b7411ae Update history 2022-03-25 16:35:58 +01:00
David Contreras
c9f88f7d3c
Fixed a formula and changed R to degR (#2498)
Changed `R` to `degR` as there is no unit `R`

`math.createUnit('mile', '1609.347218694', {override: true}})` has a syntax error (an extra `{` ) and is missing units, changed it to `math.createUnit(('mile', '1609.347218694 m', {override: true})` as I think was the original intention.

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2022-03-25 16:35:09 +01:00
Jos de Jong
487bf55d2f Update history 2022-03-25 16:11:39 +01:00
Glen Whitney
ba3c58e984
fix(FunctionNode): Improve error message when a non-function is called (#2494)
* fix(FunctionNode): Improve error message when a non-function is called

  Also adds tests for as many different varieties of function calls
  and their associate messages when the entity being called is not
  a function as I could come up with.

  Resolves #2493.

* feat(format): Add a truncate option to limit result length.

  Also uses the new option in FunctionNode.js to limit the length of the value
  portion of its new error messages. (As requested in review)

* docs: Add 'truncate' option to the list in the exported version of 'format'
2022-03-25 16:09:33 +01:00
Jos de Jong
c81700c21c Publish v10.4.1 and update dependencies v10.4.1 2022-03-23 12:08:43 +01:00
Glen Whitney
bb434c811c
fix(eigs): Correct tracking of transforms in generating complex eigenvectors (#2496)
Also adds the test case that revealed the problem and corrects the other test
  case that could have found it except the tolerance had been cranked up very
  high.

  Resolves #2478.
2022-03-23 11:57:48 +01:00
Jos de Jong
4f83b786ea Add benchmark to test loading time of a mathjs instance 2022-03-21 17:53:12 +01:00
Jos de Jong
b7bf3896bb Update history 2022-03-21 15:16:03 +01:00
Glen Whitney
7583eac61a
fix(parse): Allow (and ignore) comments wherever white space would be (#2492)
Resolves #2491.
2022-03-21 14:31:31 +01:00
Chris Chudzicki
99839a8da3
Add TypeScript definitions for src/utils/is.js (#2432)
This is a first step toward full publication of these functions,
that were already being exported by mathjs but had not yet
had the associated actions (documentation/available in 
parser/typed, etc.) Also, makes most of them into TypeScript
type guards, and adds Matrix as a constructor type. Resolved #2431.

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2022-03-17 16:17:32 -07:00
Jos de Jong
ec39c5f3cf Run Node.js CI tests on any branch 2022-03-17 17:33:44 +01:00
NattapongSiri
b8d2e81ee7
fix(TypeScript): Make dim argument optional for std and variance (#2474)
Also adds TypeScript test cases for these functions.

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2022-03-16 14:01:43 -07:00
Jos de Jong
d2dc87a865 Update history and authors 2022-03-15 17:41:23 +01:00
Sinan
408094a7a4
Added unit(unit: Unit) TS overload (#2479)
* Added unit(unit: Unit) TS overload
2022-03-15 17:40:54 +01:00
Jos de Jong
1a3401e95b Update history 2022-03-10 10:21:42 +01:00
Sam Estep
bb9eb4e0ec
Add checks for type declarations (#2448)
* Add overloads for Matrix add and subtract

* Add check for types/index.ts

* Fix type errors in types/index.ts

* Fix a couple execution errors

* Run test:types as part of test:all

* Fix remaining errors

* Replace types/index.ts comments with asserts

* Add tests for narrowed type inference

* Add dual-purpose comment at top of types/index.ts

* Update AUTHORS

* Use Glen's alternate test:types suggestion
2022-03-08 15:59:35 +01:00
Jos de Jong
9ac5a67c71 Publish v10.4.0 v10.4.0 2022-03-07 12:33:07 +01:00
Jos de Jong
3166b7f57b
Gwhitney doctesting (#2471)
* test: Add unit tests for all of the examples in (jsdoc) comments

  Uses the existing extraction of examples from tools/docgenerator.js
  Hence, for now this is limited to documentation of functions, but
  hopefully it can be extended to classes, units (and physical constants),
  and constants as well in the future.

  Exposes numerous errors in the examples, some of which are bugs; these
  are for now put on a known error list to be worked on, so that this
  PR does not change a huge number of source files.

  Also adds a test to check that all symbols are documented (which
  similarly doesn't really pass at the moment, and is patched to a
  hopefully temporary warning).

* refactor: Make doc.test.js into a node test

  The source code is not available in its layout as in the repository in
  the browser tests, so the new doc testing can only occur in the node tests

* Add simplifyCore, symbolicEqual, map, and resolve to the list with functions with known issues in the jsdoc examples

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2022-03-07 11:50:42 +01:00
Jos de Jong
8f9624b2e6 Update history and authors 2022-03-07 10:59:55 +01:00
Glen Whitney
489c6cf8cd
chore: Update to latest fraction.js (#2467)
Resolves #2427.

  Also adds tests verifying that creating a fraction from two numbers
  requires them both to be integers, and slightly updates documentation.

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2022-03-07 10:35:22 +01:00