* feat: toBest tests
* feat: toBest function initial
* fix: tests and function changes
* fix: dependencies
* new way to handle
* updated tests
* test updated
* tests fixed
* cleaned useless tests
* cleaned useless condition
* fix: missing comments
* fix: moved tests
* other fix and clean
* change test to work with npx mocha "path" -g "toBest"
* deleted check large and small value
* deleted precision test and fix options to bestprefix
* fix: moved toBest tests in correct file
* fix: math create
* fix: aligned files pre-mr
* fix: toBest docs test
* fix: lint issues
* fix: comments
* fix: added a helper function to simplify the test readability
* fix: unit.md and units.md docs updated
* fix: test on units.length
* added post process denormalize for tobest function to string returned value
* removed this.clone into format
* feat improve incompatible units test
* fix assign prefixes
* fixed examples
* changed order of params of assertUnit
* fixed comments and added toBest in knowProblems at doc.test
* refactor: update toBest functionality and adjust related tests for accuracy
* refactor: remove unnecessary offset initialization in prefix application
---------
Co-authored-by: Luca Quercetti <l.quercetti@wecodeyou.it>
Co-authored-by: Elia Alesiani <elia.alesiani@gmail.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
Co-authored-by: lucaQ <lucaquercetti@gmail.com>
Co-authored-by: EliaAlesiani <105418798+EliaAlesiani@users.noreply.github.com>
* 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>
* fix: disable parser functions in the CLI (security issue)
* fix: ensure `ObjectWrappingMap` doesn't allow deleting unsafe properties (security issue)
* fix: enable using methods and (safe) properties on plain arrays
* docs: update the "Less vulnerable expression parser" section in the docs
* chore: fix typos and linting issues
* chore: keep functions like `simplify` enabled in the CLI
* docs: update the security page
* fix: ensure `ObjectWrappingMap.keys` cannot list unsafe properties
* fix: when overwriting a rawArgs function with a non-rawArgs function it was still called with raw arguments
* docs: fix a typo
* feat: export util functions `isMap`, `isPartitionedMap`, and `isObjectWrappingMap` and improve the documentation of `scope` (see #3150)
* chore: fix broken unit tests
* docs: refine the explanation about scopes
* nearlyEqual with absolute and relative tolerances
* Format
* nearlyEqual for bigNumber
* Added skip for NaN
* Reduce diff a bit
* Issue with examples in jsdcos
* Updated all calls for nearlyEqual
* Fixed failing tests
* Changed epsilon to relTol, absTol
* Changed references to epsilon in docs and tests
* Added warning for config.epsilon
* Fix warning in zeta.test
* Added config test
* Added sinon to test console.warn
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
Callback function for MathNode.traverse() returns void. Documentation says callback must return a replacement for the existing node (possibly copied from transform() above).
* chore: write unit tests using `and` and `or` inside a function definition (WIP)
* fix: #3143 fix scope issues in rawArgs functions by implementing a `PartitionedMap`
* fix: add more unit tests for `ObjectWrappingMap`
* fix: don't let `ObjectWrappingMap` and `PartitionedMap` extend `Map` (risk of having non-overwritten methods)
* docs: update docs about `rawArgs` functions
* added Q, R, r, q metrix prefixes
* tests added for new prefixes
* removed duplicate tests
* maybe square and cubic tests will bump code cov into the positive
* Check numeric value
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* If fn has rawArgs set, pass unevaluated args
* Add shared helper function for evaluating truthiness
* Add and & or transform functions for lazy evaluation
* Add lazy evaluation of bitwise & and | operators
* Add unit tests for lazy evaluation
* Add lazy evaluation note to docs
* Move documentation to Syntax page
* Replace `testCondition()` with test evaluation
of logical function itself
* Use `isCollection()` to simplify bitwise transform functions
* fix: do not copy scope in raw OperatorNode, test lazy operators scope
* fix: linting issues
---------
Co-authored-by: Brooks Smith <brooks.smith@clearcalcs.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>
* 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)
* 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>