322 Commits

Author SHA1 Message Date
David Contreras
10602fdbfd
feat: matrix subset according to type of input (#3485) 2025-07-16 10:40:13 +02:00
Jos de Jong
6b3b722140 chore: update unit test 2025-07-11 12:09:49 +02:00
Jos de Jong
311485f478 Merge remote-tracking branch 'origin/v15' into v15
# Conflicts:
#	AUTHORS
#	HISTORY.md
#	src/expression/parse.js
#	test/unit-tests/expression/parse.test.js
2025-07-11 11:54:30 +02:00
Jos de Jong
ba88f47be9
fix: #3421 require a space or delimiter after hex, bin, and oct values (#3463) 2025-07-11 11:47:13 +02:00
Glen Whitney
b44172bae9
fix: #3501 parse % as unary only when not followed by a term (#3505) 2025-07-04 16:26:25 +02:00
Glen Whitney
5655d71e06 Feat: Enhance Kronecker product to handle arbitrary dimension (#3461)
Previously `math.kron()` always returned a 2D matrix, and could not handle 3D or greater arrays. Now it always returns an array of the max dimension of its arguments.

Resolves #1753.
---------

Co-authored-by: Delaney Sylvans <delaneysylvans@gmail.com>
2025-07-03 13:35:46 -07:00
Kip Robinson
9aad1a043e feat: give unary % operator (percentage) higher precedence than binary % operator (modulus) (#3432) 2025-07-03 13:32:32 -07:00
Jos de Jong
8e76654c7f Merge branch 'develop' into v15
# Conflicts:
#	AUTHORS
#	HISTORY.md
2025-06-04 10:45:11 +02:00
Don McCurdy
f3587d8634
fix #2199: parse non breaking white space &nbsp; as white space (#3487) 2025-06-04 09:42:37 +02:00
Jos de Jong
943141893a fix: add embedded docs for the deprecated physical constant coulomb, see #3472 2025-05-29 10:13:43 +02:00
Delaney Sylvans
7a617b1ee2
fix: support multiplication of arrays with units (#3456) 2025-05-28 17:00:58 +02:00
Jos de Jong
123d4aac9d fix: #3472 rename physical constant coulomb to coulombConstant 2025-05-28 16:45:24 +02:00
Carl Osterwisch
bec75ed18a
fix: correctly parse (lbf in) (#3476) 2025-05-21 15:12:52 +02:00
David Contreras
f9cb08d77e
feat: define embedded docs for compile, evaluate, parse, and parser, and add test for the examples in embedded docs (#3413) 2025-04-25 17:12:25 +02:00
Glen Whitney
72a2442c32
Feat: Enhance Kronecker product to handle arbitrary dimension (#3461)
Previously `math.kron()` always returned a 2D matrix, and could not handle 3D or greater arrays. Now it always returns an array of the max dimension of its arguments.

Resolves #1753.
---------

Co-authored-by: Delaney Sylvans <delaneysylvans@gmail.com>
2025-04-22 17:08:21 -07:00
Kip Robinson
4f748d22ec feat: give unary % operator (percentage) higher precedence than binary % operator (modulus) (#3432) 2025-04-22 15:59:02 -07:00
Jos de Jong
c3ee5ba397
fix: Use matching type for one when operating with valueless unit and a number (#3454)
Previously, when a valueless unit multiplied/divided something with a numerical value, it would just use ordinary 1 of type `number` in place of its null value. Now it matches the type of one used with the other numerical value.

Resolves #3450.
---------
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2025-04-16 12:56:57 -07:00
Orel Ben Neriah
9a82b5c28e
feat: add LaTeX representation for fractions and corresponding tests (#3434) 2025-03-28 13:59:09 +01:00
aitee
b5773df3c0
fix: nthRoots latexFunctions template string (#3427) 2025-03-26 19:00:52 +01:00
Jos de Jong
e5bb6465a9
fix: #3422 parse dot operators after an implicit multiplication with symbol E (#3425) 2025-03-19 09:23:09 -07:00
Jos de Jong
1fc742aaf1 fix: #3350 cannot import a constant that is a complex number 2025-02-28 16:28:04 +01:00
Orel Ben Neriah
4039df04ca
fix: #3387 use utility isNaN for consistent max and min results (#3389)
* fix: use utility isNaN for consistent max and min results

* test: add NaN comparison cases for larger and smaller functions

* docs: update descriptions for larger, smaller, max, and min functions to clarify NaN behavior

* refactor: rename isNaN to mathIsNaN for extra clarity

---------

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-02-28 15:19:28 +01:00
Jos de Jong
49bb70fcaf chore: update HISTORY.md, fix a typo 2025-02-20 14:22:33 +01:00
David Contreras
307c9dbca7
fix: issue in callback optimization and add error handling for invalid argument types (#3394)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-02-20 14:16:01 +01:00
David Contreras
40c09c5e76
refactor: simplify flatten function using Array.prototype.flat (#3354)
* refactor: simplify flatten function using Array.prototype.flat

* Added fallback

* added option to flatten arrays with homogeneous size

* Typos in array.js and array.test.js

* fix types in jsdocs

* Renamed variable

* Reverted to original form

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-02-17 17:19:13 +01:00
Glen Whitney
127ea626fc
feat: #3041, #3340 rename apply to mapSlices (#3357)
* chore: Rename `apply` to `mapSlices`

  This renaming conforms with the Julia name for the function formerly
  called `apply`, and allows it to be called from the expression parser.
  The previous name `apply` is kept as an alias for `mapSlices`, for
  backward compatibility. This commit implements an `alias` metadata
  property for function factories to facilitate the `apply` alias for
  `mapSlices`.

  As a separate bonus, this PR corrects several typos in function docs
  and removes now-passing doc tests from the list of "known failing" doc
  tests to get down to 45 known failures and 136 total issues in doc tests.
  (Most of the excess of 136 as compared to 45 are just due to roundoff
  error/slight inaccuracy of what the documentation claims the result will
  be and the actual result returned by mathjs. When the 45 are eliminated,
  a reasonable numeric tolerance can be decided on for doc testing and
  then the doc tests can be made binding rather than advisory.

* refactor: changes per PR review

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-01-30 13:19:23 +01:00
Glen Whitney
1a85b8796a
fix: #3360 add bigint support to matrix indices and ranges (#3361)
* fix: Accept bigints as matrix indices and range params, demoting to number

* feat: bigint support in range(), clarify demotion in Range()

* feat: range() support Fraction, better errors for single non-string argument

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-01-30 13:07:24 +01:00
Glen Whitney
773a5c5cff
fix: #3247 don't override type-native floor/ceil within tolerance of value (#3369)
* fix: Don't override type-native floor/ceil when within tolerance of value

* refactor: extend bigint safety to round and fix

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-01-30 12:55:44 +01:00
Jos de Jong
0b2887be64 chore: cleanup unused function isIntegerStr and const DBL_EPSILON 2025-01-24 11:04:14 +01:00
Glen Whitney
8510b850ad
fix: handle bigints properly in more cases (#3345)
* fix: Handle bigints properly in more cases
  * Allow a bigint to appear in a max/min of nonhomogeneous arguments
  * If randomInt is called with a bigint or a pair of bigints, return
    a bigint.
  * Preserve uniformity of results if randomInt is called with a very large
    range.
  * Extend log, log2, and log10 to bigints
  * Add tests for all of the above issues.
  * Bonus: fix one JSDoc comment issue. If every PR fixes one, we will soon
    get through the 150+

* fix: Refactors per comments and 1 bonus doc test (isInteger)

* chore: fix lint

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-01-24 10:59:13 +01:00
Jos de Jong
b5d635e5b8
fix: #3342 hexadecimal input not turned into a bigint (#3348) 2025-01-24 10:40:01 +01:00
Jos de Jong
1354f5d601 chore: cleanup temporary test again 2024-12-13 14:44:43 +01:00
Jos de Jong
ad27e77fd0 chore: test CI outputs when a test is failing 2024-12-13 14:41:12 +01:00
Paul Korzhyk
e0d56d2da7
fix: make derivative much faster (#3322) 2024-11-28 13:37:42 +01:00
Jos de Jong
52bcd8fee0 feat: upgrade to fraction.js@5.2.1 and implement support for log(x: Fraction, base: Fraction) 2024-11-20 11:57:10 +01:00
Jos de Jong
e93780e6d5 Merge branch 'develop' into v14 2024-11-20 11:41:30 +01:00
Jos de Jong
67ddc724e1 fix: #3260 improve type definitions and documentation on the callback indices of map, filter, and forEach 2024-11-20 11:32:11 +01:00
Jos de Jong
e00d3678c6 fix: #3323 support functions in function clone 2024-11-20 10:34:59 +01:00
Jos de Jong
6cf8a2744c Merge branch 'develop' into v14 2024-11-13 10:16:33 +01:00
Neeraj Kumawat
f6a065718b
fix: #1455 implicit multiplication of a fraction with unit 'in' is incorrect (#3315) 2024-11-13 08:47:19 +01:00
Neeraj Kumawat
d0f8b2b800
fix: #3301 precedence of % (mod) is higher than * and / (#3311) 2024-11-07 12:08:35 +01:00
Neeraj Kumawat
eb5e4932c1
fix #3290: should validate variables names in the method Parser.set (#3308)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-11-06 17:41:50 +01:00
Jos de Jong
301d00e8a5
feat: upgrade to fraction.js@5 (#3312) 2024-11-06 17:25:31 +01:00
Jos de Jong
ca891837f9 Merge branch 'develop' into v14
# Conflicts:
#	package-lock.json
#	package.json
2024-11-06 17:18:05 +01:00
Jos de Jong
22db7d2df3 Revert "feat: upgrade to fraction.js@5 (#3283)"
This reverts commit 9b81230950b5bed113817dc4ec7803df7e51313e.
2024-11-06 17:14:16 +01:00
Jos de Jong
9b81230950
feat: upgrade to fraction.js@5 (#3283) 2024-11-06 17:08:26 +01:00
Jos de Jong
837769c748
fix: #3222 prevent math.import from overriding units (#3225) 2024-11-06 17:05:35 +01:00
Akki
66775ee8b5
fix: #3219 updated matAlgo07xSSf algorithm to return sparse matrix (#3307) 2024-11-06 17:02:02 +01:00
Jos de Jong
a9e5a208d0 chore: cleanup HyperExecute error reporting 2024-11-04 11:54:25 +01:00
Jos de Jong
e3d40abd82 chore: test HyperExecute error reporting 2024-11-04 11:53:58 +01:00