48 KiB
History
2017-02-22, version 3.9.3
- Fixed #797: issue with production builds of React Native projects.
- Fixed
math.roundnot accepting inputsNaN,Infinity,-Infinity. - Upgraded all dependencies.
2017-02-16, version 3.9.2
- Fixed #795: Parse error in case of a multi-line expression with just comments.
2017-02-06, version 3.9.1
- Fixed #789: Math.js not supporting conversion of
stringtoBigNumber,Fraction, orComplexnumber. - Fixed #790: Expression parser did not pass function arguments of enclosing
functions via
scopeto functions havingrawArgs = true. - Small fixes in the docs. Thanks @HarrySarson.
2017-01-23, version 3.9.0
- Implemented support for algebra: powerful new functions
simplifyandderivative. Thanks @ericman314, @tetslee, and @BigFav. - Implemented Kronecker Product
kron. Thanks @adamisntdead. - Reverted
FunctionNodenot accepting a string as function name anymore. - Fixed #765:
FunctionAssignmentNode.toString()returning a string incompatible with the function assignment syntax.
2016-12-15, version 3.8.1
- Implemented function
mad(median absolute deviation). Thanks @ruhleder. - Fixed #762: expression parser failing to invoke a function returned by a function.
2016-11-18, version 3.8.0
- Functions
addandmultiplynow accept more than two arguments. See #739. OperatorNodenow supports more than two arguments. See #739. Thanks @FSMaxB.- Implemented a method
Node.cloneDeepfor the expression nodes. See #745. - Fixed a bug in
Node.clone()not cloning implicit multiplication correctly. Thanks @FSMaxB. - Fixed #737: Improved algorithm determining the best prefix for units.
It will now retain the original unit like
1 cmwhen close enough, instead of returning10 mm. Thanks @ericman314. - Fixed #732: Allow letter-like unicode characters like Ohm
\u2126. - Fixed #749: Units
rad,deg, andgradcan now have prefixes likemillirad. - Some fixes in the docs and comments of examples. Thanks @HarrySarson.
2016-11-05, version 3.7.0
- Implemented method
Node.equals(other)for all nodes of the expression parser. - Implemented BigNumber support in function
arg(). - Command Line Interface loads faster.
- Implicit conversions between Fractions and BigNumbers throw a neat error now (See #710).
2016-10-21, version 3.6.0
- Implemented function
erf(). THanks @patgrasso. - Extended function
cross()to support n-d vectors. Thanks @patgrasso. - Extended function
pickRandomwith the option to pick multiple values from an array and give the values weights:pickRandom(possibles, number, weights). Thanks @woylie. - Parser now exposes test functions like
isAlphawhich can be replaced in order to adjust the allowed characters in variables names (See #715). - Fixed #727: Parser not throwing an error for invalid implicit multiplications
like
-2 2and2^3 4(right after the second value of an operator). - Fixed #688: Describe allowed variable names in the docs.
2016-09-21, version 3.5.3
- Some more fixes regarding numbers ending with a decimal mark (like
2.).
2016-09-20, version 3.5.2
- Fixed numbers ending with a decimal mark (like
2.) not being supported by the parser, solved the underlying ambiguity in the parser. See #707, #711.
2016-09-12, version 3.5.1
- Removed a left over console.log statement. Thanks @eknkc.
2016-09-07, version 3.5.0
- Comments of expressions are are now stored in the parsed nodes. See #690.
- Fixed function
printnot accepting an Object with formatting options as third parameter Thanks @ThomasBrierley. - Fixed #707: The expression parser no longer accepts numbers ending with a dot
like
2..
2016-08-08, version 3.4.1
- Fixed broken bundle files (
dist/math.js,dist/math.min.js). - Fixed some layout issues in the function reference docs.
2016-08-07, version 3.4.0
- Implemented support for custom units using
createUnit. Thanks @ericman314. - Implemented function
splitUnits. Thanks @ericman314. - Implemented function
isPrime. Thanks @MathBunny.
2016-07-05, version 3.3.0
- Implemented function
isNaN. - Function
math.filternow passes three arguments to the callback function: value, index, and array. - Removed the check on the number of arguments from functions defined in the expression parser (see #665).
- Fixed #665: functions
map,forEach, andfilternow invoke callbacks which are a typed-function with the correct number of arguments.
2016-04-26, version 3.2.1
- Fixed #651: unable to perform calculations on "Unit-less" units.
- Fixed matrix.subset mutating the replacement matrix when unsqueezing it.
2016-04-16, version 3.2.0
- Implemented #644: method
Parser.getAll()to retrieve all defined variables. - Upgraded dependencies (decimal.js@5.0.8, fraction.js@3.3.1, typed-function@0.10.4).
- Fixed #601: Issue with unnamed typed-functions by upgrading to typed-function v0.10.4.
- Fixed #636: More strict
toTextemplates, reckon with number of arguments. - Fixed #641: Bug in expression parser parsing implicit multiplication with wrong precedence in specific cases.
- Fixed #645: Added documentation about
engineeringnotation of functionmath.format.
2016-04-03, version 3.1.4
- Using ES6 Math functions like
Math.sinh,Math.cbrt,Math.sign, etc when available. - Fixed #631: unit aliases
weeks,months, andyearswhere missing. - Fixed #632: problem with escaped backslashes at the end of strings.
- Fixed #635:
Node.toStringoptions where not passed to function arguments. - Fixed #629: expression parser throws an error when passing a number with decimal exponent instead of parsing them as implicit multiplication.
- Fixed #484, #555: inaccuracy of
math.sinhfor values between -1 and 1. - Fixed #625: Unit
in(inch) not always working due to ambiguity with the operatora in b(alias ofa to b).
2016-03-24, version 3.1.3
- Fix broken bundle.
2016-03-24, version 3.1.2
- Fix broken npm release.
2016-03-24, version 3.1.1
- Fixed #621: a bug in parsing implicit multiplications like
(2)(3)+4. - Fixed #623:
nthRootof zero with a negative root returned0instead ofInfinity. - Throw an error when functions
min,max,mean, ormedianare invoked with multiple matrices as arguments (see #598).
2016-03-19, version 3.1.0
- Hide multiplication operator by default when outputting
toTexandtoStringfor implicit multiplications. Implemented and option to output the operator. - Implemented unit
kipand aliaskips. Thanks @hgupta9. - Added support for prefixes for units
molandmole. Thanks @stu-blair. - Restored support for implicit multiplications like
2(3+4)and(2+3)(4+5). - Some improvements in the docs.
- Added automatic conversions from
booleanandnulltoFraction, and conversions fromFractiontoComplex.
2016-03-04, version 3.0.0
breaking changes
-
More restricted support for implicit multiplication in the expression parser:
(...)(...)is now evaluated as a function invocation, and[...][...]as a matrix subset. -
Matrix multiplication no longer squeezes scalar outputs to a scalar value, but leaves them as they are: a vector or matrix containing a single value. See #529.
-
Assignments in the expression parser now return the assigned value rather than the created or updated object (see #533). Example:
A = eye(3) A[1,1] = 2 # this assignment now returns 2 instead of A -
Expression parser now supports objects. This involves a refactoring and extension in expression nodes:
- Implemented new node
ObjectNode. - Refactored
AssignmentNode,UpdateNode, andIndexNodeare refactored intoAccessorNode,AssignmentNode, andIndexNodehaving a different API.
- Implemented new node
-
Upgraded the used BigNumber library
decimal.jsto v5. Replaced the trigonometric functions of math.js with those provided in decimal.js v5. This can give slightly different behavior qua round-off errors. -
Replaced the internal
Complex.jsclass with thecomplex.jslibrary created by @infusion. -
Entries in a matrix (typically numbers, BigNumbers, Units, etc) are now considered immutable, they are no longer copied when performing operations on the entries, improving performance.
-
Implemented nearly equal comparison for relational functions (
equal,larger,smaller, etc.) when using BigNumbers. -
Changed the casing of the configuration options
matrix(ArrayorMatrix) andnumber(number,BigNumber,Fraction) such that they now match the type returned bymath.typeof. Wrong casing gives a console warning but will still work. -
Changed the default config value for
epsilonfrom1e-14to1e-12, see #561.
non-breaking changes
- Extended function
powto return the real root for cubic roots of negative numbers. See #525, #482, #567. - Implemented support for JSON objects in the expression parser and the
function
math.format. - Function
math.fractionnow supportsBigNumber, and functionmath.bignumbernow supportsFraction. - Expression parser now allows function and/or variable assignments inside
accessors and conditionals, like
A[x=2]ora > 2 ? b="ok" : b="fail". - Command line interface:
- Outputs the variable name of assignments.
- Fixed not rounding BigNumbers to 14 digits like numbers.
- Fixed non-working autocompletion of user defined variables.
- Reorganized and extended docs, added docs on classes and more. Thanks @hgupta9.
- Added new units
acre,hectare,torr,bar,mmHg,mmH2O,cmH2O, and added new aliasesacres,hectares,sqfeet,sqyard,sqmile,sqmiles,mmhg,mmh2o,cmh2o. Thanks @hgupta9. - Fixed a bug in the toString method of an IndexNode.
- Fixed angle units
deg,rad,grad,cycle,arcsec, andarcminnot being defined as BigNumbers when configuring to use BigNumbers.
2016-02-03, version 2.7.0
- Added more unit aliases for time:
secs,mins,hr,hrs. See #551. - Added support for doing operations with mixed
FractionsandBigNumbers. - Fixed #540:
math.intersect()returning null in some cases. Thanks @void42. - Fixed #546: Cannot import BigNumber, Fraction, Matrix, Array. Thanks @brettjurgens.
2016-01-08, version 2.6.0
- Implemented (complex) units
VAandVAR. - Implemented time units for weeks, months, years, decades, centuries, and millennia. Thanks @owenversteeg.
- Implemented new notation
engineeringin functionmath.format. Thanks @johnmarinelli. - Fixed #523: In some circumstances, matrix subset returned a scalar instead of the correct subset.
- Fixed #536: A bug in an internal method used for sparse matrices.
2015-12-05, version 2.5.0
- Implemented support for numeric types
FractionandBigNumberin units. - Implemented new method
toNumericfor units. - Implemented new units
arcsec,arcsecond,arcmin,arcminute. Thanks @devdevdata222. - Implemented new unit
Herts(Hz). Thanks @SwamWithTurtles. - Fixed #485: Scoping issue with variables both used globally as well as in a function definition.
- Fixed: Function
numberdidn't supportFractionas input.
2015-11-14, version 2.4.2
- Fixed #502: Issue with
formatin some JavaScript engines. - Fixed #503: Removed trailing commas and the use of keyword
importas property, as this gives issues with old JavaScript engines.
2015-10-29, version 2.4.1
- Fixed #480:
nthRootnot working on Internet Explorer (up to IE 11). - Fixed #490:
nthRootreturning an error for negative values likenthRoot(-2, 3). - Fixed #489: an issue with initializing a sparse matrix without data. Thanks @Retsam.
- Fixed: #493: function
combinationsdid not throw an exception for non-integer values ofk. - Fixed: function
importdid not override typed functions when the option override was set true. - Fixed: added functions
math.sparseandmath.indexto the reference docs, they where missing. - Fixed: removed memoization from
gammaandfactorialfunctions, this could blow up memory.
2015-10-09, version 2.4.0
- Added support in the expression parser for mathematical alphanumeric symbols in the expression parser: unicode range \u{1D400} to \u{1D7FF} excluding invalid code points.
- Extended function
distancewith more signatures. Thanks @kv-kunalvyas. - Fixed a bug in functions
sinandcos, which gave wrong results for BigNumber integer values around multiples of tau (i.e.sin(bignumber(7))). - Fixed value of unit
stone. Thanks @Esvandiary for finding the error.
2015-09-19, version 2.3.0
- Implemented function
distance. Thanks @devanp92. - Implemented support for Fractions in function
lcm. Thanks @infusion. - Implemented function
cbrtfor numbers, complex numbers, BigNumbers, Units. - Implemented function
hypot. - Upgraded to fraction.js v3.0.0.
- Fixed #450: issue with non sorted index in sparse matrices.
- Fixed #463, #322: inconsistent handling of implicit multiplication.
- Fixed #444: factorial of infinity not returning infinity.
2015-08-30, version 2.2.0
- Units with powers (like
m^2ands^-1) now output with the best prefix. - Implemented support for units to
abs,cube,sign,sqrt,square. Thanks @ericman314. - Implemented function
catalan(Combinatorics). Thanks @devanp92. - Improved the
canDefinePropertycheck to return false in case of IE8, which has a broken implementation ofdefineProperty. Thanks @golmansax. - Fixed function
tonot working in case of a simplified unit. - Fixed #437: an issue with row swapping in
lup, also affectinglusolve.
2015-08-12, version 2.1.1
- Fixed wrong values of the physical constants
speedOfLight,molarMassC12,
andmagneticFluxQuantum. Thanks @ericman314 for finding two of them.
2015-08-11, version 2.1.0
- Implemented derived units (like
110 km/h in m/s). Thanks @ericman314. - Implemented support for electric units. Thanks @ericman314.
- Implemented about 50 physical constants like
speedOfLight,gravity, etc. - Implemented function
kldivergence(Kullback-Leibler divergence). Thanks @saromanov. - Implemented function
mode. Thanks @kv-kunalvyas. - Added support for unicode characters in the expression parser: greek letters and latin letters with accents. See #265.
- Internal functions
Unit.parseandComplex.parsenow throw an Error instead of returning null when passing invalid input.
2015-07-29, version 2.0.1
- Fixed operations with mixed fractions and numbers be converted to numbers instead of fractions.
2015-07-28, version 2.0.0
- Large internal refactoring:
- performance improvements.
- allows to create custom bundles
- functions are composed using
typed-functionand are extensible
- Implemented support for fractions, powered by the library
fraction.js. - Implemented matrix LU decomposition with partial pivoting and a LU based
linear equations solver (functions
lupandlusolve). Thanks @rjbaucells. - Implemented a new configuration option
predictable, which can be set to true in order to ensure predictable function output types. - Implemented function
intersect. Thanks @kv-kunalvyas. - Implemented support for adding
toTexproperties to custom functions. Thanks @FSMaxB. - Implemented support for complex values to
nthRoot. Thanks @gangachris. - Implemented util functions
isInteger,isNegative,isNumeric,isPositive, andisZero.
breaking changes
- String input is now converted to numbers by default for all functions.
- Adding two strings will no longer concatenate them, but will convert the strings to numbers and add them.
- Function
indexdoes no longer accept an array[start, end, step], but instead accepts an array with arbitrary index values. It also accepts aRangeobject as input. - Function
typeofno longer returns lower case names, but now returns lower case names for primitives (likenumber,boolean,string), and upper-camel-case for non-primitives (likeArray,Complex,Function). - Function
importno longer supports a module name as argument. Instead, modules can be loaded using require:math.import(require('module-name')). - Function
importhas a new optionsilentto ignore errors, and throws errors on duplicates by default. - Method
Node.compile()no longer needsmathto be passed as argument. - Reintroduced method
Node.eval([scope]). - Function
sumnow returns zero when input is an empty array. Thanks @FSMAxB. - The size of Arrays is no longer validated. Matrices will validate this on creation.
2015-07-12, version 1.7.1
- Fixed #397: Inaccuracies in nthRoot for very large values, and wrong results for very small values. (backported from v2)
- Fixed #405: Parser throws error when defining a function in a multiline expression.
2015-05-31, version 1.7.0
- Implemented function
quantileSeqandpartitionSelect. Thanks @BigFav. - Implemented functions
stirlingS2,bellNumbers,composition, andmultinomial. Thanks @devanp92. - Improved the performance of
median(see #373). Thanks @BigFav. - Extended the command line interface with a
modeoption to output either the expressions result, string representation, or tex representation. Thanks @FSMaxB. - Fixed #309: Function median mutating the input matrix. Thanks @FSMaxB.
- Fixed
Node.transformnot recursing over replaced parts of the node tree (see #349). - Fixed #381: issue in docs of
randomInt.
2015-04-22, version 1.6.0
- Improvements in
toTex. Thanks @FSMaxB. - Fixed #328:
abs(0 + 0i)evaluated toNaN. - Fixed not being able to override lazy loaded constants.
2015-04-09, version 1.5.2
- Fixed #313: parsed functions did not handle recursive calls correctly.
- Fixed #251: binary prefix and SI prefix incorrectly used for byte. Now
following SI standards (
1 KiB == 1024 B,1 kB == 1000 B). - Performance improvements in parsed functions.
2015-04-08, version 1.5.1
- Fixed #316: a bug in rounding values when formatting.
- Fixed #317, #319: a bug in formatting negative values.
2015-03-28, version 1.5.0
- Added unit
stone(6.35 kg). - Implemented support for sparse matrices. Thanks @rjbaucells.
- Implemented BigNumber support for function
atan2. Thanks @BigFav. - Implemented support for custom LaTeX representations. Thanks @FSMaxB.
- Improvements and bug fixes in outputting parentheses in
Node.toStringandNode.toTexfunctions. Thanks @FSMaxB. - Fixed #291: function
formatsometimes returning exponential notation when it should return a fixed notation.
2015-02-28, version 1.4.0
- Implemented trigonometric functions:
acosh,acoth,acsch,asech,asinh,atanh,acot,acsc,asec. Thanks @BigFav. - Added BigNumber support for functions:
cot,csc,sec,coth,csch,sech. Thanks @BigFav. - Implemented support for serialization and deserialization of math.js data types.
- Fixed the calculation of
norm()andabs()for large complex numbers. Thanks @rjbaucells. - Fixed #281: improved formatting complex numbers. Round the real or imaginary part to zero when the difference is larger than the configured precision.
2015-02-09, version 1.3.0
- Implemented BigNumber implementations of most trigonometric functions:
sin,cos,tan,asin,acos,atan,cosh,sinh,tanh. Thanks @BigFav. - Implemented function
trace. Thanks @pcorey. - Faster loading of BigNumber configuration with a high precision by lazy
loading constants like
piande. - Fixed constants
NaNandInfinitynot being BigNumber objects when BigNumbers are configured. - Fixed missing parentheses in the
toTexrepresentation of functionpermutations. - Some minor fixes in the docs. Thanks @KenanY.
2014-12-25, version 1.2.0
- Support for bitwise operations
bitAnd,bitNot,bitOr,bitXor,leftShift,rightArithShift, andrightLogShift. Thanks @BigFav. - Support for boolean operations
and,not,or,xor. Thanks @BigFav. - Support for
gammafunction. Thanks @BigFav. - Converting a unit without value will now result in a unit with value,
i.e.
inch in cmwill return2.54 cminstead ofcm. - Improved accuracy of
sinhand complexcosandsin. Thanks @pavpanchekha. - Renamed function
selecttochain. The old functionselectwill remain functional until math.js v2.0. - Upgraded to decimal.js v4.0.1 (BigNumber library).
2014-11-22, version 1.1.1
- Fixed Unit divided by Number returning zero.
- Fixed BigNumber downgrading to Number for a negative base in
pow. - Fixed some typos in error messaging (thanks @andy0130tw) and docs.
2014-11-15, version 1.1.0
- Implemented functions
dot(dot product),cross(cross product), andnthRoot. - Officially opened up the API of expression trees:
- Documented the API.
- Implemented recursive functions
clone,map,forEach,traverse,transform, andfilterfor expression trees. - Parameter
indexin the callbacks ofmapandforEachare now cloned for every callback. - Some internal refactoring inside nodes to make the API consistent:
- Renamed
paramstoargsand vice versa to make things consistent. - Renamed
Block.nodestoBlock.blocks. FunctionNodenow has aname: stringinstead of asymbol: SymbolNode.- Changed constructor of
RangeNodetonew RangeNode(start: Node, end: Node [, step: Node]). - Nodes for a
BlockNodemust now be passed via the constructor instead of via a functionadd.
- Renamed
- Fixed
2egiving a syntax error instead of being parsed as2 * e.
2014-09-12, version 1.0.1
- Disabled array notation for ranges in a matrix index in the expression parser (it is confusing and redundant there).
- Fixed a regression in the build of function subset not being able to return a scalar.
- Fixed some missing docs and broken links in the docs.
2014-09-04, version 1.0.0
- Implemented a function
filter(x, test). - Removed
math.distributionfor now, needs some rethinking. math.numbercan convert units to numbers (requires a second argument)- Fixed some precedence issues with the range and conversion operators.
- Fixed an zero-based issue when getting a matrix subset using an index containing a matrix.
2014-08-21, version 0.27.0
- Implemented functions
sort(x [, compare])andflatten(x). - Implemented support for
nullin all functions. - Implemented support for "rawArgs" functions in the expression parser. Raw functions are invoked with unevaluated parameters (nodes).
- Expressions in the expression parser can now be spread over multiple lines, like '2 +\n3'.
- Changed default value of the option
wrapof functionmath.importto false. - Changed the default value for new entries in a resized matrix when to zero.
To leave new entries uninitialized, use the new constant
math.uninitializedas default value. - Renamed transform property from
__transform__totransform, and documented the transform feature. - Fixed a bug in
math.importnot applying options when passing a module name. - A returned matrix subset is now only squeezed when the
indexconsists of scalar values, and no longer for ranges resolving into a single value.
2014-08-03, version 0.26.0
- A new instance of math.js can no longer be created like
math([options]), to prevent side effects from math being a function instead of an object. Instead, use the functionmath.create([options])to create a new instance. - Implemented
BigNumbersupport for all constants:pi,tau,e,phi,E,LN2,LN10,LOG2E,LOG10E,PI,SQRT1_2, andSQRT2. - Implemented
BigNumbersupport for functionsgcd,xgcd, andlcm. - Fixed function
gxcdreturning an Array when math.js was configured as{matrix: 'matrix'}. - Multi-line expressions now return a
ResultSetinstead of anArray. - Implemented transforms (used right now to transform one-based indices to zero-based for expressions).
- When used inside the expression parser, functions
concat,min,max, andmeanexpect an one-based dimension number. - Functions
mapandforEachinvoke the callback with one-based indices when used from within the expression parser. - When adding or removing dimensions when resizing a matrix, the dimensions are added/removed from the inner side (right) instead of outer side (left).
- Improved index out of range errors.
- Fixed function
concatnot accepting aBigNumberfor parameterdim. - Function
squeezenow squeezes both inner and outer singleton dimensions. - Output of getting a matrix subset is not automatically squeezed anymore except for scalar output.
- Renamed
FunctionNodetoFunctionAssignmentNode, and renamedParamsNodetoFunctionNodefor more clarity. - Fixed broken auto completion in CLI.
- Some minor fixes.
2014-07-01, version 0.25.0
-
The library now immediately returns a default instance of mathjs, there is no need to instantiate math.js in a separate step unless one ones to set configuration options:
// instead of: var mathjs = require('mathjs'), // load math.js math = mathjs(); // create an instance // just do: var math = require('mathjs'); -
Implemented support for implicit multiplication, like
math.eval('2a', {a:3})andmath.eval('(2+3)(1-3)'). This changes behavior of matrix indexes as well: an expression like[...][...]is not evaluated as taking a subset of the first matrix, but as an implicit multiplication of two matrices. -
Removed utility function
ifElse. This function is redundant now the expression parser has a conditional operatora ? b : c. -
Fixed a bug with multiplying a number with a temperature,
likemath.eval('10 * celsius'). -
Fixed a bug with symbols having value
undefinednot being evaluated.
2014-06-20, version 0.24.1
- Something went wrong with publishing on npm.
2014-06-20, version 0.24.0
- Added constant
null. - Functions
equalandunequalsupportnullandundefinednow. - Function
typeofnow recognizes regular expressions as well. - Objects
Complex,Unit, andHelpnow return their string representation when calling.valueOf(). - Changed the default number of significant digits for BigNumbers from 20 to 64.
- Changed the behavior of the conditional operator (a ? b : c) to lazy evaluating.
- Fixed imported, wrapped functions not accepting
nullandundefinedas function arguments.
2014-06-10, version 0.23.0
-
Renamed some functions (everything now has a logical, camel case name):
- Renamed functions
edivide,emultiply, andepowtodotDivide,dotMultiply, anddotPowrespectively. - Renamed functions
smallereqandlargereqtosmallerEqandlargerEq. - Renamed function
unarytounaryMinusand added support for strings.
- Renamed functions
-
endis now a reserved keyword which cannot be used as function or symbol name in the expression parser, and is not allowed in the scope against which an expression is evaluated. -
Implemented function
unaryPlusand unary plus operator. -
Implemented function
deepEqualfor matrix comparisons. -
Added constant
phi, the golden ratio (phi = 1.618...). -
Added constant
version, returning the version number of math.js as string. -
Added unit
drop(gtt). -
Fixed not being able to load math.js using AMD/require.js.
-
Changed signature of
math.parse(expr, nodes)tomath.parse(expr, options)whereoptions: {nodes: Object.<String, Node>} -
Removed matrix support from conditional function
ifElse. -
Removed automatic assignment of expression results to variable
ans. This functionality can be restored by pre- or postprocessing every evaluation, something like:function evalWithAns (expr, scope) { var ans = math.eval(expr, scope); if (scope) { scope.ans = ans; } return ans; }
2014-05-22, version 0.22.0
- Implemented support to export expressions to LaTeX. Thanks Niels Heisterkamp (@nheisterkamp).
- Output of matrix multiplication is now consistently squeezed.
- Added reference documentation in the section /docs/reference.
- Fixed a bug in multiplying units without value with a number (like
5 * cm). - Fixed a bug in multiplying two matrices containing vectors (worked fine for arrays).
- Fixed random functions not accepting Matrix as input, and always returning a Matrix as output.
2014-05-13, version 0.21.1
- Removed
cryptolibrary from the bundle. - Deprecated functions
Parser.parseandParser.compile. Usemath.parseandmath.compileinstead. - Fixed function
addnot adding strings and matrices element wise. - Fixed parser not being able to evaluate an exponent followed by a unary minus
like
2^-3, and a transpose followed by an index like[3]'[1].
2014-04-24, version 0.21.0
- Implemented trigonometric hyperbolic functions
cosh,coth,csch,sech,sinh,tanh. Thanks Rogelio J. Baucells (@rjbaucells). - Added property
typeto all expression nodes in an expression tree. - Fixed functions
log,log10,pow, andsqrtnot supporting complex results from BigNumber input (likesqrt(bignumber(-4))).
2014-04-16, version 0.20.0
- Switched to module
decimal.jsfor BigNumber support, instead ofbignumber.js. - Implemented support for polar coordinates to the
Complexdatatype. Thanks Finn Pauls (@finnp). - Implemented BigNumber support for functions
exp,log, andlog10. - Implemented conditional operator
a ? b : cin expression parser. - Improved floating point comparison: the functions now check whether values
are nearly equal, against a configured maximum relative difference
epsilon. Thanks Rogelio J. Baucells (@rjbaucells). - Implemented function
norm. Thanks Rogelio J. Baucells (@rjbaucells). - Improved function
ifElse, is now specified for special data types too. - Improved function
det. Thanks Bryan Cuccioli (@bcuccioli). - Implemented
BigNumbersupport for functionsdetanddiag. - Added unit alias
lbs(pound mass). - Changed configuration option
decimalstoprecision(applies to BigNumbers only). - Fixed support for element-wise comparisons between a string and a matrix.
- Fixed: expression parser now trows IndexErrors with one-based indices instead of zero-based.
- Minor bug fixes.
2014-03-30, version 0.19.0
- Implemented functions
compare,sum,prod,var,std,median. - Implemented function
ifElseThanks @mtraynham. - Minor bug fixes.
2014-02-15, version 0.18.1
- Added unit
feet. - Implemented function
compile(shortcut for parsing and then compiling). - Improved performance of function
powfor matrices. Thanks @hamadu. - Fixed broken auto completion in the command line interface.
- Fixed an error in function
combinationsfor large numbers, and improved performance of both functionscombinationsandpermutations.
2014-01-18, version 0.18.0
- Changed matrix index notation of expression parser from round brackets to
square brackets, for example
A[1, 1:3]instead ofA(1, 1:3). - Removed need to use the
functionkeyword for function assignments in the expression parser, you can define a function now likef(x) = x^2. - Implemented a compilation step in the expression parser: expressions are compiled into JavaScript, giving much better performance (easily 10x as fast).
- Renamed unit conversion function and operator
intoto. Operatorinis still available in the expression parser as an alias forto. Added unitin, an abbreviation forinch. Thanks Elijah Insua (@tmpvar). - Added plurals and aliases for units.
- Implemented an argument
includeEndfor functionrange(false by default). - Ranges in the expression parser now support big numbers.
- Implemented functions
permutationsandcombinations. Thanks Daniel Levin (@daniel-levin). - Added lower case abbreviation
lfor unit litre.
2013-12-19, version 0.17.1
- Fixed a bug with negative temperatures.
- Fixed a bug with prefixes of units squared meter
m2and cubic meterm3.
2013-12-12, version 0.17.0
- Renamed and flattened configuration settings:
number.defaultTypeis nownumber.number.precisionis nowdecimals.matrix.defaultTypeis nowmatrix.
- Function
multiplynow consistently outputs a complex number on complex input. - Fixed
modandinnot working as function (only as operator). - Fixed support for old browsers (IE8 and older), compatible when using es5-shim.
- Fixed support for Java's ScriptEngine.
2013-11-28, version 0.16.0
- Implemented BigNumber support for arbitrary precision calculations.
Added settings
number.defaultTypeandnumber.precisionto configure big numbers. - Documentation is extended.
- Removed utility functions
isScalar,toScalar,isVector,toVectorfromMatrixandRange. Usemath.squeezeandmath.sizeinstead. - Implemented functions
getandsetonMatrix, for easier and faster retrieval/replacement of elements in a matrix. - Implemented function
resize, handling matrices, scalars, and strings. - Functions
onesandzerosnow return an empty matrix instead of a number 1 or 0 when no arguments are provided. - Implemented functions
minandmaxforRangeandIndex. - Resizing matrices now leaves new elements undefined by default instead of
filling them with zeros. Function
resizenow has an extra optional parameterdefaultValue. - Range operator
:in expression parser has been given a higher precedence. - Functions don't allow arguments of unknown type anymore.
- Options be set when constructing a math.js instance or using the new function
config(options. Options are no longer accessible viamath.options. - Renamed
scientificnotation toexponentialin functionformat. - Function
formatoutputs exponential notation with positive exponents now always with+sign, so outputs2.1e+3instead of2.1e3. - Fixed function
squeezenot being able squeeze into a scalar. - Some fixes and performance improvements in the
resizeandsubsetfunctions. - Function
sizenow adheres to the optionmatrix.defaultTypefor scalar input. - Minor bug fixes.
2013-10-26, version 0.15.0
- Math.js must be instantiated now, static calls are no longer supported. Usage:
- node.js:
var math = require('mathjs')(); - browser:
var math = mathjs();
- node.js:
- Implemented support for multiplying vectors with matrices.
- Improved number formatting:
- Function
formatnow support various options: precision, different notations (fixed,scientific,auto), and more. - Numbers are no longer rounded to 5 digits by default when formatted.
- Implemented a function
formatforMatrix,Complex,Unit,Range, andSelectorto format using options. - Function
formatdoes only stringify values now, and has a new parameterprecisionto round to a specific number of digits. - Removed option
math.options.precision, usemath.format(value [, precision])instead. - Fixed formatting numbers as scientific notation in some cases returning a zero digit left from the decimal point. (like "0.33333e8" rather than "3.3333e7"). Thanks @husayt.
- Function
- Implemented a function
printto interpolate values in a template string, this functionality was moved from the functionformat. - Implemented statistics function
mean. Thanks Guillermo Indalecio Fernandez (@guillermobox). - Extended and changed
maxandminfor multi dimensional matrices: they now return the maximum and minimum of the flattened array. An optional second argumentdimallows to calculate themaxorminfor specified dimension. - Renamed option
math.options.matrix.defaulttomath.options.matrix.defaultType. - Removed support for comparing complex numbers in functions
smaller,smallereq,larger,largereq. Complex numbers cannot be ordered.
2013-10-08, version 0.14.0
- Introduced an option
math.options.matrix.defaultwhich can have valuesmatrix(default) orarray. This option is used by the functionseye,ones,range, andzeros, to determine the type of matrix output. - Getting a subset of a matrix will automatically squeeze the resulting subset, setting a subset of a matrix will automatically unsqueeze the given subset.
- Removed concatenation of nested arrays in the expression parser.
You can now input nested arrays like in JavaScript. Matrices can be
concatenated using the function
concat. - The matrix syntax
[...]in the expression parser now creates 1 dimensional matrices by default.math.eval('[1,2,3,4]')returns a matrix with size[4],math.eval('[1,2;3,4]')returns a matrix with size[2,2]. - Documentation is restructured and extended.
- Fixed non working operator
mod(modulus operator).
2013-09-03, version 0.13.0
- Implemented support for booleans in all relevant functions.
- Implemented functions
mapandforEach. Thanks Sebastien Piquemal (@sebpic). - All construction functions can be used to convert the type of variables, also element-wise for all elements in an Array or Matrix.
- Changed matrix indexes of the expression parser to one-based with the upper-bound included, similar to most math applications. Note that on a JavaScript level, math.js uses zero-based indexes with excluded upper-bound.
- Removed support for scalars in the function
subset, it now only supports Array, Matrix, and String. - Removed the functions
getandsetfrom a selector, they are a duplicate of the functionsubset. - Replaced functions
getandsetofMatrixwith a single functionsubset. - Some moving around with code and namespaces:
- Renamed namespace
math.exprtomath.expression(contains Scope, Parser, node objects). - Renamed namespace
math.docstomath.expression.docs. - Moved
math.expr.Selectortomath.chaining.Selector.
- Renamed namespace
- Fixed some edge cases in functions
lcmandxgcd.
2013-08-22, version 0.12.1
- Fixed outdated version of README.md.
- Fixed a broken unit test.
2013-08-22, version 0.12.0
- Implemented functions
random([min, max]),randomInt([min, max]),pickRandom(array). Thanks Sebastien Piquemal (@sebpic). - Implemented function
distribution(name), generating a distribution object with functionsrandom,randomInt,pickRandomfor different distributions. Currently supportinguniformandnormal. - Changed the behavior of
rangeto exclude the upper bound, sorange(1, 4)now returns[1, 2, 3]instead of[1, 2, 3, 4]. - Changed the syntax of
range, which is nowrange(start, end [, step])instead ofrange(start, [step, ] end). - Changed the behavior of
onesandzerosto geometric dimensions, for exampleones(3)returns a vector with length 3, filled with ones, andones(3,3)returns a 2D array with size [3, 3]. - Changed the return type of
onesandzeros: they now return an Array when arguments are Numbers or an Array, and returns a Matrix when the argument is a Matrix. - Change matrix index notation in parser from round brackets to square brackets,
for example
A[0, 0:3]. - Removed the feature introduced in v0.10.0 to automatically convert a complex value with an imaginary part equal to zero to a number.
- Fixed zeros being formatted as null. Thanks @TimKraft.
2013-07-23, version 0.11.1
- Fixed missing development dependency
2013-07-23, version 0.11.0
- Changed math.js from one-based to zero-based indexes.
- Getting and setting matrix subset is now zero-based.
- The dimension argument in function
concatis now zero-based.
- Improvements in the string output of function help.
- Added constants
trueandfalse. - Added constructor function
boolean. - Fixed function
selectnot accepting0as input. Thanks Elijah Manor (@elijahmanor). - Parser now supports multiple unary minus operators after each other.
- Fixed not accepting empty matrices like
[[], []]. - Some fixes in the end user documentation.
2013-07-08, version 0.10.0
- For complex calculations, all functions now automatically replace results
having an imaginary part of zero with a Number. (
2i * 2inow returns a Number-4instead of a Complex-4 + 0i). - Implemented support for injecting custom node handlers in the parser. Can be used for example to implement a node handler for plotting a graph.
- Implemented end user documentation and a new
helpfunction. - Functions
sizeandsqueezenow return a Matrix instead of an Array as output on Matrix input. - Added a constant tau (2 * pi). Thanks Zak Zibrat (@palimpsests).
- Renamed function
unaryminustounary. - Fixed a bug in determining node dependencies in function assignments.
2013-06-14, version 0.9.1
- Implemented element-wise functions and operators:
emultiply(x .* y),edivide(x ./ y),epow(x .^ y). - Added constants
InfinityandNaN. - Removed support for Workspace to keep the library focused on its core task.
- Fixed a bug in the Complex constructor, not accepting NaN values.
- Fixed division by zero in case of pure complex values.
- Fixed a bug in function multiply multiplying a pure complex value with Infinity.
2013-05-29, version 0.9.0
- Implemented function
math.parse(expr [,scope]). Optional parameter scope can be a plain JavaScript Object containing variables. - Extended function
math.expr(expr [, scope])with an additional parameterscope, similar toparse. Example:math.eval('x^a', {x:3, a:2});. - Implemented function
subset, to get or set a subset from a matrix, string, or other data types. - Implemented construction functions number and string (mainly useful inside the parser).
- Improved function
det. Thanks Bryan Cuccioli (@bcuccioli). - Moved the parse code from prototype math.expr.Parser to function math.parse, simplified Parser a little bit.
- Strongly simplified the code of Scope and Workspace.
- Fixed function mod for negative numerators, and added error messages in case of wrong input.
2013-05-18, version 0.8.2
- Extended the import function and some other minor improvements.
- Fixed a bug in merging one dimensional vectors into a matrix.
- Fixed a bug in function subtract, when subtracting a complex number from a real number.
2013-05-10, version 0.8.1
- Fixed an npm warning when installing mathjs globally.
2013-05-10, version 0.8.0
- Implemented a command line interface. When math.js is installed globally via npm, the application is available on your system as 'mathjs'.
- Implemented
endkeyword for index operator, and added support for implicit start and end (expressions likea(2,:)andb(2:end,3:end-1)are supported now). - Function math.eval is more flexible now: it supports variables and multi-line expressions.
- Removed the read-only option from Parser and Scope.
- Fixed non-working unequal operator != in the parser.
- Fixed a bug in resizing matrices when replacing a subset.
- Fixed a bug in updating a subset of a non-existing variable.
- Minor bug fixes.
2013-05-04, version 0.7.2
- Fixed method unequal, which was checking for equality instead of inequality. Thanks @FJS2.
2013-04-27, version 0.7.1
- Improvements in the parser:
- Added support for chained arguments.
- Added support for chained variable assignments.
- Added a function remove(name) to remove a variable from the parsers scope.
- Renamed nodes for more consistency and to resolve naming conflicts.
- Improved stringification of an expression tree.
- Some simplifications in the code.
- Minor bug fixes.
- Fixed a bug in the parser, returning NaN instead of throwing an error for a
number with multiple decimal separators like
2.3.4. - Fixed a bug in Workspace.insertAfter.
- Fixed: math.js now works on IE 6-8 too.
2013-04-20, version 0.7.0
- Implemented method
math.eval, which uses a readonly parser to evaluate expressions. - Implemented method
xgcd(extended eucledian algorithm). Thanks Bart Kiers (@bkiers). - Improved math.format, which now rounds values to a maximum number of digits
instead of decimals (default is 5 digits, for example
math.format(math.pi)returns3.1416). - Added examples.
- Changed methods square and cube to evaluate matrices element wise (consistent with all other methods).
- Changed second parameter of method import to an object with options.
- Fixed method math.typeof on IE.
- Minor bug fixes and improvements.
2013-04-13, version 0.6.0
- Implemented chained operations via method math.select(). For example
math.select(3).add(4).subtract(2).done()will return5. - Implemented methods gcd and lcm.
- Implemented method
Unit.in(unit), which creates a clone of the unit with a fixed representation. For examplemath.unit('5.08 cm').in('inch')will return a unit which string representation always is in inch, thus2 inch.Unit.in(unit)is the same as methodmath.in(x, unit). - Implemented
Unit.toNumber(unit), which returns the value of the unit when represented with given unit. For examplemath.unit('5.08 cm').toNumber('inch')returns the number2, as the representation of the unit in inches has 2 as value. - Improved: method
math.in(x, unit)now supports a string as second parameter, for examplemath.in(math.unit('5.08 cm'), 'inch'). - Split the end user documentation of the parser functions from the source files.
- Removed function help and the built-in documentation from the core library.
- Fixed constant i being defined as -1i instead of 1i.
- Minor bug fixes.
2013-04-06, version 0.5.0
- Implemented data types Matrix and Range.
- Implemented matrix methods clone, concat, det, diag, eye, inv, ones, size, squeeze, transpose, zeros.
- Implemented range operator
:, and transpose operator'in parser. - Changed: created construction methods for easy object creation for all data
types and for the parser. For example, a complex value is now created
with
math.complex(2, 3)instead ofnew math.Complex(2, 3), and a parser is now created withmath.parser()instead ofnew math.parser.Parser(). - Changed: moved all data types under the namespace math.type, and moved the Parser, Workspace, etc. under the namespace math.expr.
- Changed: changed operator precedence of the power operator:
- it is now right associative instead of left associative like most scripting
languages. So
2^3^4is now calculated as2^(3^4). - it has now higher precedence than unary minus most languages, thus
-3^2is now calculated as-(3^2).
- it is now right associative instead of left associative like most scripting
languages. So
- Changed: renamed the parsers method 'put' into 'set'.
- Fixed: method 'in' did not check for units to have the same base.
2013-03-16, version 0.4.0
- Implemented Array support for all methods.
- Implemented Array support in the Parser.
- Implemented method format.
- Implemented parser for units, math.Unit.parse(str).
- Improved parser for complex values math.Complex.parse(str);
- Improved method help: it now evaluates the examples.
- Fixed: a scoping issue with the Parser when defining functions.
- Fixed: method 'typeof' was not working well with minified and mangled code.
- Fixed: errors in determining the best prefix for a unit.
2013-03-09, version 0.3.0
- Implemented Workspace
- Implemented methods cot, csc, sec.
- Implemented Array support for methods with one parameter.
2013-02-25, version 0.2.0
- Parser, Scope, and expression tree with Nodes implemented.
- Implemented method import which makes it easy to extend math.js.
- Implemented methods arg, conj, cube, equal, factorial, im, largereq, log(x, base), log10, mod, re, sign, smallereq, square, unequal.
2013-02-18, version 0.1.0
- Reached full compatibility with Javascripts built-in Math library.
- More functions implemented.
- Some bugfixes.
2013-02-16, version 0.0.2
- All constants of Math implemented, plus the imaginary unit i.
- Data types Complex and Unit implemented.
- First set of functions implemented.
2013-02-15, version 0.0.1
- First publish of the mathjs package. (package is still empty)