~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number

« back to all changes in this revision

Viewing changes to app/engine/math.js

  • Committer: Tarmac
  • Author(s): Riccardo Padovani
  • Date: 2015-03-02 10:28:03 UTC
  • mfrom: (115.2.1 mathjs140)
  • Revision ID: tarmac-20150302102803-k16dmhdu2weh7hrw
Updated math.js to 1.4.0.

Approved by Bartosz Kosiorek, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 */
35
35
 
36
36
(function webpackUniversalModuleDefinition(root, factory) {
37
 
        // UCA: we delete all exports, we don't need them, and we keep only our var
38
 
        mathJs = factory();
 
37
    // UCA: we delete all exports, we don't need them, and we keep only our var
 
38
    mathJs = factory();
39
39
})(this, function() {
40
40
return /******/ (function(modules) { // webpackBootstrap
41
41
/******/        // The module cache
92
92
 
93
93
        'use strict';
94
94
 
95
 
        var object = __webpack_require__(3);
96
 
        var digits = __webpack_require__(4).digits;
 
95
        var object = __webpack_require__(2);
 
96
        var digits = __webpack_require__(3).digits;
97
97
 
98
98
        /**
99
99
         * math.js factory function.
158
158
 
159
159
              // reload the constants (they depend on option number and precision)
160
160
              // this must be done after math.type.BigNumber.config is applied
161
 
              __webpack_require__(2)(math, _config);
 
161
              __webpack_require__(4)(math, _config);
162
162
 
163
163
              // TODO: remove deprecated setting some day (deprecated since version 0.17.0)
164
164
              if (options.number && options.number.defaultType) {
205
205
          math.create = create;
206
206
 
207
207
          // create a new BigNumber factory for this instance of math.js
208
 
          var BigNumber = __webpack_require__(159).constructor();
 
208
          var BigNumber = __webpack_require__(5).constructor();
209
209
 
210
210
          // extend BigNumber with a function clone
211
211
          if (typeof BigNumber.prototype.clone !== 'function') {
241
241
          }
242
242
 
243
243
          // errors
244
 
          math.error = __webpack_require__(5);
 
244
          math.error = __webpack_require__(6);
245
245
 
246
246
          // types (Matrix, Complex, Unit, ...)
247
247
          math.type = {};
248
 
          math.type.Complex = __webpack_require__(6);
249
 
          math.type.Range = __webpack_require__(7);
250
 
          math.type.Index = __webpack_require__(8);
251
 
          math.type.Matrix = __webpack_require__(9);
252
 
          math.type.Unit = __webpack_require__(10);
253
 
          math.type.Help = __webpack_require__(11);
254
 
          math.type.ResultSet = __webpack_require__(12);
 
248
          math.type.Complex = __webpack_require__(7);
 
249
          math.type.Range = __webpack_require__(8);
 
250
          math.type.Index = __webpack_require__(9);
 
251
          math.type.Matrix = __webpack_require__(10);
 
252
          math.type.Unit = __webpack_require__(11);
 
253
          math.type.Help = __webpack_require__(12);
 
254
          math.type.ResultSet = __webpack_require__(13);
255
255
          math.type.BigNumber = BigNumber;
256
256
 
257
 
          math.collection = __webpack_require__(13);
 
257
          math.collection = __webpack_require__(14);
258
258
 
259
259
          // expression (parse, Parser, nodes, docs)
260
260
          math.expression = {};
261
 
          math.expression.node = __webpack_require__(16);
262
 
          math.expression.parse = __webpack_require__(14);
263
 
          math.expression.Parser = __webpack_require__(15);
264
 
          math.expression.docs = __webpack_require__(17);
 
261
          math.expression.node = __webpack_require__(15);
 
262
          math.expression.parse = __webpack_require__(16);
 
263
          math.expression.Parser = __webpack_require__(17);
 
264
          math.expression.docs = __webpack_require__(18);
 
265
 
 
266
          // serialization utilities
 
267
          math.json = {
 
268
            reviver: __webpack_require__(19)
 
269
          };
265
270
 
266
271
          // expression parser
267
 
          __webpack_require__(29)(math, _config);
268
 
          __webpack_require__(30)(math, _config);
269
272
          __webpack_require__(31)(math, _config);
270
273
          __webpack_require__(32)(math, _config);
271
 
 
272
 
          // functions - arithmetic
273
274
          __webpack_require__(33)(math, _config);
274
275
          __webpack_require__(34)(math, _config);
 
276
 
 
277
          // functions - arithmetic
275
278
          __webpack_require__(35)(math, _config);
276
279
          __webpack_require__(36)(math, _config);
277
280
          __webpack_require__(37)(math, _config);
299
302
          __webpack_require__(59)(math, _config);
300
303
          __webpack_require__(60)(math, _config);
301
304
          __webpack_require__(61)(math, _config);
302
 
 
303
 
          // functions - bitwise
304
305
          __webpack_require__(62)(math, _config);
305
306
          __webpack_require__(63)(math, _config);
 
307
 
 
308
          // functions - bitwise
306
309
          __webpack_require__(64)(math, _config);
307
310
          __webpack_require__(65)(math, _config);
308
311
          __webpack_require__(66)(math, _config);
309
312
          __webpack_require__(67)(math, _config);
310
313
          __webpack_require__(68)(math, _config);
311
 
 
312
 
          // functions - complex
313
314
          __webpack_require__(69)(math, _config);
314
315
          __webpack_require__(70)(math, _config);
 
316
 
 
317
          // functions - complex
315
318
          __webpack_require__(71)(math, _config);
316
319
          __webpack_require__(72)(math, _config);
317
 
 
318
 
          // functions - construction
319
320
          __webpack_require__(73)(math, _config);
320
321
          __webpack_require__(74)(math, _config);
 
322
 
 
323
          // functions - construction
321
324
          __webpack_require__(75)(math, _config);
322
325
          __webpack_require__(76)(math, _config);
323
326
          __webpack_require__(77)(math, _config);
326
329
          __webpack_require__(80)(math, _config);
327
330
          __webpack_require__(81)(math, _config);
328
331
          __webpack_require__(82)(math, _config);
329
 
 
330
 
          // functions - logical
331
332
          __webpack_require__(83)(math, _config);
332
333
          __webpack_require__(84)(math, _config);
 
334
 
 
335
          // functions - logical
333
336
          __webpack_require__(85)(math, _config);
334
337
          __webpack_require__(86)(math, _config);
335
 
 
336
 
          // functions - matrix
337
338
          __webpack_require__(87)(math, _config);
338
339
          __webpack_require__(88)(math, _config);
 
340
 
 
341
          // functions - matrix
339
342
          __webpack_require__(89)(math, _config);
340
343
          __webpack_require__(90)(math, _config);
341
344
          __webpack_require__(91)(math, _config);
350
353
          __webpack_require__(100)(math, _config);
351
354
          __webpack_require__(101)(math, _config);
352
355
          __webpack_require__(102)(math, _config);
353
 
 
354
 
          // functions - probability
355
 
          //require('./function/probability/distribution')(math, _config); // TODO: rethink math.distribution
356
356
          __webpack_require__(103)(math, _config);
357
357
          __webpack_require__(104)(math, _config);
358
358
          __webpack_require__(105)(math, _config);
 
359
 
 
360
          // functions - probability
 
361
          //require('./function/probability/distribution')(math, _config); // TODO: rethink math.distribution
359
362
          __webpack_require__(106)(math, _config);
360
363
          __webpack_require__(107)(math, _config);
361
364
          __webpack_require__(108)(math, _config);
362
365
          __webpack_require__(109)(math, _config);
363
 
 
364
 
          // functions - relational
365
366
          __webpack_require__(110)(math, _config);
366
367
          __webpack_require__(111)(math, _config);
367
368
          __webpack_require__(112)(math, _config);
 
369
 
 
370
          // functions - relational
368
371
          __webpack_require__(113)(math, _config);
369
372
          __webpack_require__(114)(math, _config);
370
373
          __webpack_require__(115)(math, _config);
371
374
          __webpack_require__(116)(math, _config);
372
375
          __webpack_require__(117)(math, _config);
373
 
 
374
 
          // functions - statistics
375
376
          __webpack_require__(118)(math, _config);
376
377
          __webpack_require__(119)(math, _config);
377
378
          __webpack_require__(120)(math, _config);
 
379
 
 
380
          // functions - statistics
378
381
          __webpack_require__(121)(math, _config);
379
382
          __webpack_require__(122)(math, _config);
380
383
          __webpack_require__(123)(math, _config);
381
384
          __webpack_require__(124)(math, _config);
382
385
          __webpack_require__(125)(math, _config);
383
 
 
384
 
          // functions - trigonometry
385
386
          __webpack_require__(126)(math, _config);
386
387
          __webpack_require__(127)(math, _config);
387
388
          __webpack_require__(128)(math, _config);
 
389
 
 
390
          // functions - trigonometry
388
391
          __webpack_require__(129)(math, _config);
389
392
          __webpack_require__(130)(math, _config);
390
393
          __webpack_require__(131)(math, _config);
398
401
          __webpack_require__(139)(math, _config);
399
402
          __webpack_require__(140)(math, _config);
400
403
          __webpack_require__(141)(math, _config);
401
 
 
402
 
          // functions - units
403
404
          __webpack_require__(142)(math, _config);
404
 
 
405
 
          // functions - utils
406
405
          __webpack_require__(143)(math, _config);
407
406
          __webpack_require__(144)(math, _config);
408
407
          __webpack_require__(145)(math, _config);
412
411
          __webpack_require__(149)(math, _config);
413
412
          __webpack_require__(150)(math, _config);
414
413
          __webpack_require__(151)(math, _config);
 
414
          __webpack_require__(152)(math, _config);
 
415
          __webpack_require__(153)(math, _config);
 
416
 
 
417
          // functions - units
 
418
          __webpack_require__(154)(math, _config);
 
419
 
 
420
          // functions - utils
 
421
          __webpack_require__(155)(math, _config);
 
422
          __webpack_require__(156)(math, _config);
 
423
          __webpack_require__(157)(math, _config);
 
424
          __webpack_require__(158)(math, _config);
 
425
          __webpack_require__(159)(math, _config);
 
426
          __webpack_require__(160)(math, _config);
 
427
          __webpack_require__(161)(math, _config);
 
428
          __webpack_require__(162)(math, _config);
 
429
          __webpack_require__(163)(math, _config);
415
430
 
416
431
          // TODO: deprecated since version 0.25.0, remove some day.
417
432
          math.ifElse = function () {
419
434
          };
420
435
 
421
436
          // constants
422
 
          __webpack_require__(2)(math, _config);
 
437
          __webpack_require__(4)(math, _config);
423
438
 
424
439
          // attach transform functions (for converting one-based indices to zero-based)
425
 
          __webpack_require__(18)(math, _config);
426
 
          __webpack_require__(19)(math, _config);
427
 
          __webpack_require__(20)(math, _config);
428
 
          __webpack_require__(21)(math, _config);
429
 
          __webpack_require__(22)(math, _config);
430
 
          __webpack_require__(23)(math, _config);
431
 
          __webpack_require__(24)(math, _config);
432
 
          __webpack_require__(25)(math, _config);
433
 
          __webpack_require__(26)(math, _config);
434
 
          __webpack_require__(27)(math, _config);
 
440
          math.expression.transform = {
 
441
            concat: __webpack_require__(20)(math, _config),
 
442
            filter: __webpack_require__(21)(math, _config),
 
443
            forEach:__webpack_require__(22)(math, _config),
 
444
            index:  __webpack_require__(23)(math, _config),
 
445
            map:    __webpack_require__(24)(math, _config),
 
446
            max:    __webpack_require__(25)(math, _config),
 
447
            mean:   __webpack_require__(26)(math, _config),
 
448
            min:    __webpack_require__(27)(math, _config),
 
449
            range:  __webpack_require__(28)(math, _config),
 
450
            subset: __webpack_require__(29)(math, _config)
 
451
          };
435
452
 
436
453
          // selector (we initialize after all functions are loaded)
437
454
          math.chaining = {};
438
 
          math.chaining.Chain = __webpack_require__(28)(math, _config);
 
455
          math.chaining.Chain = __webpack_require__(30)(math, _config);
439
456
          math.chaining.Selector = math.chaining.Chain; // TODO: deprecate in v2.0
440
457
 
441
458
          // apply provided configuration options
464
481
 
465
482
        'use strict';
466
483
 
467
 
        module.exports = function (math, config) {
468
 
          var bignumber = __webpack_require__(152);
469
 
          var Complex = __webpack_require__(6);
470
 
          var BigNumber = math.type.BigNumber;
471
 
 
472
 
          var big = config.number === 'bignumber';
473
 
 
474
 
          // TODO: in case of support for defineProperty, we can lazy evaluate the BigNumber constants by creating them as properties (calculation of PI is slow for example)
475
 
          math.pi          = big ? bignumber.pi(config.precision)  : Math.PI;
476
 
          math.tau         = big ? bignumber.tau(config.precision) : Math.PI * 2;
477
 
          math.e           = big ? bignumber.e(config.precision)   : Math.E;
478
 
          math.phi         = big ? bignumber.phi(config.precision) : 1.61803398874989484820458683436563811772030917980576286213545; // golden ratio, (1+sqrt(5))/2
479
 
 
480
 
          math.i           = new Complex(0, 1);
481
 
 
482
 
          math['Infinity'] = Infinity;
483
 
          math['NaN']      = NaN;
484
 
          math['true']     = true;
485
 
          math['false']    = false;
486
 
          math['null']     = null;
487
 
          math['uninitialized'] = __webpack_require__(153).UNINITIALIZED;
488
 
 
489
 
          // uppercase constants (for compatibility with built-in Math)
490
 
          math.E           = math.e;
491
 
          math.LN2         = big ? new BigNumber(2).ln()                        : Math.LN2;
492
 
          math.LN10        = big ? new BigNumber(10).ln()                       : Math.LN10;
493
 
          math.LOG2E       = big ? new BigNumber(1).div(new BigNumber(2).ln())  : Math.LOG2E;
494
 
          math.LOG10E      = big ? new BigNumber(1).div(new BigNumber(10).ln()) : Math.LOG10E;
495
 
          math.PI          = math.pi;
496
 
          math.SQRT1_2     = big ? new BigNumber(0.5).sqrt()                    : Math.SQRT1_2;
497
 
          math.SQRT2       = big ? new BigNumber(2).sqrt()                      : Math.SQRT2;
498
 
 
499
 
          // meta information
500
 
          math.version = __webpack_require__(154);
501
 
        };
502
 
 
503
 
 
504
 
/***/ },
505
 
/* 3 */
506
 
/***/ function(module, exports, __webpack_require__) {
507
 
 
508
 
        'use strict';
509
 
 
510
484
        /**
511
485
         * Clone an object
512
486
         *
652
626
          }
653
627
        };
654
628
 
 
629
        /**
 
630
         * Test whether the current JavaScript engine supports Object.defineProperty
 
631
         * @returns {boolean} returns true if supported
 
632
         */
 
633
        exports.canDefineProperty = function () {
 
634
          // test needed for broken IE8 implementation
 
635
          try {
 
636
            if (Object.defineProperty) {
 
637
              Object.defineProperty({}, 'x', {});
 
638
              return true;
 
639
            }
 
640
          } catch (e) {}
 
641
 
 
642
          return false;
 
643
        };
 
644
 
 
645
        /**
 
646
         * Attach a lazy loading property to a constant.
 
647
         * The given function `fn` is called once when the property is first requested.
 
648
         * On older browsers (<IE8), the function will fall back to direct evaluation
 
649
         * of the properties value.
 
650
         * @param {Object} object   Object where to add the property
 
651
         * @param {string} prop     Property name
 
652
         * @param {function} fn     Function returning the property value. Called
 
653
         *                          without arguments.
 
654
         */
 
655
        exports.lazy = function (object, prop, fn) {
 
656
          if (exports.canDefineProperty()) {
 
657
            var _uninitialized = true;
 
658
            var _value;
 
659
            Object.defineProperty(object, prop, {
 
660
              get: function () {
 
661
                if (_uninitialized) {
 
662
                  _value = fn();
 
663
                  _uninitialized = false;
 
664
                }
 
665
                return _value;
 
666
              },
 
667
 
 
668
              set: function (value) {
 
669
                _value = value;
 
670
                _uninitialized = false;
 
671
              }
 
672
            });
 
673
          }
 
674
          else {
 
675
            // fall back to immediate evaluation
 
676
            object[prop] = fn();
 
677
          }
 
678
        };
 
679
 
655
680
 
656
681
/***/ },
657
 
/* 4 */
 
682
/* 3 */
658
683
/***/ function(module, exports, __webpack_require__) {
659
684
 
660
685
        'use strict';
938
963
 
939
964
 
940
965
/***/ },
 
966
/* 4 */
 
967
/***/ function(module, exports, __webpack_require__) {
 
968
 
 
969
        'use strict';
 
970
 
 
971
        module.exports = function (math, config) {
 
972
          var object = __webpack_require__(2);
 
973
          var bignumber = __webpack_require__(164);
 
974
          var Complex = __webpack_require__(7);
 
975
          var BigNumber = math.type.BigNumber;
 
976
 
 
977
          math['true']     = true;
 
978
          math['false']    = false;
 
979
          math['null']     = null;
 
980
          math['uninitialized'] = __webpack_require__(165).UNINITIALIZED;
 
981
 
 
982
          if (config.number === 'bignumber') {
 
983
            math['Infinity'] = new BigNumber(Infinity);
 
984
            math['NaN']      = new BigNumber(NaN);
 
985
 
 
986
            object.lazy(math, 'pi',  function () {return bignumber.pi(config.precision)});
 
987
            object.lazy(math, 'tau', function () {return bignumber.tau(config.precision)});
 
988
            object.lazy(math, 'e',   function () {return bignumber.e(config.precision)});
 
989
            object.lazy(math, 'phi', function () {return bignumber.phi(config.precision)}); // golden ratio, (1+sqrt(5))/2
 
990
 
 
991
            // uppercase constants (for compatibility with built-in Math)
 
992
            object.lazy(math, 'E',       function () {return math.e;});
 
993
            object.lazy(math, 'LN2',     function () {return new BigNumber(2).ln();});
 
994
            object.lazy(math, 'LN10',    function () {return new BigNumber(10).ln()});
 
995
            object.lazy(math, 'LOG2E',   function () {return new BigNumber(1).div(new BigNumber(2).ln());});
 
996
            object.lazy(math, 'LOG10E',  function () {return new BigNumber(1).div(new BigNumber(10).ln())});
 
997
            object.lazy(math, 'PI',      function () {return math.pi});
 
998
            object.lazy(math, 'SQRT1_2', function () {return new BigNumber('0.5').sqrt()});
 
999
            object.lazy(math, 'SQRT2',   function () {return new BigNumber(2).sqrt()});
 
1000
          }
 
1001
          else {
 
1002
            math['Infinity'] = Infinity;
 
1003
            math['NaN']      = NaN;
 
1004
 
 
1005
            math.pi  = Math.PI;
 
1006
            math.tau = Math.PI * 2;
 
1007
            math.e   = Math.E;
 
1008
            math.phi = 1.61803398874989484820458683436563811772030917980576286213545; // golden ratio, (1+sqrt(5))/2
 
1009
 
 
1010
            // uppercase constants (for compatibility with built-in Math)
 
1011
            math.E           = math.e;
 
1012
            math.LN2         = Math.LN2;
 
1013
            math.LN10        = Math.LN10;
 
1014
            math.LOG2E       = Math.LOG2E;
 
1015
            math.LOG10E      = Math.LOG10E;
 
1016
            math.PI          = math.pi;
 
1017
            math.SQRT1_2     = Math.SQRT1_2;
 
1018
            math.SQRT2       = Math.SQRT2;
 
1019
          }
 
1020
 
 
1021
          // complex i
 
1022
          math.i = new Complex(0, 1);
 
1023
 
 
1024
          // meta information
 
1025
          math.version = __webpack_require__(166);
 
1026
        };
 
1027
 
 
1028
 
 
1029
/***/ },
941
1030
/* 5 */
942
1031
/***/ function(module, exports, __webpack_require__) {
943
1032
 
 
1033
        var BigNumber = __webpack_require__(336);
 
1034
 
 
1035
        // FIXME: replace all require('decimal.js') with require('./BigNumber').
 
1036
 
 
1037
        /**
 
1038
         * Get a JSON representation of a BigNumber containing
 
1039
         * type information
 
1040
         * @returns {Object} Returns a JSON object structured as:
 
1041
         *                   `{"mathjs": "BigNumber", "value": "0.2"}`
 
1042
         */
 
1043
        BigNumber.prototype.toJSON = function () {
 
1044
          return {
 
1045
            mathjs: 'BigNumber',
 
1046
            value: this.toString()
 
1047
          };
 
1048
        };
 
1049
 
 
1050
        /**
 
1051
         * Instantiate a BigNumber from a JSON object
 
1052
         * @param {Object} json  a JSON object structured as:
 
1053
         *                       `{"mathjs": "BigNumber", "value": "0.2"}`
 
1054
         * @return {BigNumber}
 
1055
         */
 
1056
        BigNumber.fromJSON = function (json) {
 
1057
          return new BigNumber(json.value);
 
1058
        };
 
1059
 
 
1060
        module.exports = BigNumber;
 
1061
 
 
1062
 
 
1063
/***/ },
 
1064
/* 6 */
 
1065
/***/ function(module, exports, __webpack_require__) {
 
1066
 
944
1067
        'use strict';
945
1068
 
946
 
        exports.ArgumentsError = __webpack_require__(155);
947
 
        exports.DimensionError = __webpack_require__(156);
948
 
        exports.IndexError = __webpack_require__(157);
949
 
        exports.UnsupportedTypeError = __webpack_require__(158);
 
1069
        exports.ArgumentsError = __webpack_require__(167);
 
1070
        exports.DimensionError = __webpack_require__(168);
 
1071
        exports.IndexError = __webpack_require__(169);
 
1072
        exports.UnsupportedTypeError = __webpack_require__(170);
950
1073
 
951
1074
        // TODO: implement an InvalidValueError?
952
1075
 
953
1076
 
954
1077
/***/ },
955
 
/* 6 */
 
1078
/* 7 */
956
1079
/***/ function(module, exports, __webpack_require__) {
957
1080
 
958
1081
        'use strict';
959
1082
 
960
 
        var util = __webpack_require__(160),
961
 
            Unit = __webpack_require__(10),
 
1083
        var util = __webpack_require__(171),
 
1084
            Unit = __webpack_require__(11),
962
1085
            number = util.number,
963
1086
 
964
1087
            isNumber = util.number.isNumber,
1334
1457
         * @return {String} str
1335
1458
         */
1336
1459
        Complex.prototype.format = function (options) {
1337
 
          var str = '',
1338
 
              strRe = number.format(this.re, options),
1339
 
              strIm = number.format(this.im, options);
1340
 
 
1341
 
          if (this.im == 0) {
 
1460
          var str = '';
 
1461
          var im = this.im;
 
1462
          var re = this.re;
 
1463
          var strRe = number.format(this.re, options);
 
1464
          var strIm = number.format(this.im, options);
 
1465
 
 
1466
          // round either re or im when smaller than the configured precision
 
1467
          var precision = isNumber(options) ? options : options ? options.precision : null;
 
1468
          if (precision !== null) {
 
1469
            var epsilon = Math.pow(10, -precision);
 
1470
            if (Math.abs(re / im) < epsilon) {re = 0;}
 
1471
            if (Math.abs(im / re) < epsilon) {im = 0;}
 
1472
          }
 
1473
 
 
1474
          if (im == 0) {
1342
1475
            // real value
1343
1476
            str = strRe;
1344
1477
          }
1345
 
          else if (this.re == 0) {
 
1478
          else if (re == 0) {
1346
1479
            // purely complex value
1347
 
            if (this.im == 1) {
 
1480
            if (im == 1) {
1348
1481
              str = 'i';
1349
1482
            }
1350
 
            else if (this.im == -1) {
 
1483
            else if (im == -1) {
1351
1484
              str = '-i';
1352
1485
            }
1353
1486
            else {
1356
1489
          }
1357
1490
          else {
1358
1491
            // complex value
1359
 
            if (this.im > 0) {
1360
 
              if (this.im == 1) {
 
1492
            if (im > 0) {
 
1493
              if (im == 1) {
1361
1494
                str = strRe + ' + i';
1362
1495
              }
1363
1496
              else {
1365
1498
              }
1366
1499
            }
1367
1500
            else {
1368
 
              if (this.im == -1) {
 
1501
              if (im == -1) {
1369
1502
                str = strRe + ' - i';
1370
1503
              }
1371
1504
              else {
1386
1519
        };
1387
1520
 
1388
1521
        /**
 
1522
         * Get a JSON representation of the complex number
 
1523
         * @returns {Object} Returns a JSON object structured as:
 
1524
         *                   `{"mathjs": "Complex", "re": 2, "im": 3}`
 
1525
         */
 
1526
        Complex.prototype.toJSON = function () {
 
1527
          return {
 
1528
            mathjs: 'Complex',
 
1529
            re: this.re,
 
1530
            im: this.im
 
1531
          };
 
1532
        };
 
1533
 
 
1534
        /**
 
1535
         * Create a Complex number from a JSON object
 
1536
         * @param {Object} json  A JSON Object structured as
 
1537
         *                       {"mathjs": "Complex", "re": 2, "im": 3}
 
1538
         *                       All properties are optional, default values
 
1539
         *                       for `re` and `im` are 0.
 
1540
         * @return {Complex} Returns a new Complex number
 
1541
         */
 
1542
        Complex.fromJSON = function (json) {
 
1543
          return new Complex(json);
 
1544
        };
 
1545
 
 
1546
        /**
1389
1547
         * Returns a string representation of the complex number.
1390
1548
         * @return {String} str
1391
1549
         */
1396
1554
 
1397
1555
 
1398
1556
/***/ },
1399
 
/* 7 */
 
1557
/* 8 */
1400
1558
/***/ function(module, exports, __webpack_require__) {
1401
1559
 
1402
1560
        'use strict';
1403
1561
 
1404
 
        var util = __webpack_require__(160);
 
1562
        var util = __webpack_require__(171);
1405
1563
 
1406
1564
        var number = util.number;
1407
1565
        var string = util.string;
1666
1824
          return this.format();
1667
1825
        };
1668
1826
 
 
1827
        /**
 
1828
         * Get a JSON representation of the range
 
1829
         * @returns {Object} Returns a JSON object structured as:
 
1830
         *                   `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
 
1831
         */
 
1832
        Range.prototype.toJSON = function () {
 
1833
          return {
 
1834
            mathjs: 'Range',
 
1835
            start: this.start,
 
1836
            end: this.end,
 
1837
            step: this.step
 
1838
          };
 
1839
        };
 
1840
 
 
1841
        /**
 
1842
         * Instantiate a Range from a JSON object
 
1843
         * @param {Object} json A JSON object structured as:
 
1844
         *                      `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
 
1845
         * @return {Range}
 
1846
         */
 
1847
        Range.fromJSON = function (json) {
 
1848
          return new Range(json.start, json.end, json.step);
 
1849
        };
 
1850
 
1669
1851
        // exports
1670
1852
        module.exports = Range;
1671
1853
 
1672
1854
 
1673
1855
/***/ },
1674
 
/* 8 */
 
1856
/* 9 */
1675
1857
/***/ function(module, exports, __webpack_require__) {
1676
1858
 
1677
1859
        'use strict';
1678
1860
 
1679
 
        var util = __webpack_require__(160),
 
1861
        var util = __webpack_require__(171),
1680
1862
 
1681
 
            Range = __webpack_require__(7),
 
1863
            Range = __webpack_require__(8),
1682
1864
 
1683
1865
            number = util.number,
1684
1866
 
1941
2123
          return '[' + strings.join(', ') + ']';
1942
2124
        };
1943
2125
 
 
2126
        /**
 
2127
         * Get a JSON representation of the Index
 
2128
         * @returns {Object} Returns a JSON object structured as:
 
2129
         *                   `{"mathjs": "Index", "ranges": [{"mathjs": "Range", start: 0, end: 10, step:1}, ...]}`
 
2130
         */
 
2131
        Index.prototype.toJSON = function () {
 
2132
          return {
 
2133
            mathjs: 'Index',
 
2134
            ranges: this._ranges
 
2135
          };
 
2136
        };
 
2137
 
 
2138
        /**
 
2139
         * Instantiate an Index from a JSON object
 
2140
         * @param {Object} json A JSON object structured as:
 
2141
         *                     `{"mathjs": "Index", "ranges": [{"mathjs": "Range", start: 0, end: 10, step:1}, ...]}`
 
2142
         * @return {Index}
 
2143
         */
 
2144
        Index.fromJSON = function (json) {
 
2145
          return Index.create(json.ranges);
 
2146
        };
 
2147
 
1944
2148
        // exports
1945
2149
        module.exports = Index;
1946
2150
 
1947
2151
 
1948
2152
/***/ },
1949
 
/* 9 */
 
2153
/* 10 */
1950
2154
/***/ function(module, exports, __webpack_require__) {
1951
2155
 
1952
2156
        'use strict';
1953
2157
 
1954
 
        var util = __webpack_require__(160),
1955
 
            DimensionError = __webpack_require__(156),
1956
 
 
1957
 
            Index = __webpack_require__(8),
1958
 
 
1959
 
            number = util.number,
1960
 
            string = util.string,
1961
 
            array = util.array,
1962
 
            object = util.object,
1963
 
 
1964
 
            isArray = Array.isArray,
1965
 
            validateIndex = array.validateIndex;
 
2158
        var util = __webpack_require__(171);
 
2159
        var DimensionError = __webpack_require__(168);
 
2160
 
 
2161
        var Index = __webpack_require__(9);
 
2162
 
 
2163
        var number = util.number;
 
2164
        var string = util.string;
 
2165
        var array = util.array;
 
2166
        var object = util.object;
 
2167
 
 
2168
        var isArray = Array.isArray;
 
2169
        var validateIndex = array.validateIndex;
1966
2170
 
1967
2171
        /**
1968
2172
         * @constructor Matrix
2443
2647
        };
2444
2648
 
2445
2649
        /**
 
2650
         * Get a JSON representation of the matrix
 
2651
         * @returns {Object}
 
2652
         */
 
2653
        Matrix.prototype.toJSON = function () {
 
2654
          return {
 
2655
            mathjs: 'Matrix',
 
2656
            data: this._data
 
2657
          }
 
2658
        };
 
2659
 
 
2660
        /**
 
2661
         * Generate a matrix from a JSON object
 
2662
         * @param {Object} json  An object structured like
 
2663
         *                       `{"mathjs": "Matrix", data: []}`,
 
2664
         *                       where mathjs is optional
 
2665
         * @returns {Matrix}
 
2666
         */
 
2667
        Matrix.fromJSON = function (json) {
 
2668
          return new Matrix(json.data);
 
2669
        };
 
2670
 
 
2671
        /**
2446
2672
         * Preprocess data, which can be an Array or Matrix with nested Arrays and
2447
2673
         * Matrices. Replaces all nested Matrices with Arrays
2448
2674
         * @param {Array} data
2467
2693
 
2468
2694
 
2469
2695
/***/ },
2470
 
/* 10 */
 
2696
/* 11 */
2471
2697
/***/ function(module, exports, __webpack_require__) {
2472
2698
 
2473
2699
        'use strict';
2474
2700
 
2475
 
        var util = __webpack_require__(160),
 
2701
        var util = __webpack_require__(171),
2476
2702
 
2477
2703
            number = util.number,
2478
2704
            string = util.string,
2731
2957
        };
2732
2958
 
2733
2959
        /**
2734
 
         * Unnormalize a value, based on its currently set unit
 
2960
         * Denormalize a value, based on its currently set unit
2735
2961
         * @param {Number} value
2736
2962
         * @param {Number} [prefixValue]    Optional prefix value to be used
2737
 
         * @return {Number} unnormalized value
 
2963
         * @return {Number} denormalized value
2738
2964
         * @private
2739
2965
         */
2740
 
        Unit.prototype._unnormalize = function (value, prefixValue) {
 
2966
        Unit.prototype._denormalize = function (value, prefixValue) {
2741
2967
          if (prefixValue == undefined) {
2742
2968
            return value / this.unit.value / this.prefix.value - this.unit.offset;
2743
2969
          }
2856
3082
         */
2857
3083
        Unit.prototype.toNumber = function (valuelessUnit) {
2858
3084
          var other = this.to(valuelessUnit);
2859
 
          return other._unnormalize(other.value, other.prefix.value);
 
3085
          return other._denormalize(other.value, other.prefix.value);
2860
3086
        };
2861
3087
 
2862
3088
 
2869
3095
        };
2870
3096
 
2871
3097
        /**
 
3098
         * Get a JSON representation of the unit
 
3099
         * @returns {Object} Returns a JSON object structured as:
 
3100
         *                   `{"mathjs": "Unit", "value": 2, "unit": "cm", "fixPrefix": false}`
 
3101
         */
 
3102
        Unit.prototype.toJSON = function () {
 
3103
          return {
 
3104
            mathjs: 'Unit',
 
3105
            value: this._denormalize(this.value),
 
3106
            unit: this.prefix.name + this.unit.name,
 
3107
            fixPrefix: this.fixPrefix
 
3108
          };
 
3109
        };
 
3110
 
 
3111
        /**
 
3112
         * Instantiate a Unit from a JSON object
 
3113
         * @param {Object} json  A JSON object structured as:
 
3114
         *                       `{"mathjs": "Unit", "value": 2, "unit": "cm", "fixPrefix": false}`
 
3115
         * @return {Unit}
 
3116
         */
 
3117
        Unit.fromJSON = function (json) {
 
3118
          var unit = new Unit(json.value, json.unit);
 
3119
          unit.fixPrefix = json.fixPrefix || false;
 
3120
          return unit;
 
3121
        };
 
3122
 
 
3123
        /**
2872
3124
         * Returns the string representation of the unit.
2873
3125
         * @return {String}
2874
3126
         */
2888
3140
 
2889
3141
          if (this.value !== null && !this.fixPrefix) {
2890
3142
            var bestPrefix = this._bestPrefix();
2891
 
            value = this._unnormalize(this.value, bestPrefix.value);
 
3143
            value = this._denormalize(this.value, bestPrefix.value);
2892
3144
            str = number.format(value, options) + ' ';
2893
3145
            str += bestPrefix.name + this.unit.name;
2894
3146
          }
2895
3147
          else {
2896
 
            value = this._unnormalize(this.value);
 
3148
            value = this._denormalize(this.value);
2897
3149
            str = (this.value !== null) ? (number.format(value, options) + ' ') : '';
2898
3150
            str += this.prefix.name + this.unit.name;
2899
3151
          }
3221
3473
          ampere: {name: 'ampere', base: BASE_UNITS.CURRENT, prefixes: PREFIXES.LONG, value: 1, offset: 0},
3222
3474
 
3223
3475
          // Temperature
3224
 
          // K(C) = °C + 273.15
3225
 
          // K(F) = (°F + 459.67) / 1.8
3226
 
          // K(R) = °R / 1.8
 
3476
          // K(C) = Â°C + 273.15
 
3477
          // K(F) = (°F + 459.67) / 1.8
 
3478
          // K(R) = Â°R / 1.8
3227
3479
          K: {name: 'K', base: BASE_UNITS.TEMPERATURE, prefixes: PREFIXES.NONE, value: 1, offset: 0},
3228
3480
          degC: {name: 'degC', base: BASE_UNITS.TEMPERATURE, prefixes: PREFIXES.NONE, value: 1, offset: 273.15},
3229
3481
          degF: {name: 'degF', base: BASE_UNITS.TEMPERATURE, prefixes: PREFIXES.NONE, value: 1/1.8, offset: 459.67},
3339
3591
 
3340
3592
 
3341
3593
/***/ },
3342
 
/* 11 */
 
3594
/* 12 */
3343
3595
/***/ function(module, exports, __webpack_require__) {
3344
3596
 
3345
3597
        'use strict';
3346
3598
 
3347
 
        var util = __webpack_require__(160),
3348
 
            object = util.object,
3349
 
            string = util.string;
 
3599
        var util = __webpack_require__(171);
 
3600
        var object = util.object;
 
3601
        var string = util.string;
3350
3602
 
3351
3603
        /**
3352
3604
         * Documentation object
3353
 
         * @param {Object} math The math.js namespace
3354
3605
         * @param {Object} doc  Object containing properties:
3355
3606
         *                      {String} name
3356
3607
         *                      {String} category
 
3608
         *                      {String} description
3357
3609
         *                      {String[]} syntax
3358
3610
         *                      {String[]} examples
3359
3611
         *                      {String[]} seealso
3360
3612
         * @constructor
3361
3613
         */
3362
 
        function Help (math, doc) {
 
3614
        function Help (doc) {
3363
3615
          if (!(this instanceof Help)) {
3364
3616
            throw new SyntaxError('Constructor must be called with the new operator');
3365
3617
          }
3366
3618
 
3367
 
          // TODO: throw an error when math or doc is not provided
 
3619
          if (!doc)  throw new Error('Argument "doc" missing');
3368
3620
 
3369
 
          this.math = math;
3370
3621
          this.doc = doc;
3371
3622
        }
3372
3623
 
3381
3632
 
3382
3633
        /**
3383
3634
         * Generate readable description from a Help object
 
3635
         * @param {Object} [math]   A math instance, used to evaluate the examples
3384
3636
         * @return {String} readableDoc
3385
3637
         * @private
3386
3638
         */
3387
 
        Help.prototype.toString = function () {
 
3639
        Help.prototype.toText = function (math) {
3388
3640
          var doc = this.doc || {};
3389
3641
          var desc = '\n';
3390
3642
 
3401
3653
            desc += 'Syntax:\n    ' + doc.syntax.join('\n    ') + '\n\n';
3402
3654
          }
3403
3655
          if (doc.examples) {
3404
 
            var parser = this.math.parser();
 
3656
            var parser = math && math.parser();
3405
3657
            desc += 'Examples:\n';
3406
3658
            for (var i = 0; i < doc.examples.length; i++) {
3407
3659
              var expr = doc.examples[i];
3408
 
              var res;
3409
 
              try {
3410
 
                res = parser.eval(expr);
3411
 
              }
3412
 
              catch (e) {
3413
 
                res = e;
3414
 
              }
3415
3660
              desc += '    ' + expr + '\n';
3416
 
              if (res !== undefined && !(res instanceof Help)) {
3417
 
                desc += '        ' + string.format(res, {precision: 14}) + '\n';
 
3661
 
 
3662
              if (parser) {
 
3663
                var res;
 
3664
                try {
 
3665
                  res = parser.eval(expr);
 
3666
                }
 
3667
                catch (e) {
 
3668
                  res = e;
 
3669
                }
 
3670
                if (res !== undefined && !(res instanceof Help)) {
 
3671
                  desc += '        ' + string.format(res, {precision: 14}) + '\n';
 
3672
                }
3418
3673
              }
3419
3674
            }
3420
3675
            desc += '\n';
3426
3681
          return desc;
3427
3682
        };
3428
3683
 
3429
 
        // TODO: implement a toHTML function in Help
 
3684
        /**
 
3685
         * Generate a string representation of the Help object
 
3686
         * @return {String} Returns a string
 
3687
         * @private
 
3688
         */
 
3689
        Help.prototype.toString = function () {
 
3690
          return this.toText();
 
3691
        };
3430
3692
 
3431
3693
        /**
3432
3694
         * Export the help object to JSON
3433
3695
         */
3434
3696
        Help.prototype.toJSON = function () {
3435
 
          return object.clone(this.doc);
 
3697
          var obj = object.clone(this.doc);
 
3698
          obj.mathjs = 'Help';
 
3699
          return obj;
 
3700
        };
 
3701
 
 
3702
        /**
 
3703
         * Instantiate a Help object from a JSON object
 
3704
         * @param {Object} json
 
3705
         * @returns {Help} Returns a new Help object
 
3706
         */
 
3707
        Help.fromJSON = function (json) {
 
3708
          var doc = {};
 
3709
          for (var prop in json) {
 
3710
            if (prop !== 'mathjs') { // ignore mathjs field
 
3711
              doc[prop] = json[prop];
 
3712
            }
 
3713
          }
 
3714
          return new Help(doc);
3436
3715
        };
3437
3716
 
3438
3717
        /**
3445
3724
 
3446
3725
 
3447
3726
/***/ },
3448
 
/* 12 */
 
3727
/* 13 */
3449
3728
/***/ function(module, exports, __webpack_require__) {
3450
3729
 
3451
3730
        'use strict';
3479
3758
          return '[' + this.entries.join(', ') + ']';
3480
3759
        };
3481
3760
 
 
3761
        /**
 
3762
         * Get a JSON representation of the ResultSet
 
3763
         * @returns {Object} Returns a JSON object structured as:
 
3764
         *                   `{"mathjs": "ResultSet", "entries": [...]}`
 
3765
         */
 
3766
        ResultSet.prototype.toJSON = function () {
 
3767
          return {
 
3768
            mathjs: 'ResultSet',
 
3769
            entries: this.entries
 
3770
          };
 
3771
        };
 
3772
 
 
3773
        /**
 
3774
         * Instantiate a ResultSet from a JSON object
 
3775
         * @param {Object} json  A JSON object structured as:
 
3776
         *                       `{"mathjs": "ResultSet", "entries": [...]}`
 
3777
         * @return {ResultSet}
 
3778
         */
 
3779
        ResultSet.fromJSON = function (json) {
 
3780
          return new ResultSet(json.entries);
 
3781
        };
 
3782
 
3482
3783
        module.exports = ResultSet;
3483
3784
 
3484
3785
 
3485
3786
/***/ },
3486
 
/* 13 */
 
3787
/* 14 */
3487
3788
/***/ function(module, exports, __webpack_require__) {
3488
3789
 
3489
3790
        // utility methods for arrays and matrices
3490
3791
        'use strict';
3491
3792
 
3492
 
        var util = __webpack_require__(160),
3493
 
 
3494
 
            IndexError = __webpack_require__(157),
3495
 
            DimensionError = __webpack_require__(156),
3496
 
 
3497
 
            Matrix = __webpack_require__(9),
 
3793
        var util = __webpack_require__(171),
 
3794
 
 
3795
            IndexError = __webpack_require__(169),
 
3796
            DimensionError = __webpack_require__(168),
 
3797
 
 
3798
            Matrix = __webpack_require__(10),
3498
3799
 
3499
3800
            array = util.array,
3500
3801
            isArray = util.array.isArray,
3750
4051
 
3751
4052
 
3752
4053
/***/ },
3753
 
/* 14 */
3754
 
/***/ function(module, exports, __webpack_require__) {
3755
 
 
3756
 
        'use strict';
3757
 
 
3758
 
        var util = __webpack_require__(160),
3759
 
 
3760
 
            ArgumentsError = __webpack_require__(155),
 
4054
/* 15 */
 
4055
/***/ function(module, exports, __webpack_require__) {
 
4056
 
 
4057
        'use strict';
 
4058
 
 
4059
        exports.ArrayNode = __webpack_require__(172);
 
4060
        exports.AssignmentNode = __webpack_require__(173);
 
4061
        exports.BlockNode = __webpack_require__(174);
 
4062
        exports.ConditionalNode = __webpack_require__(175);
 
4063
        exports.ConstantNode = __webpack_require__(176);
 
4064
        exports.IndexNode = __webpack_require__(177);
 
4065
        exports.FunctionAssignmentNode = __webpack_require__(178);
 
4066
        exports.FunctionNode = __webpack_require__(179);
 
4067
        exports.Node = __webpack_require__(180);
 
4068
        exports.OperatorNode = __webpack_require__(181);
 
4069
        exports.RangeNode = __webpack_require__(182);
 
4070
        exports.SymbolNode = __webpack_require__(183);
 
4071
        exports.UpdateNode = __webpack_require__(184);
 
4072
 
 
4073
 
 
4074
/***/ },
 
4075
/* 16 */
 
4076
/***/ function(module, exports, __webpack_require__) {
 
4077
 
 
4078
        'use strict';
 
4079
 
 
4080
        var util = __webpack_require__(171),
 
4081
 
 
4082
            ArgumentsError = __webpack_require__(167),
3761
4083
 
3762
4084
            isString = util.string.isString,
3763
4085
            isArray = Array.isArray,
3764
4086
            type = util.types.type,
3765
4087
 
3766
4088
            // types
3767
 
            Complex = __webpack_require__(6),
3768
 
            Matrix = __webpack_require__(9),
3769
 
            Unit = __webpack_require__(10),
3770
 
            collection = __webpack_require__(13),
 
4089
            Complex = __webpack_require__(7),
 
4090
            Matrix = __webpack_require__(10),
 
4091
            Unit = __webpack_require__(11),
 
4092
            collection = __webpack_require__(14),
3771
4093
 
3772
4094
            // scope and nodes
3773
 
            ArrayNode = __webpack_require__(161),
3774
 
            AssignmentNode = __webpack_require__(162),
3775
 
            BlockNode = __webpack_require__(163),
3776
 
            ConditionalNode = __webpack_require__(164),
3777
 
            ConstantNode = __webpack_require__(165),
3778
 
            FunctionAssignmentNode = __webpack_require__(166),
3779
 
            IndexNode = __webpack_require__(167),
3780
 
            OperatorNode = __webpack_require__(168),
3781
 
            FunctionNode = __webpack_require__(169),
3782
 
            RangeNode = __webpack_require__(170),
3783
 
            SymbolNode = __webpack_require__(171),
3784
 
            UpdateNode = __webpack_require__(172);
 
4095
            ArrayNode = __webpack_require__(172),
 
4096
            AssignmentNode = __webpack_require__(173),
 
4097
            BlockNode = __webpack_require__(174),
 
4098
            ConditionalNode = __webpack_require__(175),
 
4099
            ConstantNode = __webpack_require__(176),
 
4100
            FunctionAssignmentNode = __webpack_require__(178),
 
4101
            IndexNode = __webpack_require__(177),
 
4102
            OperatorNode = __webpack_require__(181),
 
4103
            FunctionNode = __webpack_require__(179),
 
4104
            RangeNode = __webpack_require__(182),
 
4105
            SymbolNode = __webpack_require__(183),
 
4106
            UpdateNode = __webpack_require__(184);
3785
4107
 
3786
4108
        /**
3787
4109
         * Parse an expression. Returns a node tree, which can be evaluated by
5136
5458
 
5137
5459
 
5138
5460
/***/ },
5139
 
/* 15 */
 
5461
/* 17 */
5140
5462
/***/ function(module, exports, __webpack_require__) {
5141
5463
 
5142
5464
        'use strict';
5143
5465
 
5144
 
        var _parse = __webpack_require__(14);
 
5466
        var _parse = __webpack_require__(16);
5145
5467
 
5146
5468
        /**
5147
5469
         * @constructor Parser
5287
5609
 
5288
5610
 
5289
5611
/***/ },
5290
 
/* 16 */
5291
 
/***/ function(module, exports, __webpack_require__) {
5292
 
 
5293
 
        'use strict';
5294
 
 
5295
 
        exports.ArrayNode = __webpack_require__(161);
5296
 
        exports.AssignmentNode = __webpack_require__(162);
5297
 
        exports.BlockNode = __webpack_require__(163);
5298
 
        exports.ConditionalNode = __webpack_require__(164);
5299
 
        exports.ConstantNode = __webpack_require__(165);
5300
 
        exports.IndexNode = __webpack_require__(167);
5301
 
        exports.FunctionAssignmentNode = __webpack_require__(166);
5302
 
        exports.FunctionNode = __webpack_require__(169);
5303
 
        exports.Node = __webpack_require__(173);
5304
 
        exports.OperatorNode = __webpack_require__(168);
5305
 
        exports.RangeNode = __webpack_require__(170);
5306
 
        exports.SymbolNode = __webpack_require__(171);
5307
 
        exports.UpdateNode = __webpack_require__(172);
5308
 
 
5309
 
 
5310
 
/***/ },
5311
 
/* 17 */
 
5612
/* 18 */
5312
5613
/***/ function(module, exports, __webpack_require__) {
5313
5614
 
5314
5615
        // constants
5315
 
        exports.e = __webpack_require__(177);
5316
 
        exports.E = __webpack_require__(177);
5317
 
        exports['false'] = __webpack_require__(178);
5318
 
        exports.i = __webpack_require__(179);
5319
 
        exports['Infinity'] = __webpack_require__(180);
5320
 
        exports.LN2 = __webpack_require__(181);
5321
 
        exports.LN10 = __webpack_require__(182);
5322
 
        exports.LOG2E = __webpack_require__(183);
5323
 
        exports.LOG10E = __webpack_require__(184);
5324
 
        exports.NaN = __webpack_require__(185);
5325
 
        exports['null'] = __webpack_require__(186);
5326
 
        exports.pi = __webpack_require__(187);
5327
 
        exports.PI = __webpack_require__(187);
5328
 
        exports.phi = __webpack_require__(188);
5329
 
        exports.SQRT1_2 = __webpack_require__(189);
5330
 
        exports.SQRT2 = __webpack_require__(190);
5331
 
        exports.tau = __webpack_require__(191);
5332
 
        exports['true'] = __webpack_require__(192);
5333
 
        exports.version = __webpack_require__(193);
 
5616
        exports.e = __webpack_require__(185);
 
5617
        exports.E = __webpack_require__(185);
 
5618
        exports['false'] = __webpack_require__(186);
 
5619
        exports.i = __webpack_require__(187);
 
5620
        exports['Infinity'] = __webpack_require__(188);
 
5621
        exports.LN2 = __webpack_require__(189);
 
5622
        exports.LN10 = __webpack_require__(190);
 
5623
        exports.LOG2E = __webpack_require__(191);
 
5624
        exports.LOG10E = __webpack_require__(192);
 
5625
        exports.NaN = __webpack_require__(193);
 
5626
        exports['null'] = __webpack_require__(194);
 
5627
        exports.pi = __webpack_require__(195);
 
5628
        exports.PI = __webpack_require__(195);
 
5629
        exports.phi = __webpack_require__(196);
 
5630
        exports.SQRT1_2 = __webpack_require__(197);
 
5631
        exports.SQRT2 = __webpack_require__(198);
 
5632
        exports.tau = __webpack_require__(199);
 
5633
        exports['true'] = __webpack_require__(200);
 
5634
        exports.version = __webpack_require__(201);
5334
5635
 
5335
5636
        // functions - arithmetic
5336
 
        exports.abs = __webpack_require__(197);
5337
 
        exports.add = __webpack_require__(198);
5338
 
        exports.ceil = __webpack_require__(199);
5339
 
        exports.cube = __webpack_require__(200);
5340
 
        exports.divide = __webpack_require__(201);
5341
 
        exports.dotDivide = __webpack_require__(202);
5342
 
        exports.dotMultiply = __webpack_require__(203);
5343
 
        exports.dotPow = __webpack_require__(204);
5344
 
        exports.exp = __webpack_require__(205);
5345
 
        exports.fix = __webpack_require__(206);
5346
 
        exports.floor = __webpack_require__(207);
5347
 
        exports.gcd = __webpack_require__(208);
5348
 
        exports.lcm = __webpack_require__(209);
5349
 
        exports.log = __webpack_require__(210);
5350
 
        exports.log10 = __webpack_require__(211);
5351
 
        exports.mod = __webpack_require__(212);
5352
 
        exports.multiply = __webpack_require__(213);
5353
 
        exports.norm = __webpack_require__(214);
5354
 
        exports.nthRoot = __webpack_require__(215);
5355
 
        exports.pow = __webpack_require__(216);
5356
 
        exports.round = __webpack_require__(217);
5357
 
        exports.sign = __webpack_require__(218);
5358
 
        exports.sqrt = __webpack_require__(219);
5359
 
        exports.square = __webpack_require__(220);
5360
 
        exports.subtract = __webpack_require__(221);
5361
 
        exports.unaryMinus = __webpack_require__(222);
5362
 
        exports.unaryPlus = __webpack_require__(223);
5363
 
        exports.xgcd = __webpack_require__(224);
 
5637
        exports.abs = __webpack_require__(206);
 
5638
        exports.add = __webpack_require__(207);
 
5639
        exports.ceil = __webpack_require__(208);
 
5640
        exports.cube = __webpack_require__(209);
 
5641
        exports.divide = __webpack_require__(210);
 
5642
        exports.dotDivide = __webpack_require__(211);
 
5643
        exports.dotMultiply = __webpack_require__(212);
 
5644
        exports.dotPow = __webpack_require__(213);
 
5645
        exports.exp = __webpack_require__(214);
 
5646
        exports.fix = __webpack_require__(215);
 
5647
        exports.floor = __webpack_require__(216);
 
5648
        exports.gcd = __webpack_require__(217);
 
5649
        exports.lcm = __webpack_require__(218);
 
5650
        exports.log = __webpack_require__(219);
 
5651
        exports.log10 = __webpack_require__(220);
 
5652
        exports.mod = __webpack_require__(221);
 
5653
        exports.multiply = __webpack_require__(222);
 
5654
        exports.norm = __webpack_require__(223);
 
5655
        exports.nthRoot = __webpack_require__(224);
 
5656
        exports.pow = __webpack_require__(225);
 
5657
        exports.round = __webpack_require__(226);
 
5658
        exports.sign = __webpack_require__(227);
 
5659
        exports.sqrt = __webpack_require__(228);
 
5660
        exports.square = __webpack_require__(229);
 
5661
        exports.subtract = __webpack_require__(230);
 
5662
        exports.unaryMinus = __webpack_require__(231);
 
5663
        exports.unaryPlus = __webpack_require__(232);
 
5664
        exports.xgcd = __webpack_require__(233);
5364
5665
 
5365
5666
        // functions - bitwise
5366
 
        exports.bitAnd = __webpack_require__(225);
5367
 
        exports.bitNot = __webpack_require__(226);
5368
 
        exports.bitOr = __webpack_require__(227);
5369
 
        exports.bitXor = __webpack_require__(228);
5370
 
        exports.leftShift = __webpack_require__(229);
5371
 
        exports.rightArithShift = __webpack_require__(230);
5372
 
        exports.rightLogShift = __webpack_require__(231);
 
5667
        exports.bitAnd = __webpack_require__(234);
 
5668
        exports.bitNot = __webpack_require__(235);
 
5669
        exports.bitOr = __webpack_require__(236);
 
5670
        exports.bitXor = __webpack_require__(237);
 
5671
        exports.leftShift = __webpack_require__(238);
 
5672
        exports.rightArithShift = __webpack_require__(239);
 
5673
        exports.rightLogShift = __webpack_require__(240);
5373
5674
 
5374
5675
        // functions - complex
5375
 
        exports.arg = __webpack_require__(232);
5376
 
        exports.conj = __webpack_require__(233);
5377
 
        exports.re = __webpack_require__(234);
5378
 
        exports.im = __webpack_require__(235);
 
5676
        exports.arg = __webpack_require__(241);
 
5677
        exports.conj = __webpack_require__(242);
 
5678
        exports.re = __webpack_require__(243);
 
5679
        exports.im = __webpack_require__(244);
5379
5680
 
5380
5681
        // functions - construction
5381
 
        exports.bignumber = __webpack_require__(236);
5382
 
        exports['boolean'] = __webpack_require__(237);
5383
 
        exports.complex = __webpack_require__(238);
5384
 
        exports.index = __webpack_require__(239);
5385
 
        exports.matrix = __webpack_require__(240);
5386
 
        exports.number = __webpack_require__(241);
5387
 
        exports.string = __webpack_require__(242);
5388
 
        exports.unit = __webpack_require__(243);
 
5682
        exports.bignumber = __webpack_require__(245);
 
5683
        exports['boolean'] = __webpack_require__(246);
 
5684
        exports.complex = __webpack_require__(247);
 
5685
        exports.index = __webpack_require__(248);
 
5686
        exports.matrix = __webpack_require__(249);
 
5687
        exports.number = __webpack_require__(250);
 
5688
        exports.string = __webpack_require__(251);
 
5689
        exports.unit = __webpack_require__(252);
5389
5690
 
5390
5691
        // functions - expression
5391
 
        exports['eval'] =  __webpack_require__(244);
5392
 
        exports.help =  __webpack_require__(245);
 
5692
        exports['eval'] =  __webpack_require__(253);
 
5693
        exports.help =  __webpack_require__(254);
5393
5694
 
5394
5695
        // functions - logical
5395
 
        exports['and'] = __webpack_require__(246);
5396
 
        exports['not'] = __webpack_require__(247);
5397
 
        exports['or'] = __webpack_require__(248);
5398
 
        exports['xor'] = __webpack_require__(249);
 
5696
        exports['and'] = __webpack_require__(255);
 
5697
        exports['not'] = __webpack_require__(256);
 
5698
        exports['or'] = __webpack_require__(257);
 
5699
        exports['xor'] = __webpack_require__(258);
5399
5700
 
5400
5701
        // functions - matrix
5401
 
        exports['concat'] = __webpack_require__(250);
5402
 
        exports.cross = __webpack_require__(251);
5403
 
        exports.det = __webpack_require__(252);
5404
 
        exports.diag = __webpack_require__(253);
5405
 
        exports.dot = __webpack_require__(254);
5406
 
        exports.eye = __webpack_require__(255);
5407
 
        exports.flatten = __webpack_require__(256);
5408
 
        exports.inv = __webpack_require__(257);
5409
 
        exports.ones = __webpack_require__(258);
5410
 
        exports.range = __webpack_require__(259);
5411
 
        exports.resize = __webpack_require__(260);
5412
 
        exports.size = __webpack_require__(261);
5413
 
        exports.squeeze = __webpack_require__(262);
5414
 
        exports.subset = __webpack_require__(263);
5415
 
        exports.transpose = __webpack_require__(264);
5416
 
        exports.zeros = __webpack_require__(265);
 
5702
        exports['concat'] = __webpack_require__(259);
 
5703
        exports.cross = __webpack_require__(260);
 
5704
        exports.det = __webpack_require__(261);
 
5705
        exports.diag = __webpack_require__(262);
 
5706
        exports.dot = __webpack_require__(263);
 
5707
        exports.eye = __webpack_require__(264);
 
5708
        exports.flatten = __webpack_require__(265);
 
5709
        exports.inv = __webpack_require__(266);
 
5710
        exports.ones = __webpack_require__(267);
 
5711
        exports.range = __webpack_require__(268);
 
5712
        exports.resize = __webpack_require__(269);
 
5713
        exports.size = __webpack_require__(270);
 
5714
        exports.squeeze = __webpack_require__(271);
 
5715
        exports.subset = __webpack_require__(272);
 
5716
        exports.trace = __webpack_require__(273);
 
5717
        exports.transpose = __webpack_require__(274);
 
5718
        exports.zeros = __webpack_require__(275);
5417
5719
 
5418
5720
        // functions - probability
5419
 
        exports.combinations = __webpack_require__(266);
 
5721
        exports.combinations = __webpack_require__(276);
5420
5722
        //exports.distribution = require('./function/probability/distribution');
5421
 
        exports.factorial = __webpack_require__(267);
5422
 
        exports.gamma = __webpack_require__(268);
5423
 
        exports.permutations = __webpack_require__(269);
5424
 
        exports.pickRandom = __webpack_require__(270);
5425
 
        exports.random = __webpack_require__(271);
5426
 
        exports.randomInt = __webpack_require__(272);
 
5723
        exports.factorial = __webpack_require__(277);
 
5724
        exports.gamma = __webpack_require__(278);
 
5725
        exports.permutations = __webpack_require__(279);
 
5726
        exports.pickRandom = __webpack_require__(280);
 
5727
        exports.random = __webpack_require__(281);
 
5728
        exports.randomInt = __webpack_require__(282);
5427
5729
 
5428
5730
        // functions - relational
5429
 
        exports.compare = __webpack_require__(273);
5430
 
        exports.deepEqual = __webpack_require__(274);
5431
 
        exports['equal'] = __webpack_require__(275);
5432
 
        exports.larger = __webpack_require__(276);
5433
 
        exports.largerEq = __webpack_require__(277);
5434
 
        exports.smaller = __webpack_require__(278);
5435
 
        exports.smallerEq = __webpack_require__(279);
5436
 
        exports.unequal = __webpack_require__(280);
 
5731
        exports.compare = __webpack_require__(283);
 
5732
        exports.deepEqual = __webpack_require__(284);
 
5733
        exports['equal'] = __webpack_require__(285);
 
5734
        exports.larger = __webpack_require__(286);
 
5735
        exports.largerEq = __webpack_require__(287);
 
5736
        exports.smaller = __webpack_require__(288);
 
5737
        exports.smallerEq = __webpack_require__(289);
 
5738
        exports.unequal = __webpack_require__(290);
5437
5739
 
5438
5740
        // functions - statistics
5439
 
        exports.max = __webpack_require__(281);
5440
 
        exports.mean = __webpack_require__(282);
5441
 
        exports.median = __webpack_require__(283);
5442
 
        exports.min = __webpack_require__(284);
5443
 
        exports.prod = __webpack_require__(285);
5444
 
        exports.std = __webpack_require__(286);
5445
 
        exports.sum = __webpack_require__(287);
5446
 
        exports['var'] = __webpack_require__(288);
 
5741
        exports.max = __webpack_require__(291);
 
5742
        exports.mean = __webpack_require__(292);
 
5743
        exports.median = __webpack_require__(293);
 
5744
        exports.min = __webpack_require__(294);
 
5745
        exports.prod = __webpack_require__(295);
 
5746
        exports.std = __webpack_require__(296);
 
5747
        exports.sum = __webpack_require__(297);
 
5748
        exports['var'] = __webpack_require__(298);
5447
5749
 
5448
5750
        // functions - trigonometry
5449
 
        exports.acos = __webpack_require__(289);
5450
 
        exports.asin = __webpack_require__(290);
5451
 
        exports.atan = __webpack_require__(291);
5452
 
        exports.atan2 = __webpack_require__(292);
5453
 
        exports.cos = __webpack_require__(293);
5454
 
        exports.cosh = __webpack_require__(294);
5455
 
        exports.cot = __webpack_require__(295);
5456
 
        exports.coth = __webpack_require__(296);
5457
 
        exports.csc = __webpack_require__(297);
5458
 
        exports.csch = __webpack_require__(298);
5459
 
        exports.sec = __webpack_require__(299);
5460
 
        exports.sech = __webpack_require__(300);
5461
 
        exports.sin = __webpack_require__(301);
5462
 
        exports.sinh = __webpack_require__(302);
5463
 
        exports.tan = __webpack_require__(303);
5464
 
        exports.tanh = __webpack_require__(304);
 
5751
        exports.acos = __webpack_require__(299);
 
5752
        exports.acosh = __webpack_require__(300);
 
5753
        exports.acot = __webpack_require__(301);
 
5754
        exports.acoth = __webpack_require__(302);
 
5755
        exports.acsc = __webpack_require__(303);
 
5756
        exports.acsch = __webpack_require__(304);
 
5757
        exports.asec = __webpack_require__(305);
 
5758
        exports.asech = __webpack_require__(306);
 
5759
        exports.asin = __webpack_require__(307);
 
5760
        exports.asinh = __webpack_require__(308);
 
5761
        exports.atan = __webpack_require__(309);
 
5762
        exports.atanh = __webpack_require__(310);
 
5763
        exports.atan2 = __webpack_require__(311);
 
5764
        exports.cos = __webpack_require__(312);
 
5765
        exports.cosh = __webpack_require__(313);
 
5766
        exports.cot = __webpack_require__(314);
 
5767
        exports.coth = __webpack_require__(315);
 
5768
        exports.csc = __webpack_require__(316);
 
5769
        exports.csch = __webpack_require__(317);
 
5770
        exports.sec = __webpack_require__(318);
 
5771
        exports.sech = __webpack_require__(319);
 
5772
        exports.sin = __webpack_require__(320);
 
5773
        exports.sinh = __webpack_require__(321);
 
5774
        exports.tan = __webpack_require__(322);
 
5775
        exports.tanh = __webpack_require__(323);
5465
5776
 
5466
5777
        // functions - units
5467
 
        exports.to = __webpack_require__(305);
 
5778
        exports.to = __webpack_require__(324);
5468
5779
 
5469
5780
        // functions - utils
5470
 
        exports.clone =  __webpack_require__(306);
5471
 
        exports.map =  __webpack_require__(307);
5472
 
        exports.filter =  __webpack_require__(308);
5473
 
        exports.forEach =  __webpack_require__(309);
5474
 
        exports.format =  __webpack_require__(310);
 
5781
        exports.clone =  __webpack_require__(325);
 
5782
        exports.map =  __webpack_require__(326);
 
5783
        exports.filter =  __webpack_require__(327);
 
5784
        exports.forEach =  __webpack_require__(328);
 
5785
        exports.format =  __webpack_require__(329);
5475
5786
        // exports.print =  require('./function/utils/print'); // TODO: add documentation for print as soon as the parser supports objects.
5476
 
        exports['import'] =  __webpack_require__(311);
5477
 
        exports.sort =  __webpack_require__(312);
5478
 
        exports['typeof'] =  __webpack_require__(313);
5479
 
 
5480
 
 
5481
 
/***/ },
5482
 
/* 18 */
5483
 
/***/ function(module, exports, __webpack_require__) {
5484
 
 
5485
 
        'use strict';
5486
 
 
5487
 
        var BigNumber = __webpack_require__(159);
5488
 
        var errorTransform = __webpack_require__(174).transform;
5489
 
        var isNumber = __webpack_require__(4).isNumber;
5490
 
        var argsToArray = __webpack_require__(153).argsToArray;
 
5787
        exports['import'] =  __webpack_require__(330);
 
5788
        exports.sort =  __webpack_require__(331);
 
5789
        exports['typeof'] =  __webpack_require__(332);
 
5790
 
 
5791
 
 
5792
/***/ },
 
5793
/* 19 */
 
5794
/***/ function(module, exports, __webpack_require__) {
 
5795
 
 
5796
        'use strict';
 
5797
 
 
5798
        var BigNumber = __webpack_require__(5);
 
5799
        var Complex   = __webpack_require__(7);
 
5800
        var Help      = __webpack_require__(12);
 
5801
        var Index     = __webpack_require__(9);
 
5802
        var Matrix    = __webpack_require__(10);
 
5803
        var Range     = __webpack_require__(8);
 
5804
        var ResultSet = __webpack_require__(13);
 
5805
        var Unit      = __webpack_require__(11);
 
5806
 
 
5807
        /**
 
5808
         * Instantiate mathjs data types from their JSON representation
 
5809
         * @param {string} key
 
5810
         * @param {*} value
 
5811
         * @returns {*} Returns the revived object
 
5812
         */
 
5813
        function reviver(key, value) {
 
5814
          var type = value && value.mathjs;
 
5815
 
 
5816
          switch (type) {
 
5817
            case 'BigNumber': return BigNumber.fromJSON(value);
 
5818
            case 'Complex':   return Complex.fromJSON(value);
 
5819
            case 'Help':      return Help.fromJSON(value);
 
5820
            case 'Index':     return Index.fromJSON(value);
 
5821
            case 'Matrix':    return Matrix.fromJSON(value);
 
5822
            case 'Range':     return Range.fromJSON(value);
 
5823
            case 'ResultSet': return ResultSet.fromJSON(value);
 
5824
            case 'Unit':      return Unit.fromJSON(value);
 
5825
          }
 
5826
 
 
5827
          return value;
 
5828
        }
 
5829
 
 
5830
        module.exports = reviver;
 
5831
 
 
5832
 
 
5833
/***/ },
 
5834
/* 20 */
 
5835
/***/ function(module, exports, __webpack_require__) {
 
5836
 
 
5837
        'use strict';
 
5838
 
 
5839
        var BigNumber = __webpack_require__(5);
 
5840
        var errorTransform = __webpack_require__(203).transform;
 
5841
        var isNumber = __webpack_require__(3).isNumber;
 
5842
        var argsToArray = __webpack_require__(165).argsToArray;
5491
5843
 
5492
5844
        /**
5493
5845
         * Attach a transform function to math.range
5498
5850
         * @param {Object} math
5499
5851
         */
5500
5852
        module.exports = function (math) {
5501
 
          math.concat.transform = function () {
 
5853
          var transform = function () {
5502
5854
            // copy arguments into an array
5503
5855
            var args = argsToArray(arguments);
5504
5856
 
5519
5871
              throw errorTransform(err);
5520
5872
            }
5521
5873
          };
 
5874
 
 
5875
          math.concat.transform = transform;
 
5876
 
 
5877
          return transform;
5522
5878
        };
5523
5879
 
5524
5880
 
5525
5881
/***/ },
5526
 
/* 19 */
 
5882
/* 21 */
5527
5883
/***/ function(module, exports, __webpack_require__) {
5528
5884
 
5529
5885
        'use strict';
5530
5886
 
5531
 
        var SymbolNode = __webpack_require__(171);
5532
 
        var isBoolean = __webpack_require__(175).isBoolean;
5533
 
        var argsToArray = __webpack_require__(153).argsToArray;
5534
 
        var ArgumentsError = __webpack_require__(155);
 
5887
        var SymbolNode = __webpack_require__(183);
 
5888
        var isBoolean = __webpack_require__(204).isBoolean;
 
5889
        var argsToArray = __webpack_require__(165).argsToArray;
 
5890
        var ArgumentsError = __webpack_require__(167);
5535
5891
 
5536
5892
        /**
5537
5893
         * Attach a transform function to math.filter
5544
5900
        module.exports = function (math) {
5545
5901
          var _filter = math.filter;
5546
5902
 
5547
 
          _filter.transform = function (args, math, scope) {
 
5903
          var transform = function (args, math, scope) {
5548
5904
            if (args.length !== 2) {
5549
5905
              throw new ArgumentsError('filter', arguments.length, 2);
5550
5906
            }
5585
5941
            return _filter(x, test);
5586
5942
          };
5587
5943
 
5588
 
          math.filter.transform.rawArgs = true;
 
5944
          transform.rawArgs = true;
 
5945
          math.filter.transform = transform;
 
5946
 
 
5947
          return transform;
5589
5948
        };
5590
5949
 
5591
5950
 
5592
5951
/***/ },
5593
 
/* 20 */
 
5952
/* 22 */
5594
5953
/***/ function(module, exports, __webpack_require__) {
5595
5954
 
5596
5955
        'use strict';
5597
5956
 
5598
 
        var Matrix = __webpack_require__(9);
 
5957
        var Matrix = __webpack_require__(10);
5599
5958
 
5600
5959
        /**
5601
5960
         * Attach a transform function to math.forEach
5605
5964
         * @param {Object} math
5606
5965
         */
5607
5966
        module.exports = function (math) {
5608
 
          math.forEach.transform = function (x, callback) {
 
5967
          var transform = function (x, callback) {
5609
5968
            if (arguments.length != 2) {
5610
5969
              throw new math.error.ArgumentsError('forEach', arguments.length, 2);
5611
5970
            }
5634
5993
            recurse(array, []);
5635
5994
          }
5636
5995
 
 
5996
          math.forEach.transform = transform;
 
5997
 
 
5998
          return transform;
5637
5999
        };
5638
6000
 
5639
6001
 
5640
6002
/***/ },
5641
 
/* 21 */
 
6003
/* 23 */
5642
6004
/***/ function(module, exports, __webpack_require__) {
5643
6005
 
5644
6006
        'use strict';
5645
6007
 
5646
 
        var BigNumber = __webpack_require__(159);
5647
 
        var Range = __webpack_require__(7);
5648
 
        var Index = __webpack_require__(8);
5649
 
        var Matrix = __webpack_require__(9);
5650
 
        var isNumber = __webpack_require__(4).isNumber;
 
6008
        var BigNumber = __webpack_require__(5);
 
6009
        var Range = __webpack_require__(8);
 
6010
        var Index = __webpack_require__(9);
 
6011
        var Matrix = __webpack_require__(10);
 
6012
        var isNumber = __webpack_require__(3).isNumber;
5651
6013
        var isArray = Array.isArray;
5652
6014
 
5653
6015
        /**
5658
6020
         * @param {Object} math
5659
6021
         */
5660
6022
        module.exports = function (math) {
5661
 
          math.index.transform = function () {
 
6023
          var transform = function () {
5662
6024
            var args = [];
5663
6025
            for (var i = 0, ii = arguments.length; i < ii; i++) {
5664
6026
              var arg = arguments[i];
5685
6047
            Index.apply(res, args);
5686
6048
            return res;
5687
6049
          };
 
6050
 
 
6051
          math.index.transform = transform;
 
6052
 
 
6053
          return transform;
5688
6054
        };
5689
6055
 
5690
6056
 
5691
6057
/***/ },
5692
 
/* 22 */
 
6058
/* 24 */
5693
6059
/***/ function(module, exports, __webpack_require__) {
5694
6060
 
5695
6061
        'use strict';
5696
6062
 
5697
 
        var Matrix = __webpack_require__(9);
5698
 
        var BigNumber = __webpack_require__(159);
5699
 
        var Range = __webpack_require__(7);
5700
 
        var Index = __webpack_require__(8);
5701
 
        var isNumber = __webpack_require__(4).isNumber;
 
6063
        var Matrix = __webpack_require__(10);
 
6064
        var BigNumber = __webpack_require__(5);
 
6065
        var Range = __webpack_require__(8);
 
6066
        var Index = __webpack_require__(9);
 
6067
        var isNumber = __webpack_require__(3).isNumber;
5702
6068
        var isArray = Array.isArray;
5703
6069
 
5704
6070
        /**
5709
6075
         * @param {Object} math
5710
6076
         */
5711
6077
        module.exports = function (math) {
5712
 
          math.map.transform = function (x, callback) {
 
6078
          var transform = function (x, callback) {
5713
6079
            if (arguments.length != 2) {
5714
6080
              throw new math.error.ArgumentsError('map', arguments.length, 2);
5715
6081
            }
5738
6104
 
5739
6105
            return recurse(arrayIn, []);
5740
6106
          }
 
6107
 
 
6108
          math.map.transform = transform;
 
6109
 
 
6110
          return transform;
5741
6111
        };
5742
6112
 
5743
6113
 
5744
6114
/***/ },
5745
 
/* 23 */
 
6115
/* 25 */
5746
6116
/***/ function(module, exports, __webpack_require__) {
5747
6117
 
5748
6118
        'use strict';
5749
6119
 
5750
 
        var BigNumber = __webpack_require__(159);
5751
 
        var errorTransform = __webpack_require__(174).transform;
5752
 
        var isNumber = __webpack_require__(4).isNumber;
5753
 
        var isCollection = __webpack_require__(13).isCollection;
5754
 
        var argsToArray = __webpack_require__(153).argsToArray;
 
6120
        var BigNumber = __webpack_require__(5);
 
6121
        var errorTransform = __webpack_require__(203).transform;
 
6122
        var isNumber = __webpack_require__(3).isNumber;
 
6123
        var isCollection = __webpack_require__(14).isCollection;
 
6124
        var argsToArray = __webpack_require__(165).argsToArray;
5755
6125
 
5756
6126
        /**
5757
6127
         * Attach a transform function to math.max
5762
6132
         * @param {Object} math
5763
6133
         */
5764
6134
        module.exports = function (math) {
5765
 
          math.max.transform = function () {
 
6135
          var transform = function () {
5766
6136
            var args = argsToArray(arguments);
5767
6137
 
5768
6138
            // change last argument dim from one-based to zero-based
5783
6153
              throw errorTransform(err);
5784
6154
            }
5785
6155
          };
 
6156
 
 
6157
          math.max.transform = transform;
 
6158
 
 
6159
          return transform;
5786
6160
        };
5787
6161
 
5788
6162
 
5789
6163
/***/ },
5790
 
/* 24 */
 
6164
/* 26 */
5791
6165
/***/ function(module, exports, __webpack_require__) {
5792
6166
 
5793
6167
        'use strict';
5794
6168
 
5795
 
        var BigNumber = __webpack_require__(159);
5796
 
        var errorTransform = __webpack_require__(174).transform;
5797
 
        var isNumber = __webpack_require__(4).isNumber;
5798
 
        var isCollection = __webpack_require__(13).isCollection;
5799
 
        var argsToArray = __webpack_require__(153).argsToArray;
 
6169
        var BigNumber = __webpack_require__(5);
 
6170
        var errorTransform = __webpack_require__(203).transform;
 
6171
        var isNumber = __webpack_require__(3).isNumber;
 
6172
        var isCollection = __webpack_require__(14).isCollection;
 
6173
        var argsToArray = __webpack_require__(165).argsToArray;
5800
6174
 
5801
6175
        /**
5802
6176
         * Attach a transform function to math.mean
5807
6181
         * @param {Object} math
5808
6182
         */
5809
6183
        module.exports = function (math) {
5810
 
          math.mean.transform = function () {
 
6184
          var transform = function () {
5811
6185
            var args = argsToArray(arguments);
5812
6186
 
5813
6187
            // change last argument dim from one-based to zero-based
5828
6202
              throw errorTransform(err);
5829
6203
            }
5830
6204
          };
 
6205
 
 
6206
          math.mean.transform = transform;
 
6207
 
 
6208
          return transform;
5831
6209
        };
5832
6210
 
5833
6211
 
5834
6212
/***/ },
5835
 
/* 25 */
 
6213
/* 27 */
5836
6214
/***/ function(module, exports, __webpack_require__) {
5837
6215
 
5838
6216
        'use strict';
5839
6217
 
5840
 
        var BigNumber = __webpack_require__(159);
5841
 
        var errorTransform = __webpack_require__(174).transform;
5842
 
        var isNumber = __webpack_require__(4).isNumber;
5843
 
        var isCollection = __webpack_require__(13).isCollection;
5844
 
        var argsToArray = __webpack_require__(153).argsToArray;
 
6218
        var BigNumber = __webpack_require__(5);
 
6219
        var errorTransform = __webpack_require__(203).transform;
 
6220
        var isNumber = __webpack_require__(3).isNumber;
 
6221
        var isCollection = __webpack_require__(14).isCollection;
 
6222
        var argsToArray = __webpack_require__(165).argsToArray;
5845
6223
 
5846
6224
        /**
5847
6225
         * Attach a transform function to math.min
5852
6230
         * @param {Object} math
5853
6231
         */
5854
6232
        module.exports = function (math) {
5855
 
          math.min.transform = function () {
 
6233
          var transform = function () {
5856
6234
            var args = argsToArray(arguments);
5857
6235
 
5858
6236
            // change last argument dim from one-based to zero-based
5873
6251
              throw errorTransform(err);
5874
6252
            }
5875
6253
          };
 
6254
 
 
6255
          math.min.transform = transform;
 
6256
 
 
6257
          return transform;
5876
6258
        };
5877
6259
 
5878
6260
 
5879
6261
/***/ },
5880
 
/* 26 */
 
6262
/* 28 */
5881
6263
/***/ function(module, exports, __webpack_require__) {
5882
6264
 
5883
6265
        'use strict';
5884
6266
 
5885
 
        var isBoolean = __webpack_require__(175).isBoolean;
5886
 
        var argsToArray = __webpack_require__(153).argsToArray;
 
6267
        var isBoolean = __webpack_require__(204).isBoolean;
 
6268
        var argsToArray = __webpack_require__(165).argsToArray;
5887
6269
 
5888
6270
        /**
5889
6271
         * Attach a transform function to math.range
5893
6275
         * @param {Object} math
5894
6276
         */
5895
6277
        module.exports = function (math) {
5896
 
          math.range.transform = function () {
 
6278
          var transform = function () {
5897
6279
            var args = argsToArray(arguments);
5898
6280
 
5899
6281
            var lastIndex = args.length - 1;
5904
6286
 
5905
6287
            return math.range.apply(math, args);
5906
6288
          };
 
6289
 
 
6290
          math.range.transform = transform;
 
6291
 
 
6292
          return transform;
5907
6293
        };
5908
6294
 
5909
6295
 
5910
6296
/***/ },
5911
 
/* 27 */
 
6297
/* 29 */
5912
6298
/***/ function(module, exports, __webpack_require__) {
5913
6299
 
5914
6300
        'use strict';
5915
6301
 
5916
 
        var errorTransform = __webpack_require__(174).transform;
5917
 
        var isBoolean = __webpack_require__(175).isBoolean;
5918
 
        var argsToArray = __webpack_require__(153).argsToArray;
 
6302
        var errorTransform = __webpack_require__(203).transform;
 
6303
        var isBoolean = __webpack_require__(204).isBoolean;
 
6304
        var argsToArray = __webpack_require__(165).argsToArray;
5919
6305
 
5920
6306
        /**
5921
6307
         * Attach a transform function to math.subset
5925
6311
         * @param {Object} math
5926
6312
         */
5927
6313
        module.exports = function (math) {
5928
 
          math.subset.transform = function () {
 
6314
          var transform = function () {
5929
6315
            try {
5930
6316
              return math.subset.apply(math, argsToArray(arguments));
5931
6317
            }
5933
6319
              throw errorTransform(err);
5934
6320
            }
5935
6321
          };
 
6322
 
 
6323
          math.subset.transform = transform;
 
6324
 
 
6325
          return transform;
5936
6326
        };
5937
6327
 
5938
6328
 
5939
6329
/***/ },
5940
 
/* 28 */
 
6330
/* 30 */
5941
6331
/***/ function(module, exports, __webpack_require__) {
5942
6332
 
5943
6333
        'use strict';
5944
6334
 
5945
6335
        module.exports = function (math) {
5946
 
          var string = __webpack_require__(176);
 
6336
          var string = __webpack_require__(205);
5947
6337
 
5948
6338
          /**
5949
6339
           * @constructor Chain
6038
6428
 
6039
6429
 
6040
6430
/***/ },
6041
 
/* 29 */
 
6431
/* 31 */
6042
6432
/***/ function(module, exports, __webpack_require__) {
6043
6433
 
6044
6434
        'use strict';
6045
6435
 
6046
6436
        module.exports = function (math, config) {
6047
 
          var util = __webpack_require__(160),
6048
 
              _parse = __webpack_require__(14),
 
6437
          var util = __webpack_require__(171),
 
6438
              _parse = __webpack_require__(16),
6049
6439
 
6050
 
              collection = __webpack_require__(13),
 
6440
              collection = __webpack_require__(14),
6051
6441
 
6052
6442
              isString = util.string.isString,
6053
6443
              isCollection = collection.isCollection;
6110
6500
 
6111
6501
 
6112
6502
/***/ },
6113
 
/* 30 */
 
6503
/* 32 */
6114
6504
/***/ function(module, exports, __webpack_require__) {
6115
6505
 
6116
6506
        'use strict';
6117
6507
 
6118
6508
        module.exports = function (math) {
6119
 
          var util = __webpack_require__(160),
6120
 
              _parse = __webpack_require__(14),
 
6509
          var util = __webpack_require__(171),
 
6510
              _parse = __webpack_require__(16),
6121
6511
 
6122
 
              collection = __webpack_require__(13),
 
6512
              collection = __webpack_require__(14),
6123
6513
 
6124
6514
              isString = util.string.isString,
6125
6515
              isCollection = collection.isCollection;
6183
6573
 
6184
6574
 
6185
6575
/***/ },
6186
 
/* 31 */
 
6576
/* 33 */
6187
6577
/***/ function(module, exports, __webpack_require__) {
6188
6578
 
6189
6579
        'use strict';
6190
6580
 
6191
6581
        module.exports = function (math) {
6192
 
          var Help = __webpack_require__(11);
 
6582
          var Help = __webpack_require__(12);
6193
6583
 
6194
6584
          /**
6195
6585
           * Retrieve help on a function or data type.
6250
6640
            } else if (!doc) {
6251
6641
              throw new Error('No documentation found on "' + text + '"');
6252
6642
            }
6253
 
            return new Help(math, doc);
 
6643
            return new Help(doc);
6254
6644
          };
6255
6645
        };
6256
6646
 
6257
6647
 
6258
6648
/***/ },
6259
 
/* 32 */
 
6649
/* 34 */
6260
6650
/***/ function(module, exports, __webpack_require__) {
6261
6651
 
6262
6652
        'use strict';
6263
6653
 
6264
6654
        module.exports = function (math, config) {
6265
 
          var _parse = __webpack_require__(14);
 
6655
          var _parse = __webpack_require__(16);
6266
6656
 
6267
6657
          /**
6268
6658
           * Parse an expression. Returns a node tree, which can be evaluated by
6304
6694
 
6305
6695
 
6306
6696
/***/ },
6307
 
/* 33 */
 
6697
/* 35 */
6308
6698
/***/ function(module, exports, __webpack_require__) {
6309
6699
 
6310
6700
        'use strict';
6311
6701
 
6312
6702
        module.exports = function (math) {
6313
 
          var util = __webpack_require__(160),
 
6703
          var util = __webpack_require__(171),
6314
6704
 
6315
6705
              BigNumber = math.type.BigNumber,
6316
 
              Complex = __webpack_require__(6),
6317
 
              Matrix = __webpack_require__(9),
6318
 
              collection = __webpack_require__(13),
 
6706
              Complex = __webpack_require__(7),
 
6707
              Matrix = __webpack_require__(10),
 
6708
              collection = __webpack_require__(14),
6319
6709
 
6320
6710
              isNumber = util.number.isNumber,
6321
6711
              isBoolean = util['boolean'].isBoolean,
6356
6746
            }
6357
6747
 
6358
6748
            if (isComplex(x)) {
6359
 
              return Math.sqrt(x.re * x.re + x.im * x.im);
 
6749
              // do not compute sqrt(re * re + im * im) since it will overflow with big numbers!
 
6750
              var re = Math.abs(x.re);
 
6751
              var im = Math.abs(x.im);
 
6752
              if (re >= im) {
 
6753
                var x = im / re;
 
6754
                return re * Math.sqrt(1 + x * x);
 
6755
              }
 
6756
              var y = re / im;
 
6757
              return im * Math.sqrt(1 + y * y);
6360
6758
            }
6361
6759
 
6362
6760
            if (x instanceof BigNumber) {
6377
6775
 
6378
6776
 
6379
6777
/***/ },
6380
 
/* 34 */
 
6778
/* 36 */
6381
6779
/***/ function(module, exports, __webpack_require__) {
6382
6780
 
6383
6781
        'use strict';
6384
6782
 
6385
6783
        module.exports = function (math) {
6386
 
          var util = __webpack_require__(160),
 
6784
          var util = __webpack_require__(171),
6387
6785
 
6388
6786
              BigNumber = math.type.BigNumber,
6389
 
              Complex = __webpack_require__(6),
6390
 
              Matrix = __webpack_require__(9),
6391
 
              Unit = __webpack_require__(10),
6392
 
              collection = __webpack_require__(13),
 
6787
              Complex = __webpack_require__(7),
 
6788
              Matrix = __webpack_require__(10),
 
6789
              Unit = __webpack_require__(11),
 
6790
              collection = __webpack_require__(14),
6393
6791
 
6394
6792
              isBoolean = util['boolean'].isBoolean,
6395
6793
              isNumber = util.number.isNumber,
6539
6937
 
6540
6938
 
6541
6939
/***/ },
6542
 
/* 35 */
 
6940
/* 37 */
6543
6941
/***/ function(module, exports, __webpack_require__) {
6544
6942
 
6545
6943
        'use strict';
6546
6944
 
6547
6945
        module.exports = function (math) {
6548
 
          var util = __webpack_require__(160),
 
6946
          var util = __webpack_require__(171),
6549
6947
 
6550
6948
              BigNumber = math.type.BigNumber,
6551
 
              Complex = __webpack_require__(6),
6552
 
              collection = __webpack_require__(13),
 
6949
              Complex = __webpack_require__(7),
 
6950
              collection = __webpack_require__(14),
6553
6951
 
6554
6952
              isNumber = util.number.isNumber,
6555
6953
              isBoolean = util['boolean'].isBoolean,
6618
7016
 
6619
7017
 
6620
7018
/***/ },
6621
 
/* 36 */
 
7019
/* 38 */
6622
7020
/***/ function(module, exports, __webpack_require__) {
6623
7021
 
6624
7022
        'use strict';
6625
7023
 
6626
7024
        module.exports = function (math) {
6627
 
          var util = __webpack_require__(160),
 
7025
          var util = __webpack_require__(171),
6628
7026
 
6629
7027
              BigNumber = math.type.BigNumber,
6630
 
              Complex = __webpack_require__(6),
6631
 
              collection = __webpack_require__(13),
 
7028
              Complex = __webpack_require__(7),
 
7029
              collection = __webpack_require__(14),
6632
7030
 
6633
7031
              isNumber = util.number.isNumber,
6634
7032
              isBoolean = util['boolean'].isBoolean,
6690
7088
 
6691
7089
 
6692
7090
/***/ },
6693
 
/* 37 */
 
7091
/* 39 */
6694
7092
/***/ function(module, exports, __webpack_require__) {
6695
7093
 
6696
7094
        'use strict';
6697
7095
 
6698
7096
        module.exports = function(math) {
6699
 
          var util = __webpack_require__(160);
 
7097
          var util = __webpack_require__(171);
6700
7098
 
6701
7099
          var BigNumber = math.type.BigNumber;
6702
 
          var Complex = __webpack_require__(6);
6703
 
          var Matrix = __webpack_require__(9);
6704
 
          var Unit = __webpack_require__(10);
 
7100
          var Complex = __webpack_require__(7);
 
7101
          var Matrix = __webpack_require__(10);
 
7102
          var Unit = __webpack_require__(11);
6705
7103
 
6706
7104
          var isNumber = util.number.isNumber;
6707
7105
          var isBoolean = util['boolean'].isBoolean;
6823
7221
 
6824
7222
 
6825
7223
/***/ },
6826
 
/* 38 */
 
7224
/* 40 */
6827
7225
/***/ function(module, exports, __webpack_require__) {
6828
7226
 
6829
7227
        'use strict';
6830
7228
 
6831
7229
        module.exports = function(math) {
6832
 
          var collection = __webpack_require__(13);
 
7230
          var collection = __webpack_require__(14);
6833
7231
          var isCollection = collection.isCollection;
6834
7232
 
6835
7233
          /**
6894
7292
 
6895
7293
 
6896
7294
/***/ },
6897
 
/* 39 */
 
7295
/* 41 */
6898
7296
/***/ function(module, exports, __webpack_require__) {
6899
7297
 
6900
7298
        'use strict';
6901
7299
 
6902
7300
        module.exports = function (math) {
6903
 
          var collection = __webpack_require__(13);
 
7301
          var collection = __webpack_require__(14);
6904
7302
 
6905
7303
          /**
6906
7304
           * Divide two matrices element wise. The function accepts both matrices and
6944
7342
 
6945
7343
 
6946
7344
/***/ },
6947
 
/* 40 */
 
7345
/* 42 */
6948
7346
/***/ function(module, exports, __webpack_require__) {
6949
7347
 
6950
7348
        'use strict';
6951
7349
 
6952
7350
        module.exports = function (math) {
6953
 
          var util = __webpack_require__(160),
6954
 
              collection = __webpack_require__(13);
 
7351
          var util = __webpack_require__(171),
 
7352
              collection = __webpack_require__(14);
6955
7353
 
6956
7354
          /**
6957
7355
           * Multiply two matrices element wise. The function accepts both matrices and
6995
7393
 
6996
7394
 
6997
7395
/***/ },
6998
 
/* 41 */
 
7396
/* 43 */
6999
7397
/***/ function(module, exports, __webpack_require__) {
7000
7398
 
7001
7399
        'use strict';
7002
7400
 
7003
7401
        module.exports = function (math) {
7004
 
          var util = __webpack_require__(160),
7005
 
              collection = __webpack_require__(13);
 
7402
          var util = __webpack_require__(171),
 
7403
              collection = __webpack_require__(14);
7006
7404
 
7007
7405
          /**
7008
7406
           * Calculates the power of x to y element wise.
7043
7441
 
7044
7442
 
7045
7443
/***/ },
7046
 
/* 42 */
 
7444
/* 44 */
7047
7445
/***/ function(module, exports, __webpack_require__) {
7048
7446
 
7049
7447
        'use strict';
7050
7448
 
7051
7449
        module.exports = function (math) {
7052
 
          var util = __webpack_require__(160),
 
7450
          var util = __webpack_require__(171),
7053
7451
 
7054
7452
              BigNumber = math.type.BigNumber,
7055
 
              Complex = __webpack_require__(6),
7056
 
              Matrix = __webpack_require__(9),
7057
 
              collection = __webpack_require__(13),
 
7453
              Complex = __webpack_require__(7),
 
7454
              Matrix = __webpack_require__(10),
 
7455
              collection = __webpack_require__(14),
7058
7456
 
7059
7457
              isNumber = util.number.isNumber,
7060
7458
              isBoolean = util['boolean'].isBoolean,
7124
7522
 
7125
7523
 
7126
7524
/***/ },
7127
 
/* 43 */
 
7525
/* 45 */
7128
7526
/***/ function(module, exports, __webpack_require__) {
7129
7527
 
7130
7528
        'use strict';
7131
7529
 
7132
7530
        module.exports = function (math) {
7133
 
          var util = __webpack_require__(160),
 
7531
          var util = __webpack_require__(171),
7134
7532
 
7135
7533
              BigNumber = math.type.BigNumber,
7136
 
              Complex = __webpack_require__(6),
7137
 
              collection = __webpack_require__(13),
 
7534
              Complex = __webpack_require__(7),
 
7535
              collection = __webpack_require__(14),
7138
7536
 
7139
7537
              isNumber = util.number.isNumber,
7140
7538
              isBoolean = util['boolean'].isBoolean,
7202
7600
 
7203
7601
 
7204
7602
/***/ },
7205
 
/* 44 */
 
7603
/* 46 */
7206
7604
/***/ function(module, exports, __webpack_require__) {
7207
7605
 
7208
7606
        'use strict';
7209
7607
 
7210
7608
        module.exports = function (math) {
7211
 
          var util = __webpack_require__(160),
 
7609
          var util = __webpack_require__(171),
7212
7610
 
7213
7611
              BigNumber = math.type.BigNumber,
7214
 
              Complex = __webpack_require__(6),
7215
 
              collection = __webpack_require__(13),
 
7612
              Complex = __webpack_require__(7),
 
7613
              collection = __webpack_require__(14),
7216
7614
 
7217
7615
              isNumber = util.number.isNumber,
7218
7616
              isBoolean = util['boolean'].isBoolean,
7280
7678
 
7281
7679
 
7282
7680
/***/ },
7283
 
/* 45 */
 
7681
/* 47 */
7284
7682
/***/ function(module, exports, __webpack_require__) {
7285
7683
 
7286
7684
        'use strict';
7287
7685
 
7288
7686
        module.exports = function (math) {
7289
 
          var util = __webpack_require__(160),
 
7687
          var util = __webpack_require__(171),
7290
7688
 
7291
7689
              BigNumber = math.type.BigNumber,
7292
 
              collection = __webpack_require__(13),
 
7690
              collection = __webpack_require__(14),
7293
7691
 
7294
7692
              isNumber = util.number.isNumber,
7295
7693
              isBoolean = util['boolean'].isBoolean,
7427
7825
 
7428
7826
 
7429
7827
/***/ },
7430
 
/* 46 */
 
7828
/* 48 */
7431
7829
/***/ function(module, exports, __webpack_require__) {
7432
7830
 
7433
7831
        'use strict';
7434
7832
 
7435
7833
        module.exports = function (math) {
7436
 
          var util = __webpack_require__(160),
 
7834
          var util = __webpack_require__(171),
7437
7835
 
7438
7836
              BigNumber = math.type.BigNumber,
7439
 
              collection = __webpack_require__(13),
 
7837
              collection = __webpack_require__(14),
7440
7838
 
7441
7839
              isNumber = util.number.isNumber,
7442
7840
              isBoolean = util['boolean'].isBoolean,
7589
7987
 
7590
7988
 
7591
7989
/***/ },
7592
 
/* 47 */
 
7990
/* 49 */
7593
7991
/***/ function(module, exports, __webpack_require__) {
7594
7992
 
7595
7993
        'use strict';
7596
7994
 
7597
7995
        module.exports = function (math) {
7598
 
          var util = __webpack_require__(160),
 
7996
          var util = __webpack_require__(171),
7599
7997
 
7600
7998
              BigNumber = math.type.BigNumber,
7601
 
              Complex = __webpack_require__(6),
7602
 
              collection = __webpack_require__(13),
 
7999
              Complex = __webpack_require__(7),
 
8000
              collection = __webpack_require__(14),
7603
8001
 
7604
8002
              isNumber = util.number.isNumber,
7605
8003
              isBoolean = util['boolean'].isBoolean,
7692
8090
 
7693
8091
 
7694
8092
/***/ },
7695
 
/* 48 */
 
8093
/* 50 */
7696
8094
/***/ function(module, exports, __webpack_require__) {
7697
8095
 
7698
8096
        'use strict';
7699
8097
 
7700
8098
        module.exports = function (math) {
7701
 
          var util = __webpack_require__(160),
 
8099
          var util = __webpack_require__(171),
7702
8100
 
7703
8101
              BigNumber = math.type.BigNumber,
7704
 
              Complex = __webpack_require__(6),
7705
 
              collection = __webpack_require__(13),
 
8102
              Complex = __webpack_require__(7),
 
8103
              collection = __webpack_require__(14),
7706
8104
 
7707
8105
              isNumber = util.number.isNumber,
7708
8106
              isBoolean = util['boolean'].isBoolean,
7780
8178
 
7781
8179
 
7782
8180
/***/ },
7783
 
/* 49 */
 
8181
/* 51 */
7784
8182
/***/ function(module, exports, __webpack_require__) {
7785
8183
 
7786
8184
        'use strict';
7787
8185
 
7788
8186
        module.exports = function (math) {
7789
 
          var util = __webpack_require__(160),
 
8187
          var util = __webpack_require__(171),
7790
8188
 
7791
8189
              BigNumber = math.type.BigNumber,
7792
 
              collection = __webpack_require__(13),
 
8190
              collection = __webpack_require__(14),
7793
8191
 
7794
8192
              isNumber = util.number.isNumber,
7795
8193
              isBoolean = util['boolean'].isBoolean,
7919
8317
 
7920
8318
 
7921
8319
/***/ },
7922
 
/* 50 */
 
8320
/* 52 */
7923
8321
/***/ function(module, exports, __webpack_require__) {
7924
8322
 
7925
8323
        'use strict';
7926
8324
 
7927
8325
        module.exports = function(math) {
7928
 
          var util = __webpack_require__(160),
 
8326
          var util = __webpack_require__(171),
7929
8327
 
7930
8328
              BigNumber = math.type.BigNumber,
7931
 
              Complex = __webpack_require__(6),
7932
 
              Matrix = __webpack_require__(9),
7933
 
              Unit = __webpack_require__(10),
7934
 
              collection = __webpack_require__(13),
 
8329
              Complex = __webpack_require__(7),
 
8330
              Matrix = __webpack_require__(10),
 
8331
              Unit = __webpack_require__(11),
 
8332
              collection = __webpack_require__(14),
7935
8333
 
7936
8334
              array = util.array,
7937
8335
              isNumber = util.number.isNumber,
8350
8748
 
8351
8749
 
8352
8750
/***/ },
8353
 
/* 51 */
 
8751
/* 53 */
8354
8752
/***/ function(module, exports, __webpack_require__) {
8355
8753
 
8356
8754
        'use strict';
8357
8755
 
8358
8756
        module.exports = function (math) {
8359
 
          var util = __webpack_require__(160),
 
8757
          var util = __webpack_require__(171),
8360
8758
 
8361
 
            array = __webpack_require__(153),
 
8759
            array = __webpack_require__(165),
8362
8760
 
8363
8761
            BigNumber = math.type.BigNumber,
8364
 
            Complex = __webpack_require__(6),
8365
 
            Matrix = __webpack_require__(9),
8366
 
            collection = __webpack_require__(13),
 
8762
            Complex = __webpack_require__(7),
 
8763
            Matrix = __webpack_require__(10),
 
8764
            collection = __webpack_require__(14),
8367
8765
 
8368
8766
            isNumber = util.number.isNumber,
8369
8767
            isBoolean = util['boolean'].isBoolean,
8419
8817
            }
8420
8818
 
8421
8819
            if (isComplex(x)) {
8422
 
              // ignore p, complex numbers
8423
 
              return Math.sqrt(x.re * x.re + x.im * x.im);
 
8820
              // do not compute sqrt(re * re + im * im) since it will overflow with big numbers!
 
8821
              var re = Math.abs(x.re);
 
8822
              var im = Math.abs(x.im);
 
8823
              if (re >= im) {
 
8824
                var x = im / re;
 
8825
                return re * Math.sqrt(1 + x * x);
 
8826
              }
 
8827
              var y = re / im;
 
8828
              return im * Math.sqrt(1 + y * y);
8424
8829
            }
8425
8830
 
8426
8831
            if (x instanceof BigNumber) {
8538
8943
 
8539
8944
 
8540
8945
/***/ },
8541
 
/* 52 */
 
8946
/* 54 */
8542
8947
/***/ function(module, exports, __webpack_require__) {
8543
8948
 
8544
8949
        'use strict';
8545
8950
 
8546
8951
        module.exports = function (math) {
8547
 
          var util = __webpack_require__(160);
 
8952
          var util = __webpack_require__(171);
8548
8953
 
8549
8954
          var BigNumber = math.type.BigNumber;
8550
 
          var collection = __webpack_require__(13);
 
8955
          var collection = __webpack_require__(14);
8551
8956
 
8552
8957
          var isNumber = util.number.isNumber;
8553
8958
          var isBoolean = util['boolean'].isBoolean;
8737
9142
 
8738
9143
 
8739
9144
/***/ },
8740
 
/* 53 */
 
9145
/* 55 */
8741
9146
/***/ function(module, exports, __webpack_require__) {
8742
9147
 
8743
9148
        'use strict';
8744
9149
 
8745
9150
        module.exports = function (math) {
8746
 
          var util = __webpack_require__(160),
 
9151
          var util = __webpack_require__(171),
8747
9152
 
8748
9153
              BigNumber = math.type.BigNumber,
8749
 
              Complex = __webpack_require__(6),
8750
 
              Matrix = __webpack_require__(9),
8751
 
              collection = __webpack_require__(13),
 
9154
              Complex = __webpack_require__(7),
 
9155
              Matrix = __webpack_require__(10),
 
9156
              collection = __webpack_require__(14),
8752
9157
 
8753
9158
              array = util.array,
8754
9159
              isNumber = util.number.isNumber,
8921
9326
 
8922
9327
 
8923
9328
/***/ },
8924
 
/* 54 */
 
9329
/* 56 */
8925
9330
/***/ function(module, exports, __webpack_require__) {
8926
9331
 
8927
9332
        'use strict';
8928
9333
 
8929
9334
        module.exports = function (math) {
8930
 
          var util = __webpack_require__(160),
 
9335
          var util = __webpack_require__(171),
8931
9336
 
8932
9337
              BigNumber = math.type.BigNumber,
8933
 
              Complex = __webpack_require__(6),
8934
 
              collection = __webpack_require__(13),
 
9338
              Complex = __webpack_require__(7),
 
9339
              collection = __webpack_require__(14),
8935
9340
 
8936
9341
              isNumber = util.number.isNumber,
8937
9342
              isInteger = util.number.isInteger,
9061
9466
 
9062
9467
 
9063
9468
/***/ },
9064
 
/* 55 */
 
9469
/* 57 */
9065
9470
/***/ function(module, exports, __webpack_require__) {
9066
9471
 
9067
9472
        'use strict';
9068
9473
 
9069
9474
        module.exports = function (math) {
9070
 
          var util = __webpack_require__(160),
 
9475
          var util = __webpack_require__(171),
9071
9476
 
9072
9477
              BigNumber = math.type.BigNumber,
9073
 
              Complex = __webpack_require__(6),
9074
 
              collection = __webpack_require__(13),
 
9478
              Complex = __webpack_require__(7),
 
9479
              collection = __webpack_require__(14),
9075
9480
 
9076
9481
              number = util.number,
9077
9482
              isNumber = util.number.isNumber,
9141
9546
 
9142
9547
 
9143
9548
/***/ },
9144
 
/* 56 */
 
9549
/* 58 */
9145
9550
/***/ function(module, exports, __webpack_require__) {
9146
9551
 
9147
9552
        'use strict';
9148
9553
 
9149
9554
        module.exports = function (math) {
9150
 
          var util = __webpack_require__(160),
 
9555
          var util = __webpack_require__(171),
9151
9556
 
9152
9557
              BigNumber = math.type.BigNumber,
9153
 
              Complex = __webpack_require__(6),
9154
 
              collection = __webpack_require__(13),
 
9558
              Complex = __webpack_require__(7),
 
9559
              collection = __webpack_require__(14),
9155
9560
 
9156
9561
              isNumber = util.number.isNumber,
9157
9562
              isBoolean = util['boolean'].isBoolean,
9247
9652
 
9248
9653
 
9249
9654
/***/ },
9250
 
/* 57 */
 
9655
/* 59 */
9251
9656
/***/ function(module, exports, __webpack_require__) {
9252
9657
 
9253
9658
        'use strict';
9254
9659
 
9255
9660
        module.exports = function (math) {
9256
 
          var util = __webpack_require__(160),
 
9661
          var util = __webpack_require__(171),
9257
9662
 
9258
9663
              BigNumber = math.type.BigNumber,
9259
 
              Complex = __webpack_require__(6),
9260
 
              collection = __webpack_require__(13),
 
9664
              Complex = __webpack_require__(7),
 
9665
              collection = __webpack_require__(14),
9261
9666
 
9262
9667
              isNumber = util.number.isNumber,
9263
9668
              isBoolean = util['boolean'].isBoolean,
9321
9726
 
9322
9727
 
9323
9728
/***/ },
9324
 
/* 58 */
 
9729
/* 60 */
9325
9730
/***/ function(module, exports, __webpack_require__) {
9326
9731
 
9327
9732
        'use strict';
9328
9733
 
9329
9734
        module.exports = function (math) {
9330
 
          var util = __webpack_require__(160),
 
9735
          var util = __webpack_require__(171),
9331
9736
 
9332
9737
              BigNumber = math.type.BigNumber,
9333
 
              Complex = __webpack_require__(6),
9334
 
              Matrix = __webpack_require__(9),
9335
 
              Unit = __webpack_require__(10),
9336
 
              collection = __webpack_require__(13),
 
9738
              Complex = __webpack_require__(7),
 
9739
              Matrix = __webpack_require__(10),
 
9740
              Unit = __webpack_require__(11),
 
9741
              collection = __webpack_require__(14),
9337
9742
 
9338
9743
              isBoolean = util['boolean'].isBoolean,
9339
9744
              isNumber = util.number.isNumber,
9481
9886
 
9482
9887
 
9483
9888
/***/ },
9484
 
/* 59 */
 
9889
/* 61 */
9485
9890
/***/ function(module, exports, __webpack_require__) {
9486
9891
 
9487
9892
        'use strict';
9488
9893
 
9489
9894
        module.exports = function (math, config) {
9490
 
          var util = __webpack_require__(160),
 
9895
          var util = __webpack_require__(171),
9491
9896
 
9492
9897
              BigNumber = math.type.BigNumber,
9493
 
              Complex = __webpack_require__(6),
9494
 
              Unit = __webpack_require__(10),
9495
 
              collection = __webpack_require__(13),
 
9898
              Complex = __webpack_require__(7),
 
9899
              Unit = __webpack_require__(11),
 
9900
              collection = __webpack_require__(14),
9496
9901
 
9497
9902
              isNumber = util.number.isNumber,
9498
9903
              isBoolean = util['boolean'].isBoolean,
9570
9975
 
9571
9976
 
9572
9977
/***/ },
9573
 
/* 60 */
 
9978
/* 62 */
9574
9979
/***/ function(module, exports, __webpack_require__) {
9575
9980
 
9576
9981
        'use strict';
9577
9982
 
9578
9983
        module.exports = function (math, config) {
9579
 
          var util = __webpack_require__(160),
 
9984
          var util = __webpack_require__(171),
9580
9985
 
9581
9986
              BigNumber = math.type.BigNumber,
9582
 
              Complex = __webpack_require__(6),
9583
 
              Unit = __webpack_require__(10),
9584
 
              collection = __webpack_require__(13),
 
9987
              Complex = __webpack_require__(7),
 
9988
              Unit = __webpack_require__(11),
 
9989
              collection = __webpack_require__(14),
9585
9990
 
9586
9991
              isNumber = util.number.isNumber,
9587
9992
              isBoolean = util['boolean'].isBoolean,
9650
10055
 
9651
10056
 
9652
10057
/***/ },
9653
 
/* 61 */
 
10058
/* 63 */
9654
10059
/***/ function(module, exports, __webpack_require__) {
9655
10060
 
9656
10061
        'use strict';
9657
10062
 
9658
10063
        module.exports = function (math, config) {
9659
 
          var util = __webpack_require__(160),
 
10064
          var util = __webpack_require__(171),
9660
10065
 
9661
 
              Matrix = __webpack_require__(9),
 
10066
              Matrix = __webpack_require__(10),
9662
10067
              BigNumber = math.type.BigNumber,
9663
10068
 
9664
10069
              isNumber = util.number.isNumber,
9832
10237
 
9833
10238
 
9834
10239
/***/ },
9835
 
/* 62 */
 
10240
/* 64 */
9836
10241
/***/ function(module, exports, __webpack_require__) {
9837
10242
 
9838
10243
        'use strict';
9839
10244
 
9840
10245
        module.exports = function (math, config) {
9841
 
          var util = __webpack_require__(160),
 
10246
          var util = __webpack_require__(171),
9842
10247
 
9843
10248
              BigNumber = math.type.BigNumber,
9844
 
              Matrix = __webpack_require__(9),
9845
 
              Unit = __webpack_require__(10),
9846
 
              collection = __webpack_require__(13),
 
10249
              Matrix = __webpack_require__(10),
 
10250
              Unit = __webpack_require__(11),
 
10251
              collection = __webpack_require__(14),
9847
10252
 
9848
10253
              isBoolean = util['boolean'].isBoolean,
9849
10254
              isInteger = util.number.isInteger,
9931
10336
 
9932
10337
 
9933
10338
/***/ },
9934
 
/* 63 */
 
10339
/* 65 */
9935
10340
/***/ function(module, exports, __webpack_require__) {
9936
10341
 
9937
10342
        'use strict';
9938
10343
 
9939
10344
        module.exports = function (math, config) {
9940
 
          var util = __webpack_require__(160),
 
10345
          var util = __webpack_require__(171),
9941
10346
 
9942
10347
              BigNumber = math.type.BigNumber,
9943
 
              Matrix = __webpack_require__(9),
9944
 
              Unit = __webpack_require__(10),
9945
 
              collection = __webpack_require__(13),
 
10348
              Matrix = __webpack_require__(10),
 
10349
              Unit = __webpack_require__(11),
 
10350
              collection = __webpack_require__(14),
9946
10351
 
9947
10352
              isBoolean = util['boolean'].isBoolean,
9948
10353
              isInteger = util.number.isInteger,
10004
10409
 
10005
10410
 
10006
10411
/***/ },
10007
 
/* 64 */
 
10412
/* 66 */
10008
10413
/***/ function(module, exports, __webpack_require__) {
10009
10414
 
10010
10415
        'use strict';
10011
10416
 
10012
10417
        module.exports = function (math, config) {
10013
 
          var util = __webpack_require__(160),
 
10418
          var util = __webpack_require__(171),
10014
10419
 
10015
10420
              BigNumber = math.type.BigNumber,
10016
 
              Matrix = __webpack_require__(9),
10017
 
              Unit = __webpack_require__(10),
10018
 
              collection = __webpack_require__(13),
 
10421
              Matrix = __webpack_require__(10),
 
10422
              Unit = __webpack_require__(11),
 
10423
              collection = __webpack_require__(14),
10019
10424
 
10020
10425
              isBoolean = util['boolean'].isBoolean,
10021
10426
              isInteger = util.number.isInteger,
10104
10509
 
10105
10510
 
10106
10511
/***/ },
10107
 
/* 65 */
 
10512
/* 67 */
10108
10513
/***/ function(module, exports, __webpack_require__) {
10109
10514
 
10110
10515
        'use strict';
10111
10516
 
10112
10517
        module.exports = function (math, config) {
10113
 
          var util = __webpack_require__(160),
 
10518
          var util = __webpack_require__(171),
10114
10519
 
10115
10520
              BigNumber = math.type.BigNumber,
10116
 
              Matrix = __webpack_require__(9),
10117
 
              Unit = __webpack_require__(10),
10118
 
              collection = __webpack_require__(13),
 
10521
              Matrix = __webpack_require__(10),
 
10522
              Unit = __webpack_require__(11),
 
10523
              collection = __webpack_require__(14),
10119
10524
 
10120
10525
              isBoolean = util['boolean'].isBoolean,
10121
10526
              isInteger = util.number.isInteger,
10203
10608
 
10204
10609
 
10205
10610
/***/ },
10206
 
/* 66 */
 
10611
/* 68 */
10207
10612
/***/ function(module, exports, __webpack_require__) {
10208
10613
 
10209
10614
        'use strict';
10210
10615
 
10211
10616
        module.exports = function (math, config) {
10212
 
          var util = __webpack_require__(160),
 
10617
          var util = __webpack_require__(171),
10213
10618
 
10214
10619
              BigNumber = math.type.BigNumber,
10215
 
              Matrix = __webpack_require__(9),
10216
 
              Unit = __webpack_require__(10),
10217
 
              collection = __webpack_require__(13),
 
10620
              Matrix = __webpack_require__(10),
 
10621
              Unit = __webpack_require__(11),
 
10622
              collection = __webpack_require__(14),
10218
10623
 
10219
10624
              isBoolean = util['boolean'].isBoolean,
10220
10625
              isInteger = util.number.isInteger,
10325
10730
 
10326
10731
 
10327
10732
/***/ },
10328
 
/* 67 */
 
10733
/* 69 */
10329
10734
/***/ function(module, exports, __webpack_require__) {
10330
10735
 
10331
10736
        'use strict';
10332
10737
 
10333
10738
        module.exports = function (math, config) {
10334
 
          var util = __webpack_require__(160),
 
10739
          var util = __webpack_require__(171),
10335
10740
 
10336
10741
              BigNumber = math.type.BigNumber,
10337
 
              Matrix = __webpack_require__(9),
10338
 
              Unit = __webpack_require__(10),
10339
 
              collection = __webpack_require__(13),
 
10742
              Matrix = __webpack_require__(10),
 
10743
              Unit = __webpack_require__(11),
 
10744
              collection = __webpack_require__(14),
10340
10745
 
10341
10746
              isBoolean = util['boolean'].isBoolean,
10342
10747
              isInteger = util.number.isInteger,
10449
10854
 
10450
10855
 
10451
10856
/***/ },
10452
 
/* 68 */
 
10857
/* 70 */
10453
10858
/***/ function(module, exports, __webpack_require__) {
10454
10859
 
10455
10860
        'use strict';
10456
10861
 
10457
10862
        module.exports = function (math, config) {
10458
 
          var util = __webpack_require__(160),
 
10863
          var util = __webpack_require__(171),
10459
10864
 
10460
 
              Matrix = __webpack_require__(9),
10461
 
              Unit = __webpack_require__(10),
10462
 
              collection = __webpack_require__(13),
 
10865
              Matrix = __webpack_require__(10),
 
10866
              Unit = __webpack_require__(11),
 
10867
              collection = __webpack_require__(14),
10463
10868
 
10464
10869
              isBoolean = util['boolean'].isBoolean,
10465
10870
              isInteger = util.number.isInteger,
10519
10924
 
10520
10925
 
10521
10926
/***/ },
10522
 
/* 69 */
 
10927
/* 71 */
10523
10928
/***/ function(module, exports, __webpack_require__) {
10524
10929
 
10525
10930
        'use strict';
10526
10931
 
10527
10932
        module.exports = function (math) {
10528
 
          var util = __webpack_require__(160),
 
10933
          var util = __webpack_require__(171),
10529
10934
 
10530
10935
              BigNumber = math.type.BigNumber,
10531
 
              Complex = __webpack_require__(6),
10532
 
              collection = __webpack_require__(13),
 
10936
              Complex = __webpack_require__(7),
 
10937
              collection = __webpack_require__(14),
10533
10938
 
10534
10939
              isNumber = util.number.isNumber,
10535
10940
              isBoolean = util['boolean'].isBoolean,
10596
11001
 
10597
11002
 
10598
11003
/***/ },
10599
 
/* 70 */
 
11004
/* 72 */
10600
11005
/***/ function(module, exports, __webpack_require__) {
10601
11006
 
10602
11007
        'use strict';
10603
11008
 
10604
11009
        module.exports = function (math) {
10605
 
          var util = __webpack_require__(160),
 
11010
          var util = __webpack_require__(171),
10606
11011
 
10607
11012
              BigNumber = math.type.BigNumber,
10608
 
              Complex = __webpack_require__(6),
10609
 
              collection = __webpack_require__(13),
 
11013
              Complex = __webpack_require__(7),
 
11014
              collection = __webpack_require__(14),
10610
11015
 
10611
11016
              object = util.object,
10612
11017
              isNumber = util.number.isNumber,
10671
11076
 
10672
11077
 
10673
11078
/***/ },
10674
 
/* 71 */
 
11079
/* 73 */
10675
11080
/***/ function(module, exports, __webpack_require__) {
10676
11081
 
10677
11082
        'use strict';
10678
11083
 
10679
11084
        module.exports = function (math) {
10680
 
          var util = __webpack_require__(160),
 
11085
          var util = __webpack_require__(171),
10681
11086
 
10682
11087
              BigNumber = math.type.BigNumber,
10683
 
              Complex = __webpack_require__(6),
10684
 
              collection = __webpack_require__(13),
 
11088
              Complex = __webpack_require__(7),
 
11089
              collection = __webpack_require__(14),
10685
11090
 
10686
11091
              object = util.object,
10687
11092
              isNumber = util.number.isNumber,
10748
11153
 
10749
11154
 
10750
11155
/***/ },
10751
 
/* 72 */
 
11156
/* 74 */
10752
11157
/***/ function(module, exports, __webpack_require__) {
10753
11158
 
10754
11159
        'use strict';
10755
11160
 
10756
11161
        module.exports = function (math) {
10757
 
          var util = __webpack_require__(160),
 
11162
          var util = __webpack_require__(171),
10758
11163
 
10759
11164
              BigNumber = math.type.BigNumber,
10760
 
              Complex = __webpack_require__(6),
10761
 
              collection = __webpack_require__(13),
 
11165
              Complex = __webpack_require__(7),
 
11166
              collection = __webpack_require__(14),
10762
11167
 
10763
11168
              isNumber = util.number.isNumber,
10764
11169
              isBoolean = util['boolean'].isBoolean,
10824
11229
 
10825
11230
 
10826
11231
/***/ },
10827
 
/* 73 */
 
11232
/* 75 */
10828
11233
/***/ function(module, exports, __webpack_require__) {
10829
11234
 
10830
11235
        'use strict';
10831
11236
 
10832
11237
        module.exports = function (math) {
10833
 
          var util = __webpack_require__(160),
 
11238
          var util = __webpack_require__(171),
10834
11239
 
10835
11240
              // take the BigNumber instance the provided math.js instance
10836
11241
              BigNumber = math.type.BigNumber,
10837
 
              collection = __webpack_require__(13),
 
11242
              collection = __webpack_require__(14),
10838
11243
 
10839
11244
              isCollection = collection.isCollection,
10840
11245
              isNumber = util.number.isNumber,
10893
11298
 
10894
11299
 
10895
11300
/***/ },
10896
 
/* 74 */
 
11301
/* 76 */
10897
11302
/***/ function(module, exports, __webpack_require__) {
10898
11303
 
10899
11304
        'use strict';
10900
11305
 
10901
11306
        module.exports = function (math) {
10902
 
          var util = __webpack_require__(160),
 
11307
          var util = __webpack_require__(171),
10903
11308
 
10904
11309
              BigNumber = math.type.BigNumber,
10905
 
              collection = __webpack_require__(13),
 
11310
              collection = __webpack_require__(14),
10906
11311
 
10907
11312
              isCollection = collection.isCollection,
10908
11313
              isNumber = util.number.isNumber,
10987
11392
 
10988
11393
 
10989
11394
/***/ },
10990
 
/* 75 */
 
11395
/* 77 */
10991
11396
/***/ function(module, exports, __webpack_require__) {
10992
11397
 
10993
11398
        'use strict';
10994
11399
 
10995
11400
        module.exports = function (math) {
10996
 
          var util = __webpack_require__(160),
 
11401
          var util = __webpack_require__(171),
10997
11402
 
10998
11403
              BigNumber = math.type.BigNumber,
10999
 
              Complex = __webpack_require__(6),
11000
 
              collection = __webpack_require__(13),
 
11404
              Complex = __webpack_require__(7),
 
11405
              collection = __webpack_require__(14),
11001
11406
 
11002
11407
              isCollection = collection.isCollection,
11003
11408
              isNumber = util.number.isNumber,
11120
11525
 
11121
11526
 
11122
11527
/***/ },
11123
 
/* 76 */
 
11528
/* 78 */
11124
11529
/***/ function(module, exports, __webpack_require__) {
11125
11530
 
11126
11531
        'use strict';
11127
11532
 
11128
11533
        module.exports = function (math) {
11129
 
          var util = __webpack_require__(160),
 
11534
          var util = __webpack_require__(171),
11130
11535
 
11131
11536
              BigNumber = math.type.BigNumber,
11132
 
              Index = __webpack_require__(8);
 
11537
              Index = __webpack_require__(9);
11133
11538
 
11134
11539
          /**
11135
11540
           * Create an index. An Index can store ranges having start, step, and end
11194
11599
 
11195
11600
 
11196
11601
/***/ },
11197
 
/* 77 */
 
11602
/* 79 */
11198
11603
/***/ function(module, exports, __webpack_require__) {
11199
11604
 
11200
11605
        'use strict';
11201
11606
 
11202
11607
        module.exports = function (math) {
11203
 
          var util = __webpack_require__(160),
11204
 
              Matrix = __webpack_require__(9);
 
11608
          var util = __webpack_require__(171),
 
11609
              Matrix = __webpack_require__(10);
11205
11610
 
11206
11611
          /**
11207
11612
           * Create a Matrix. The function creates a new `math.type.Matrix` object from
11239
11644
 
11240
11645
 
11241
11646
/***/ },
11242
 
/* 78 */
 
11647
/* 80 */
11243
11648
/***/ function(module, exports, __webpack_require__) {
11244
11649
 
11245
11650
        'use strict';
11246
11651
 
11247
11652
        module.exports = function (math) {
11248
 
          var util = __webpack_require__(160);
 
11653
          var util = __webpack_require__(171);
11249
11654
 
11250
11655
          var BigNumber = math.type.BigNumber;
11251
11656
          var Unit = math.type.Unit;
11252
 
          var collection = __webpack_require__(13);
 
11657
          var collection = __webpack_require__(14);
11253
11658
 
11254
11659
          var isCollection = collection.isCollection;
11255
11660
          var isNumber = util.number.isNumber;
11336
11741
 
11337
11742
 
11338
11743
/***/ },
11339
 
/* 79 */
 
11744
/* 81 */
11340
11745
/***/ function(module, exports, __webpack_require__) {
11341
11746
 
11342
11747
        'use strict';
11343
11748
 
11344
11749
        module.exports = function (math) {
11345
 
          var Parser = __webpack_require__(15);
 
11750
          var Parser = __webpack_require__(17);
11346
11751
 
11347
11752
          /**
11348
11753
           * Create a parser. The function creates a new `math.expression.Parser` object.
11394
11799
 
11395
11800
 
11396
11801
/***/ },
11397
 
/* 80 */
 
11802
/* 82 */
11398
11803
/***/ function(module, exports, __webpack_require__) {
11399
11804
 
11400
11805
        'use strict';
11428
11833
           *         .done();     // 5
11429
11834
           *
11430
11835
           *     math.chain( [[1, 2], [3, 4]] )
11431
 
           *         .set([1, 1], 8)
 
11836
           *         .subset(math.index(0, 0), 8)
11432
11837
           *         .multiply(3)
11433
11838
           *         .done();     // [[24, 6], [9, 12]]
11434
11839
           *
11457
11862
 
11458
11863
 
11459
11864
/***/ },
11460
 
/* 81 */
 
11865
/* 83 */
11461
11866
/***/ function(module, exports, __webpack_require__) {
11462
11867
 
11463
11868
        'use strict';
11464
11869
 
11465
11870
        module.exports = function (math) {
11466
 
          var util = __webpack_require__(160),
 
11871
          var util = __webpack_require__(171),
11467
11872
 
11468
 
              collection = __webpack_require__(13),
 
11873
              collection = __webpack_require__(14),
11469
11874
 
11470
11875
              number = util.number,
11471
11876
              isNumber = util.number.isNumber,
11524
11929
 
11525
11930
 
11526
11931
/***/ },
11527
 
/* 82 */
 
11932
/* 84 */
11528
11933
/***/ function(module, exports, __webpack_require__) {
11529
11934
 
11530
11935
        'use strict';
11531
11936
 
11532
11937
        module.exports = function (math) {
11533
 
          var util = __webpack_require__(160),
 
11938
          var util = __webpack_require__(171),
11534
11939
 
11535
11940
              BigNumber = math.type.BigNumber,
11536
 
              Unit = __webpack_require__(10),
11537
 
              collection = __webpack_require__(13),
 
11941
              Unit = __webpack_require__(11),
 
11942
              collection = __webpack_require__(14),
11538
11943
 
11539
11944
              isCollection = collection.isCollection,
11540
11945
              isString = util.string.isString;
11611
12016
 
11612
12017
 
11613
12018
/***/ },
11614
 
/* 83 */
 
12019
/* 85 */
11615
12020
/***/ function(module, exports, __webpack_require__) {
11616
12021
 
11617
12022
        'use strict';
11618
12023
 
11619
12024
        module.exports = function (math) {
11620
 
          var util = __webpack_require__(160),
 
12025
          var util = __webpack_require__(171),
11621
12026
 
11622
12027
              BigNumber = math.type.BigNumber,
11623
 
              Complex = __webpack_require__(6),
11624
 
              Unit = __webpack_require__(10),
11625
 
              collection = __webpack_require__(13),
 
12028
              Complex = __webpack_require__(7),
 
12029
              Unit = __webpack_require__(11),
 
12030
              collection = __webpack_require__(14),
11626
12031
 
11627
12032
              isNumber = util.number.isNumber,
11628
12033
              isBoolean = util['boolean'].isBoolean,
11723
12128
 
11724
12129
 
11725
12130
/***/ },
11726
 
/* 84 */
 
12131
/* 86 */
11727
12132
/***/ function(module, exports, __webpack_require__) {
11728
12133
 
11729
12134
        'use strict';
11730
12135
 
11731
12136
        module.exports = function (math) {
11732
 
          var util = __webpack_require__(160),
 
12137
          var util = __webpack_require__(171),
11733
12138
 
11734
12139
              BigNumber = math.type.BigNumber,
11735
 
              Complex = __webpack_require__(6),
11736
 
              Unit = __webpack_require__(10),
11737
 
              collection = __webpack_require__(13),
 
12140
              Complex = __webpack_require__(7),
 
12141
              Unit = __webpack_require__(11),
 
12142
              collection = __webpack_require__(14),
11738
12143
 
11739
12144
              isNumber = util.number.isNumber,
11740
12145
              isBoolean = util['boolean'].isBoolean,
11798
12203
 
11799
12204
 
11800
12205
/***/ },
11801
 
/* 85 */
 
12206
/* 87 */
11802
12207
/***/ function(module, exports, __webpack_require__) {
11803
12208
 
11804
12209
        'use strict';
11805
12210
 
11806
12211
        module.exports = function (math) {
11807
 
          var util = __webpack_require__(160),
 
12212
          var util = __webpack_require__(171),
11808
12213
 
11809
12214
              BigNumber = math.type.BigNumber,
11810
 
              Complex = __webpack_require__(6),
11811
 
              Unit = __webpack_require__(10),
11812
 
              collection = __webpack_require__(13),
 
12215
              Complex = __webpack_require__(7),
 
12216
              Unit = __webpack_require__(11),
 
12217
              collection = __webpack_require__(14),
11813
12218
 
11814
12219
              isNumber = util.number.isNumber,
11815
12220
              isBoolean = util['boolean'].isBoolean,
11904
12309
 
11905
12310
 
11906
12311
/***/ },
11907
 
/* 86 */
 
12312
/* 88 */
11908
12313
/***/ function(module, exports, __webpack_require__) {
11909
12314
 
11910
12315
        'use strict';
11911
12316
 
11912
12317
        module.exports = function (math) {
11913
 
          var util = __webpack_require__(160),
 
12318
          var util = __webpack_require__(171),
11914
12319
 
11915
12320
              BigNumber = math.type.BigNumber,
11916
 
              Complex = __webpack_require__(6),
11917
 
              Unit = __webpack_require__(10),
11918
 
              collection = __webpack_require__(13),
 
12321
              Complex = __webpack_require__(7),
 
12322
              Unit = __webpack_require__(11),
 
12323
              collection = __webpack_require__(14),
11919
12324
 
11920
12325
              isNumber = util.number.isNumber,
11921
12326
              isBoolean = util['boolean'].isBoolean,
11992
12397
 
11993
12398
 
11994
12399
/***/ },
11995
 
/* 87 */
 
12400
/* 89 */
11996
12401
/***/ function(module, exports, __webpack_require__) {
11997
12402
 
11998
12403
        'use strict';
11999
12404
 
12000
12405
        module.exports = function (math) {
12001
 
          var util = __webpack_require__(160),
12002
 
 
12003
 
              BigNumber = __webpack_require__(159),
12004
 
              Matrix = __webpack_require__(9),
12005
 
              collection = __webpack_require__(13),
12006
 
 
12007
 
              object = util.object,
12008
 
              array = util.array,
12009
 
              isNumber = util.number.isNumber,
12010
 
              isInteger = util.number.isInteger,
12011
 
              isCollection = collection.isCollection;
 
12406
          var util = __webpack_require__(171);
 
12407
 
 
12408
          var BigNumber = __webpack_require__(5);
 
12409
          var Matrix = __webpack_require__(10);
 
12410
          var collection = __webpack_require__(14);
 
12411
 
 
12412
          var object = util.object;
 
12413
          var array = util.array;
 
12414
          var isNumber = util.number.isNumber;
 
12415
          var isInteger = util.number.isInteger;
 
12416
          var isCollection = collection.isCollection;
12012
12417
 
12013
12418
          /**
12014
12419
           * Concatenate two or more matrices.
12134
12539
 
12135
12540
 
12136
12541
/***/ },
12137
 
/* 88 */
 
12542
/* 90 */
12138
12543
/***/ function(module, exports, __webpack_require__) {
12139
12544
 
12140
12545
        'use strict';
12141
12546
 
12142
12547
        module.exports = function(math) {
12143
 
          var array = __webpack_require__(153);
12144
 
          var Matrix = __webpack_require__(9);
 
12548
          var array = __webpack_require__(165);
 
12549
          var Matrix = __webpack_require__(10);
12145
12550
 
12146
12551
          /**
12147
12552
           * Calculate the cross product for two vectors in three dimensional space.
12219
12624
 
12220
12625
 
12221
12626
/***/ },
12222
 
/* 89 */
 
12627
/* 91 */
12223
12628
/***/ function(module, exports, __webpack_require__) {
12224
12629
 
12225
12630
        'use strict';
12226
12631
 
12227
12632
        module.exports = function (math) {
12228
 
          var util = __webpack_require__(160),
 
12633
          var util = __webpack_require__(171),
12229
12634
 
12230
 
              Matrix = __webpack_require__(9),
 
12635
              Matrix = __webpack_require__(10),
12231
12636
 
12232
12637
              object = util.object,
12233
12638
              string = util.string;
12380
12785
 
12381
12786
 
12382
12787
/***/ },
12383
 
/* 90 */
 
12788
/* 92 */
12384
12789
/***/ function(module, exports, __webpack_require__) {
12385
12790
 
12386
12791
        'use strict';
12387
12792
 
12388
12793
        module.exports = function (math) {
12389
 
          var util = __webpack_require__(160),
 
12794
          var util = __webpack_require__(171),
12390
12795
 
12391
12796
              BigNumber = math.type.BigNumber,
12392
 
              Matrix = __webpack_require__(9),
 
12797
              Matrix = __webpack_require__(10),
12393
12798
 
12394
12799
              object = util.object,
12395
12800
              isArray = util.array.isArray,
12497
12902
 
12498
12903
 
12499
12904
/***/ },
12500
 
/* 91 */
 
12905
/* 93 */
12501
12906
/***/ function(module, exports, __webpack_require__) {
12502
12907
 
12503
12908
        'use strict';
12504
12909
 
12505
12910
        module.exports = function(math) {
12506
 
          var array = __webpack_require__(153);
12507
 
          var Matrix = __webpack_require__(9);
 
12911
          var array = __webpack_require__(165);
 
12912
          var Matrix = __webpack_require__(10);
12508
12913
 
12509
12914
          /**
12510
12915
           * Calculate the dot product of two vectors. The dot product of
12578
12983
 
12579
12984
 
12580
12985
/***/ },
12581
 
/* 92 */
 
12986
/* 94 */
12582
12987
/***/ function(module, exports, __webpack_require__) {
12583
12988
 
12584
12989
        'use strict';
12585
12990
 
12586
12991
        module.exports = function (math, config) {
12587
 
          var util = __webpack_require__(160),
 
12992
          var util = __webpack_require__(171),
12588
12993
 
12589
12994
              BigNumber = math.type.BigNumber,
12590
 
              Matrix = __webpack_require__(9),
12591
 
              collection = __webpack_require__(13),
 
12995
              Matrix = __webpack_require__(10),
 
12996
              collection = __webpack_require__(14),
12592
12997
 
12593
12998
              isNumber = util.number.isNumber,
12594
12999
              isInteger = util.number.isInteger,
12681
13086
 
12682
13087
 
12683
13088
/***/ },
12684
 
/* 93 */
 
13089
/* 95 */
12685
13090
/***/ function(module, exports, __webpack_require__) {
12686
13091
 
12687
13092
        'use strict';
12688
13093
 
12689
13094
        module.exports = function (math, config) {
12690
 
          var util = __webpack_require__(160);
 
13095
          var util = __webpack_require__(171);
12691
13096
 
12692
 
          var Matrix = __webpack_require__(9);
 
13097
          var Matrix = __webpack_require__(10);
12693
13098
 
12694
13099
          var object = util.object;
12695
13100
          var array = util.array;
12734
13139
 
12735
13140
 
12736
13141
/***/ },
12737
 
/* 94 */
 
13142
/* 96 */
12738
13143
/***/ function(module, exports, __webpack_require__) {
12739
13144
 
12740
13145
        'use strict';
12741
13146
 
12742
13147
        module.exports = function (math) {
12743
 
          var util = __webpack_require__(160);
12744
 
          var Matrix = __webpack_require__(9);
 
13148
          var util = __webpack_require__(171);
 
13149
          var Matrix = __webpack_require__(10);
12745
13150
 
12746
13151
          /**
12747
13152
           * Calculate the inverse of a square matrix.
12932
13337
 
12933
13338
 
12934
13339
/***/ },
12935
 
/* 95 */
 
13340
/* 97 */
12936
13341
/***/ function(module, exports, __webpack_require__) {
12937
13342
 
12938
13343
        'use strict';
12939
13344
 
12940
13345
        module.exports = function (math, config) {
12941
 
          var util = __webpack_require__(160),
 
13346
          var util = __webpack_require__(171),
12942
13347
 
12943
13348
              BigNumber = math.type.BigNumber,
12944
 
              Matrix = __webpack_require__(9),
12945
 
              collection = __webpack_require__(13),
 
13349
              Matrix = __webpack_require__(10),
 
13350
              collection = __webpack_require__(14),
12946
13351
 
12947
13352
              array = util.array,
12948
13353
 
13009
13414
 
13010
13415
 
13011
13416
/***/ },
13012
 
/* 96 */
 
13417
/* 98 */
13013
13418
/***/ function(module, exports, __webpack_require__) {
13014
13419
 
13015
13420
        'use strict';
13016
13421
 
13017
13422
        module.exports = function (math, config) {
13018
 
          var util = __webpack_require__(160),
 
13423
          var util = __webpack_require__(171),
13019
13424
 
13020
13425
              BigNumber = math.type.BigNumber,
13021
 
              Matrix = __webpack_require__(9),
13022
 
              collection = __webpack_require__(13),
 
13426
              Matrix = __webpack_require__(10),
 
13427
              collection = __webpack_require__(14),
13023
13428
 
13024
13429
              isBoolean = util['boolean'].isBoolean,
13025
13430
              isString = util.string.isString,
13335
13740
 
13336
13741
 
13337
13742
/***/ },
13338
 
/* 97 */
 
13743
/* 99 */
13339
13744
/***/ function(module, exports, __webpack_require__) {
13340
13745
 
13341
13746
        'use strict';
13342
13747
 
13343
13748
        module.exports = function (math, config) {
13344
 
          var util = __webpack_require__(160),
 
13749
          var util = __webpack_require__(171),
13345
13750
 
13346
13751
              BigNumber = math.type.BigNumber,
13347
 
              Matrix = __webpack_require__(9),
 
13752
              Matrix = __webpack_require__(10),
13348
13753
 
13349
13754
              array = util.array,
13350
13755
              clone = util.object.clone,
13470
13875
 
13471
13876
 
13472
13877
/***/ },
13473
 
/* 98 */
 
13878
/* 100 */
13474
13879
/***/ function(module, exports, __webpack_require__) {
13475
13880
 
13476
13881
        'use strict';
13477
13882
 
13478
13883
        module.exports = function (math, config) {
13479
 
          var util = __webpack_require__(160),
 
13884
          var util = __webpack_require__(171),
13480
13885
 
13481
13886
              BigNumber = math.type.BigNumber,
13482
 
              Complex = __webpack_require__(6),
13483
 
              Unit = __webpack_require__(10),
13484
 
              Matrix = __webpack_require__(9),
 
13887
              Complex = __webpack_require__(7),
 
13888
              Unit = __webpack_require__(11),
 
13889
              Matrix = __webpack_require__(10),
13485
13890
 
13486
13891
              array = util.array,
13487
13892
              isNumber = util.number.isNumber,
13543
13948
 
13544
13949
 
13545
13950
/***/ },
13546
 
/* 99 */
 
13951
/* 101 */
13547
13952
/***/ function(module, exports, __webpack_require__) {
13548
13953
 
13549
13954
        'use strict';
13550
13955
 
13551
13956
        module.exports = function (math) {
13552
 
          var util = __webpack_require__(160),
 
13957
          var util = __webpack_require__(171),
13553
13958
 
13554
 
              Matrix = __webpack_require__(9),
 
13959
              Matrix = __webpack_require__(10),
13555
13960
 
13556
13961
              object = util.object,
13557
13962
              array = util.array,
13607
14012
 
13608
14013
 
13609
14014
/***/ },
13610
 
/* 100 */
 
14015
/* 102 */
13611
14016
/***/ function(module, exports, __webpack_require__) {
13612
14017
 
13613
14018
        'use strict';
13614
14019
 
13615
14020
        module.exports = function (math) {
13616
 
          var util = __webpack_require__(160),
 
14021
          var util = __webpack_require__(171),
13617
14022
 
13618
 
              Matrix = __webpack_require__(9),
13619
 
              Index = __webpack_require__(8),
 
14023
              Matrix = __webpack_require__(10),
 
14024
              Index = __webpack_require__(9),
13620
14025
 
13621
14026
              array = util.array,
13622
14027
              isString = util.string.isString,
13824
14229
 
13825
14230
 
13826
14231
/***/ },
13827
 
/* 101 */
13828
 
/***/ function(module, exports, __webpack_require__) {
13829
 
 
13830
 
        'use strict';
13831
 
 
13832
 
        module.exports = function (math) {
13833
 
          var util = __webpack_require__(160),
13834
 
 
13835
 
              Matrix = __webpack_require__(9),
 
14232
/* 103 */
 
14233
/***/ function(module, exports, __webpack_require__) {
 
14234
 
 
14235
        'use strict';
 
14236
 
 
14237
        module.exports = function (math) {
 
14238
          var util = __webpack_require__(171),
 
14239
 
 
14240
              Matrix = __webpack_require__(10),
 
14241
 
 
14242
              object = util.object,
 
14243
              string = util.string;
 
14244
 
 
14245
          /**
 
14246
           * Calculate the trace of a matrix: the sum of the elements on the main
 
14247
           * diagonal of a square matrix.
 
14248
           *
 
14249
           * Syntax:
 
14250
           *
 
14251
           *    math.trace(x)
 
14252
           *
 
14253
           * Examples:
 
14254
           *
 
14255
           *    math.trace([[1, 2], [3, 4]]); // returns 5
 
14256
           *
 
14257
           *    var A = [
 
14258
           *      [1, 2, 3],
 
14259
           *      [-1, 2, 3],
 
14260
           *      [2, 0, 3]
 
14261
           *    ]
 
14262
           *    math.trace(A); // returns 6
 
14263
           *
 
14264
           * See also:
 
14265
           *
 
14266
           *    diag
 
14267
           *
 
14268
           * @param {Array | Matrix} x  A matrix
 
14269
           * @return {Number} The trace of `x`
 
14270
           */
 
14271
          math.trace = function trace (x) {
 
14272
            if (arguments.length != 1) {
 
14273
              throw new math.error.ArgumentsError('trace', arguments.length, 1);
 
14274
            }
 
14275
 
 
14276
            var size;
 
14277
            if (x instanceof Matrix) {
 
14278
              size = x.size();
 
14279
            }
 
14280
            else if (x instanceof Array) {
 
14281
              x = new Matrix(x);
 
14282
              size = x.size();
 
14283
            }
 
14284
            else {
 
14285
              // a scalar
 
14286
              size = [];
 
14287
            }
 
14288
 
 
14289
            switch (size.length) {
 
14290
              case 0:
 
14291
                // scalar
 
14292
                return object.clone(x);
 
14293
 
 
14294
              case 1:
 
14295
                // vector
 
14296
                if (size[0] == 1) {
 
14297
                  return object.clone(x.valueOf()[0]);
 
14298
                }
 
14299
                else {
 
14300
                  throw new RangeError('Matrix must be square ' +
 
14301
                      '(size: ' + string.format(size) + ')');
 
14302
                }
 
14303
 
 
14304
              case 2:
 
14305
                // two dimensional array
 
14306
                var rows = size[0];
 
14307
                var cols = size[1];
 
14308
                if (rows == cols) {
 
14309
                  return _trace(x.clone().valueOf());
 
14310
                }
 
14311
                else {
 
14312
                  throw new RangeError('Matrix must be square ' +
 
14313
                      '(size: ' + string.format(size) + ')');
 
14314
                }
 
14315
 
 
14316
              default:
 
14317
                // multi dimensional array
 
14318
                throw new RangeError('Matrix must be two dimensional ' +
 
14319
                    '(size: ' + string.format(size) + ')');
 
14320
            }
 
14321
          };
 
14322
 
 
14323
          /**
 
14324
           * Calculate the trace of a matrix
 
14325
           * @param {Array[]} matrix  A square, two dimensional matrix
 
14326
           * @returns {Number} trace
 
14327
           * @private
 
14328
           */
 
14329
          function _trace (matrix) {
 
14330
            var sum = 0;
 
14331
            for (var i = 0; i < matrix.length; i++) {
 
14332
                sum = math.add(sum, matrix[i][i]);
 
14333
            }
 
14334
            return sum;
 
14335
          }
 
14336
        };
 
14337
 
 
14338
 
 
14339
/***/ },
 
14340
/* 104 */
 
14341
/***/ function(module, exports, __webpack_require__) {
 
14342
 
 
14343
        'use strict';
 
14344
 
 
14345
        module.exports = function (math) {
 
14346
          var util = __webpack_require__(171),
 
14347
 
 
14348
              Matrix = __webpack_require__(10),
13836
14349
 
13837
14350
              object = util.object,
13838
14351
              string = util.string;
13907
14420
 
13908
14421
 
13909
14422
/***/ },
13910
 
/* 102 */
 
14423
/* 105 */
13911
14424
/***/ function(module, exports, __webpack_require__) {
13912
14425
 
13913
14426
        'use strict';
13914
14427
 
13915
14428
        module.exports = function (math, config) {
13916
 
          var util = __webpack_require__(160),
 
14429
          var util = __webpack_require__(171),
13917
14430
 
13918
14431
              BigNumber = math.type.BigNumber,
13919
 
              Matrix = __webpack_require__(9),
13920
 
              collection = __webpack_require__(13),
 
14432
              Matrix = __webpack_require__(10),
 
14433
              collection = __webpack_require__(14),
13921
14434
 
13922
14435
              array = util.array,
13923
14436
              isArray = Array.isArray;
13983
14496
 
13984
14497
 
13985
14498
/***/ },
13986
 
/* 103 */
 
14499
/* 106 */
13987
14500
/***/ function(module, exports, __webpack_require__) {
13988
14501
 
13989
14502
        'use strict';
13990
14503
 
13991
 
        module.exports = function (math) {
13992
 
          var util = __webpack_require__(160),
 
14504
        module.exports = function (math, config) {
 
14505
          var util = __webpack_require__(171),
13993
14506
 
13994
14507
              BigNumber = math.type.BigNumber,
13995
 
              collection = __webpack_require__(13),
 
14508
              collection = __webpack_require__(14),
13996
14509
 
13997
14510
              isNumber = util.number.isNumber,
13998
14511
              isBoolean = util['boolean'].isBoolean,
14022
14535
           * @return {Number | BigNumber | Array | Matrix}    The factorial of `n`
14023
14536
           */
14024
14537
          math.factorial = function factorial (n) {
14025
 
            var value, res;
 
14538
            var value, res, preciseFacs;
14026
14539
 
14027
14540
            if (arguments.length != 1) {
14028
14541
              throw new math.error.ArgumentsError('factorial', arguments.length, 1);
14029
14542
            }
14030
14543
 
14031
14544
            if (isNumber(n)) {
14032
 
              return math.gamma(n + 1);
 
14545
              return n !== Number.POSITIVE_INFINITY
 
14546
                ? math.gamma(n + 1)
 
14547
                : Math.sqrt(2*Math.PI);
14033
14548
            }
14034
14549
 
14035
14550
            if (n instanceof BigNumber) {
14036
 
              if (!(isPositiveInteger(n)) && n.isFinite()) {
14037
 
                return math.gamma(n.plus(1));
14038
 
              }
14039
 
 
14040
 
              if (!n.isFinite()) {
14041
 
                return new BigNumber(n);
14042
 
              }
14043
 
 
14044
 
              n = n.toNumber();
14045
 
              if (n < fac.length) {
14046
 
                return (n < 21)
14047
 
                  ? new BigNumber(fac[n])
14048
 
                  : fac[n];
14049
 
              }
14050
 
 
14051
 
              var one = new BigNumber(1);
14052
 
              value = new BigNumber(fac.length);
14053
 
              res = fac[fac.length - 1];
14054
 
              for (var i = fac.length; i < n; ++i) {
14055
 
                res = res.times(value);
 
14551
              if (!(isNonNegativeInteger(n))) {
 
14552
                return n.isNegative() || n.isFinite()
 
14553
                  ? math.gamma(n.plus(1))
 
14554
                  : util.bignumber.tau(config.precision).sqrt();
 
14555
              }
 
14556
 
 
14557
              n = n.toNumber();   // should definitely be below Number.MAX_VALUE
 
14558
              if (n < smallBigFacs.length) {
 
14559
                return BigNumber.convert(smallBigFacs[n]).toSD(config.precision);
 
14560
              }
 
14561
 
 
14562
              // be wary of round-off errors
 
14563
              var precision = config.precision + (Math.log(n) | 0);
 
14564
              var Big = BigNumber.constructor({precision: precision});
 
14565
 
 
14566
              // adjust n do align with the precision specific tables
 
14567
              n -= smallBigFacs.length;
 
14568
              if (preciseFacs = bigBigFacs[precision]) {
 
14569
                if (preciseFacs[n]) {
 
14570
                  return new BigNumber(preciseFacs[n].toPrecision(config.precision));
 
14571
                }
 
14572
                res = preciseFacs[preciseFacs.length-1];
 
14573
              } else {
 
14574
                preciseFacs = bigBigFacs[precision] = [];
 
14575
                res = new Big(smallBigFacs[smallBigFacs.length-1])
 
14576
                  .toSD(precision);
 
14577
              }
 
14578
 
 
14579
              var one = new Big(1);
 
14580
              value = new Big(preciseFacs.length + smallBigFacs.length);
 
14581
              for (var i = preciseFacs.length; i < n; ++i) {
 
14582
                preciseFacs[i] = res = res.times(value);
14056
14583
                value = value.plus(one);
14057
 
                fac[i] = res;
14058
14584
              }
14059
14585
 
14060
 
              return fac[n] = res.times(value);
 
14586
              preciseFacs[n] = res.times(value);
 
14587
              return new BigNumber(preciseFacs[n].toPrecision(config.precision));
14061
14588
            }
14062
14589
 
14063
14590
            if (isBoolean(n) || n === null) {
14072
14599
          };
14073
14600
 
14074
14601
          /**
14075
 
           * Test whether BigNumber n is a positive integer
 
14602
           * Test whether BigNumber n is a non-negative integer
14076
14603
           * @param {BigNumber} n
14077
 
           * @returns {boolean} isPositiveInteger
 
14604
           * @returns {boolean} isNonNegativeInteger
14078
14605
           */
14079
 
          var isPositiveInteger = function(n) {
 
14606
          var isNonNegativeInteger = function(n) {
14080
14607
            return n.isInteger() && (!n.isNegative() || n.isZero());
14081
14608
          };
14082
14609
 
14083
 
          // 0-21! values
14084
 
          var fac = [
 
14610
          // 21! >= values for each precision
 
14611
          var bigBigFacs = [];
 
14612
 
 
14613
          // 0-20! values
 
14614
          var smallBigFacs = [
14085
14615
            1,
14086
14616
            1,
14087
14617
            2,
14102
14632
            355687428096000,
14103
14633
            6402373705728000,
14104
14634
            121645100408832000,
14105
 
            2432902008176640000,
14106
 
            new BigNumber('51090942171709440000')
 
14635
            2432902008176640000
14107
14636
          ]
14108
14637
        };
14109
14638
 
14110
14639
 
14111
14640
/***/ },
14112
 
/* 104 */
 
14641
/* 107 */
14113
14642
/***/ function(module, exports, __webpack_require__) {
14114
14643
 
14115
14644
        'use strict';
14116
14645
 
14117
14646
        module.exports = function (math, config) {
14118
 
          var util = __webpack_require__(160),
 
14647
          var util = __webpack_require__(171),
14119
14648
 
14120
14649
              BigNumber = math.type.BigNumber,
14121
 
              Complex = __webpack_require__(6),
14122
 
              collection = __webpack_require__(13),
 
14650
              Complex = __webpack_require__(7),
 
14651
              collection = __webpack_require__(14),
14123
14652
 
14124
14653
              isBoolean = util['boolean'].isBoolean,
14125
14654
              isComplex = Complex.isComplex,
14303
14832
 
14304
14833
 
14305
14834
/***/ },
14306
 
/* 105 */
 
14835
/* 108 */
14307
14836
/***/ function(module, exports, __webpack_require__) {
14308
14837
 
14309
14838
        'use strict';
14310
14839
 
14311
14840
        module.exports = function (math) {
14312
 
          var distribution = __webpack_require__(194)(math);
 
14841
          var distribution = __webpack_require__(333)(math);
14313
14842
 
14314
14843
          /**
14315
14844
           * Return a random number larger or equal to `min` and smaller than `max`
14346
14875
 
14347
14876
 
14348
14877
/***/ },
14349
 
/* 106 */
 
14878
/* 109 */
14350
14879
/***/ function(module, exports, __webpack_require__) {
14351
14880
 
14352
14881
        'use strict';
14353
14882
 
14354
14883
        module.exports = function (math) {
14355
 
          var distribution = __webpack_require__(194)(math);
 
14884
          var distribution = __webpack_require__(333)(math);
14356
14885
 
14357
14886
          /**
14358
14887
           * Return a random integer number larger or equal to `min` and smaller than `max`
14389
14918
 
14390
14919
 
14391
14920
/***/ },
14392
 
/* 107 */
 
14921
/* 110 */
14393
14922
/***/ function(module, exports, __webpack_require__) {
14394
14923
 
14395
14924
        'use strict';
14396
14925
 
14397
14926
        module.exports = function (math) {
14398
 
          var distribution = __webpack_require__(194)(math);
 
14927
          var distribution = __webpack_require__(333)(math);
14399
14928
 
14400
14929
          /**
14401
14930
           * Random pick a value from a one dimensional array.
14421
14950
 
14422
14951
 
14423
14952
/***/ },
14424
 
/* 108 */
 
14953
/* 111 */
14425
14954
/***/ function(module, exports, __webpack_require__) {
14426
14955
 
14427
14956
        'use strict';
14428
14957
 
14429
14958
        module.exports = function (math) {
14430
 
          var util = __webpack_require__(160),
 
14959
          var util = __webpack_require__(171),
14431
14960
 
14432
14961
              BigNumber = math.type.BigNumber,
14433
14962
 
14534
15063
 
14535
15064
 
14536
15065
/***/ },
14537
 
/* 109 */
 
15066
/* 112 */
14538
15067
/***/ function(module, exports, __webpack_require__) {
14539
15068
 
14540
15069
        'use strict';
14541
15070
 
14542
15071
        module.exports = function (math) {
14543
 
          var util = __webpack_require__(160),
 
15072
          var util = __webpack_require__(171),
14544
15073
 
14545
15074
              BigNumber = math.type.BigNumber,
14546
 
              collection = __webpack_require__(13),
 
15075
              collection = __webpack_require__(14),
14547
15076
 
14548
15077
              isNumber = util.number.isNumber,
14549
15078
              isInteger = util.number.isInteger;
14631
15160
 
14632
15161
 
14633
15162
/***/ },
14634
 
/* 110 */
 
15163
/* 113 */
14635
15164
/***/ function(module, exports, __webpack_require__) {
14636
15165
 
14637
15166
        'use strict';
14638
15167
 
14639
15168
        module.exports = function (math, config) {
14640
 
          var util = __webpack_require__(160),
 
15169
          var util = __webpack_require__(171),
14641
15170
 
14642
15171
              BigNumber = math.type.BigNumber,
14643
 
              Complex = __webpack_require__(6),
14644
 
              Unit = __webpack_require__(10),
14645
 
              collection = __webpack_require__(13),
 
15172
              Complex = __webpack_require__(7),
 
15173
              Unit = __webpack_require__(11),
 
15174
              collection = __webpack_require__(14),
14646
15175
 
14647
15176
              isNumber = util.number.isNumber,
14648
15177
              nearlyEqual = util.number.nearlyEqual,
14761
15290
 
14762
15291
 
14763
15292
/***/ },
14764
 
/* 111 */
 
15293
/* 114 */
14765
15294
/***/ function(module, exports, __webpack_require__) {
14766
15295
 
14767
15296
        'use strict';
14768
15297
 
14769
15298
        module.exports = function (math) {
14770
 
          var collection = __webpack_require__(13),
 
15299
          var collection = __webpack_require__(14),
14771
15300
 
14772
15301
              isCollection = collection.isCollection,
14773
15302
              isArray = Array.isArray;
14846
15375
 
14847
15376
 
14848
15377
/***/ },
14849
 
/* 112 */
 
15378
/* 115 */
14850
15379
/***/ function(module, exports, __webpack_require__) {
14851
15380
 
14852
15381
        'use strict';
14853
15382
 
14854
15383
        module.exports = function (math, config) {
14855
 
          var util = __webpack_require__(160),
 
15384
          var util = __webpack_require__(171),
14856
15385
 
14857
15386
              BigNumber = math.type.BigNumber,
14858
 
              Complex = __webpack_require__(6),
14859
 
              Unit = __webpack_require__(10),
14860
 
              collection = __webpack_require__(13),
 
15387
              Complex = __webpack_require__(7),
 
15388
              Unit = __webpack_require__(11),
 
15389
              collection = __webpack_require__(14),
14861
15390
 
14862
15391
              isNumber = util.number.isNumber,
14863
15392
              nearlyEqual = util.number.nearlyEqual,
15010
15539
 
15011
15540
 
15012
15541
/***/ },
15013
 
/* 113 */
 
15542
/* 116 */
15014
15543
/***/ function(module, exports, __webpack_require__) {
15015
15544
 
15016
15545
        'use strict';
15017
15546
 
15018
15547
        module.exports = function (math, config) {
15019
 
          var util = __webpack_require__(160),
 
15548
          var util = __webpack_require__(171),
15020
15549
 
15021
15550
              BigNumber = math.type.BigNumber,
15022
 
              Complex = __webpack_require__(6),
15023
 
              Unit = __webpack_require__(10),
15024
 
              collection = __webpack_require__(13),
 
15551
              Complex = __webpack_require__(7),
 
15552
              Unit = __webpack_require__(11),
 
15553
              collection = __webpack_require__(14),
15025
15554
 
15026
15555
              isNumber = util.number.isNumber,
15027
15556
              nearlyEqual = util.number.nearlyEqual,
15137
15666
 
15138
15667
 
15139
15668
/***/ },
15140
 
/* 114 */
 
15669
/* 117 */
15141
15670
/***/ function(module, exports, __webpack_require__) {
15142
15671
 
15143
15672
        'use strict';
15144
15673
 
15145
15674
        module.exports = function (math, config) {
15146
 
          var util = __webpack_require__(160),
 
15675
          var util = __webpack_require__(171),
15147
15676
 
15148
15677
              BigNumber = math.type.BigNumber,
15149
 
              Complex = __webpack_require__(6),
15150
 
              Unit = __webpack_require__(10),
15151
 
              collection = __webpack_require__(13),
 
15678
              Complex = __webpack_require__(7),
 
15679
              Unit = __webpack_require__(11),
 
15680
              collection = __webpack_require__(14),
15152
15681
 
15153
15682
              isNumber = util.number.isNumber,
15154
15683
              nearlyEqual = util.number.nearlyEqual,
15265
15794
 
15266
15795
 
15267
15796
/***/ },
15268
 
/* 115 */
 
15797
/* 118 */
15269
15798
/***/ function(module, exports, __webpack_require__) {
15270
15799
 
15271
15800
        'use strict';
15272
15801
 
15273
15802
        module.exports = function (math, config) {
15274
 
          var util = __webpack_require__(160),
 
15803
          var util = __webpack_require__(171),
15275
15804
 
15276
15805
              BigNumber = math.type.BigNumber,
15277
 
              Complex = __webpack_require__(6),
15278
 
              Unit = __webpack_require__(10),
15279
 
              collection = __webpack_require__(13),
 
15806
              Complex = __webpack_require__(7),
 
15807
              Unit = __webpack_require__(11),
 
15808
              collection = __webpack_require__(14),
15280
15809
 
15281
15810
              isNumber = util.number.isNumber,
15282
15811
              nearlyEqual = util.number.nearlyEqual,
15392
15921
 
15393
15922
 
15394
15923
/***/ },
15395
 
/* 116 */
 
15924
/* 119 */
15396
15925
/***/ function(module, exports, __webpack_require__) {
15397
15926
 
15398
15927
        'use strict';
15399
15928
 
15400
15929
        module.exports = function (math, config) {
15401
 
          var util = __webpack_require__(160),
 
15930
          var util = __webpack_require__(171),
15402
15931
 
15403
15932
              BigNumber = math.type.BigNumber,
15404
 
              Complex = __webpack_require__(6),
15405
 
              Unit = __webpack_require__(10),
15406
 
              collection = __webpack_require__(13),
 
15933
              Complex = __webpack_require__(7),
 
15934
              Unit = __webpack_require__(11),
 
15935
              collection = __webpack_require__(14),
15407
15936
 
15408
15937
              isNumber = util.number.isNumber,
15409
15938
              nearlyEqual = util.number.nearlyEqual,
15519
16048
 
15520
16049
 
15521
16050
/***/ },
15522
 
/* 117 */
 
16051
/* 120 */
15523
16052
/***/ function(module, exports, __webpack_require__) {
15524
16053
 
15525
16054
        'use strict';
15526
16055
 
15527
16056
        module.exports = function (math, config) {
15528
 
          var util = __webpack_require__(160),
 
16057
          var util = __webpack_require__(171),
15529
16058
 
15530
16059
              BigNumber = math.type.BigNumber,
15531
 
              Complex = __webpack_require__(6),
15532
 
              Unit = __webpack_require__(10),
15533
 
              collection = __webpack_require__(13),
 
16060
              Complex = __webpack_require__(7),
 
16061
              Unit = __webpack_require__(11),
 
16062
              collection = __webpack_require__(14),
15534
16063
 
15535
16064
              isNumber = util.number.isNumber,
15536
16065
              nearlyEqual = util.number.nearlyEqual,
15682
16211
 
15683
16212
 
15684
16213
/***/ },
15685
 
/* 118 */
 
16214
/* 121 */
15686
16215
/***/ function(module, exports, __webpack_require__) {
15687
16216
 
15688
16217
        'use strict';
15689
16218
 
15690
16219
        module.exports = function (math) {
15691
 
          var Matrix = __webpack_require__(9),
15692
 
              collection = __webpack_require__(13),
 
16220
          var Matrix = __webpack_require__(10),
 
16221
              collection = __webpack_require__(14),
15693
16222
 
15694
16223
              isCollection = collection.isCollection;
15695
16224
 
15777
16306
 
15778
16307
 
15779
16308
/***/ },
15780
 
/* 119 */
 
16309
/* 122 */
15781
16310
/***/ function(module, exports, __webpack_require__) {
15782
16311
 
15783
16312
        'use strict';
15784
16313
 
15785
16314
        module.exports = function (math) {
15786
 
          var Matrix = __webpack_require__(9),
15787
 
              collection = __webpack_require__(13),
 
16315
          var Matrix = __webpack_require__(10),
 
16316
              collection = __webpack_require__(14),
15788
16317
 
15789
16318
              isCollection = collection.isCollection;
15790
16319
 
15872
16401
 
15873
16402
 
15874
16403
/***/ },
15875
 
/* 120 */
 
16404
/* 123 */
15876
16405
/***/ function(module, exports, __webpack_require__) {
15877
16406
 
15878
16407
        'use strict';
15879
16408
 
15880
16409
        module.exports = function (math) {
15881
 
          var Matrix = __webpack_require__(9),
15882
 
              collection = __webpack_require__(13),
 
16410
          var Matrix = __webpack_require__(10),
 
16411
              collection = __webpack_require__(14),
15883
16412
 
15884
16413
              isCollection = collection.isCollection,
15885
16414
 
15886
 
              size = __webpack_require__(153).size,
 
16415
              size = __webpack_require__(165).size,
15887
16416
              isArray = Array.isArray;
15888
16417
 
15889
16418
          /**
15976
16505
 
15977
16506
 
15978
16507
/***/ },
15979
 
/* 121 */
 
16508
/* 124 */
15980
16509
/***/ function(module, exports, __webpack_require__) {
15981
16510
 
15982
16511
        'use strict';
15983
16512
 
15984
16513
        module.exports = function (math) {
15985
 
          var Matrix = __webpack_require__(9),
15986
 
              Unit = __webpack_require__(10),
 
16514
          var Matrix = __webpack_require__(10),
 
16515
              Unit = __webpack_require__(11),
15987
16516
              BigNumber = math.type.BigNumber,
15988
 
              collection = __webpack_require__(13),
 
16517
              collection = __webpack_require__(14),
15989
16518
 
15990
 
              isNumber = __webpack_require__(4).isNumber,
 
16519
              isNumber = __webpack_require__(3).isNumber,
15991
16520
              isCollection = collection.isCollection,
15992
16521
 
15993
 
              flatten = __webpack_require__(153).flatten;
 
16522
              flatten = __webpack_require__(165).flatten;
15994
16523
 
15995
16524
          /**
15996
16525
           * Compute the median of a matrix or a list with values. The values are
16090
16619
 
16091
16620
 
16092
16621
/***/ },
16093
 
/* 122 */
 
16622
/* 125 */
16094
16623
/***/ function(module, exports, __webpack_require__) {
16095
16624
 
16096
16625
        'use strict';
16097
16626
 
16098
16627
        module.exports = function (math) {
16099
 
          var Matrix = __webpack_require__(9),
16100
 
              collection = __webpack_require__(13),
 
16628
          var Matrix = __webpack_require__(10),
 
16629
              collection = __webpack_require__(14),
16101
16630
 
16102
16631
              isCollection = collection.isCollection;
16103
16632
 
16175
16704
 
16176
16705
 
16177
16706
/***/ },
16178
 
/* 123 */
 
16707
/* 126 */
16179
16708
/***/ function(module, exports, __webpack_require__) {
16180
16709
 
16181
16710
        'use strict';
16235
16764
 
16236
16765
 
16237
16766
/***/ },
16238
 
/* 124 */
 
16767
/* 127 */
16239
16768
/***/ function(module, exports, __webpack_require__) {
16240
16769
 
16241
16770
        'use strict';
16242
16771
 
16243
16772
        module.exports = function (math) {
16244
 
          var Matrix = __webpack_require__(9),
16245
 
              collection = __webpack_require__(13),
 
16773
          var Matrix = __webpack_require__(10),
 
16774
              collection = __webpack_require__(14),
16246
16775
 
16247
16776
              isCollection = collection.isCollection;
16248
16777
 
16318
16847
 
16319
16848
 
16320
16849
/***/ },
16321
 
/* 125 */
 
16850
/* 128 */
16322
16851
/***/ function(module, exports, __webpack_require__) {
16323
16852
 
16324
16853
        'use strict';
16325
16854
 
16326
16855
        module.exports = function (math) {
16327
 
          var Matrix = __webpack_require__(9),
 
16856
          var Matrix = __webpack_require__(10),
16328
16857
              BigNumber = math.type.BigNumber,
16329
 
              collection = __webpack_require__(13),
 
16858
              collection = __webpack_require__(14),
16330
16859
 
16331
16860
              isCollection = collection.isCollection,
16332
 
              isString = __webpack_require__(176).isString,
 
16861
              isString = __webpack_require__(205).isString,
16333
16862
 
16334
16863
              DEFAULT_NORMALIZATION = 'unbiased';
16335
16864
 
16462
16991
 
16463
16992
 
16464
16993
/***/ },
16465
 
/* 126 */
 
16994
/* 129 */
16466
16995
/***/ function(module, exports, __webpack_require__) {
16467
16996
 
16468
16997
        'use strict';
16469
16998
 
16470
16999
        module.exports = function (math) {
16471
 
          var util = __webpack_require__(160),
 
17000
          var util = __webpack_require__(171),
16472
17001
 
16473
17002
              BigNumber = math.type.BigNumber,
16474
 
              Complex = __webpack_require__(6),
16475
 
              collection = __webpack_require__(13),
 
17003
              Complex = __webpack_require__(7),
 
17004
              collection = __webpack_require__(14),
16476
17005
 
16477
17006
              isNumber = util.number.isNumber,
16478
17007
              isBoolean = util['boolean'].isBoolean,
16479
17008
              isComplex = Complex.isComplex,
16480
 
              isCollection = collection.isCollection;
 
17009
              isCollection = collection.isCollection,
 
17010
 
 
17011
              bigArcCos = util.bignumber.arccos_arcsec;
16481
17012
 
16482
17013
          /**
16483
17014
           * Calculate the inverse cosine of a value.
16499
17030
           *
16500
17031
           *    cos, atan, asin
16501
17032
           *
16502
 
           * @param {Number | Boolean | Complex | Array | Matrix | null} x  Function input
16503
 
           * @return {Number | Complex | Array | Matrix} The arc cosine of x
 
17033
           * @param {Number | BigNumber Boolean | Complex | Array | Matrix | null} x  Function input
 
17034
           * @return {Number | BigNumber | Complex | Array | Matrix} The arc cosine of x
16504
17035
           */
16505
17036
          math.acos = function acos(x) {
16506
17037
            if (arguments.length != 1) {
16545
17076
            }
16546
17077
 
16547
17078
            if (x instanceof BigNumber) {
16548
 
              // TODO: implement BigNumber support
16549
 
              // downgrade to Number
16550
 
              return acos(x.toNumber());
 
17079
              return bigArcCos(x, BigNumber, false);
16551
17080
            }
16552
17081
 
16553
17082
            throw new math.error.UnsupportedTypeError('acos', math['typeof'](x));
16556
17085
 
16557
17086
 
16558
17087
/***/ },
16559
 
/* 127 */
16560
 
/***/ function(module, exports, __webpack_require__) {
16561
 
 
16562
 
        'use strict';
16563
 
 
16564
 
        module.exports = function (math) {
16565
 
          var util = __webpack_require__(160),
16566
 
 
16567
 
              BigNumber = math.type.BigNumber,
16568
 
              Complex = __webpack_require__(6),
16569
 
              collection = __webpack_require__(13),
16570
 
 
16571
 
              isNumber = util.number.isNumber,
16572
 
              isBoolean = util['boolean'].isBoolean,
16573
 
              isComplex = Complex.isComplex,
16574
 
              isCollection = collection.isCollection;
 
17088
/* 130 */
 
17089
/***/ function(module, exports, __webpack_require__) {
 
17090
 
 
17091
        'use strict';
 
17092
 
 
17093
        module.exports = function (math) {
 
17094
          var util = __webpack_require__(171),
 
17095
 
 
17096
              BigNumber = math.type.BigNumber,
 
17097
              Complex = __webpack_require__(7),
 
17098
              Unit = __webpack_require__(11),
 
17099
              collection = __webpack_require__(14),
 
17100
 
 
17101
              isNumber = util.number.isNumber,
 
17102
              isBoolean = util['boolean'].isBoolean,
 
17103
              isComplex = Complex.isComplex,
 
17104
              isUnit = Unit.isUnit,
 
17105
              isCollection = collection.isCollection,
 
17106
 
 
17107
              bigAcosh = util.bignumber.acosh_asinh_asech_acsch;
 
17108
 
 
17109
          /**
 
17110
           * Calculate the hyperbolic arccos of a value,
 
17111
           * defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.
 
17112
           *
 
17113
           * For matrices, the function is evaluated element wise.
 
17114
           *
 
17115
           * Syntax:
 
17116
           *
 
17117
           *    math.acosh(x)
 
17118
           *
 
17119
           * Examples:
 
17120
           *
 
17121
           *    math.acosh(1.5);       // returns 0.9624236501192069
 
17122
           *
 
17123
           * See also:
 
17124
           *
 
17125
           *    cosh, asinh, atanh
 
17126
           *
 
17127
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
17128
           * @return {Number | Complex | Array | Matrix} Hyperbolic arccosine of x
 
17129
           */
 
17130
          math.acosh = function acosh(x) {
 
17131
            if (arguments.length != 1) {
 
17132
              throw new math.error.ArgumentsError('acosh', arguments.length, 1);
 
17133
            }
 
17134
 
 
17135
            if (isNumber(x)) {
 
17136
              if (x >= 1) {
 
17137
                return Math.log(Math.sqrt(x*x - 1) + x);
 
17138
              }
 
17139
              if (x <= -1) {
 
17140
                return new Complex(Math.log(Math.sqrt(x*x - 1) - x), Math.PI);
 
17141
              }
 
17142
              return acosh(new Complex(x, 0));
 
17143
            }
 
17144
 
 
17145
            if (isComplex(x)) {
 
17146
              // acosh(z) = (-acos(z).im,  acos(z).re)   for acos(z).im <= 0
 
17147
              //            ( acos(z).im, -acos(z).re)   otherwise
 
17148
              var temp;
 
17149
              var acos = math.acos(x);
 
17150
              if (acos.im <= 0) {
 
17151
                temp = acos.re;
 
17152
                acos.re = -acos.im;
 
17153
                acos.im = temp;
 
17154
              } else {
 
17155
                temp = acos.im;
 
17156
                acos.im = -acos.re;
 
17157
                acos.re = temp;
 
17158
              }
 
17159
 
 
17160
              return acos;
 
17161
            }
 
17162
 
 
17163
            if (isCollection(x)) {
 
17164
              return collection.deepMap(x, acosh);
 
17165
            }
 
17166
 
 
17167
            if (isBoolean(x) || x === null) {
 
17168
              return (x) ? 0 : new Complex(0, 1.5707963267948966);
 
17169
            }
 
17170
 
 
17171
            if (x instanceof BigNumber) {
 
17172
              return bigAcosh(x, BigNumber, false, false);
 
17173
            }
 
17174
 
 
17175
            throw new math.error.UnsupportedTypeError('acosh', math['typeof'](x));
 
17176
          };
 
17177
        };
 
17178
 
 
17179
 
 
17180
/***/ },
 
17181
/* 131 */
 
17182
/***/ function(module, exports, __webpack_require__) {
 
17183
 
 
17184
        'use strict';
 
17185
 
 
17186
        module.exports = function (math) {
 
17187
          var util = __webpack_require__(171),
 
17188
 
 
17189
              BigNumber = math.type.BigNumber,
 
17190
              Complex = __webpack_require__(7),
 
17191
              collection = __webpack_require__(14),
 
17192
 
 
17193
              isNumber = util.number.isNumber,
 
17194
              isBoolean = util['boolean'].isBoolean,
 
17195
              isComplex = Complex.isComplex,
 
17196
              isCollection = collection.isCollection,
 
17197
 
 
17198
              bigArcCot = util.bignumber.arctan_arccot;
 
17199
 
 
17200
          /**
 
17201
           * Calculate the inverse cotangent of a value.
 
17202
           *
 
17203
           * For matrices, the function is evaluated element wise.
 
17204
           *
 
17205
           * Syntax:
 
17206
           *
 
17207
           *    math.acot(x)
 
17208
           *
 
17209
           * Examples:
 
17210
           *
 
17211
           *    math.acot(0.5);           // returns Number 0.4636476090008061
 
17212
           *    math.acot(math.cot(1.5)); // returns Number 1.5
 
17213
           *
 
17214
           *    math.acot(2);             // returns Complex 1.5707963267948966 -1.3169578969248166 i
 
17215
           *
 
17216
           * See also:
 
17217
           *
 
17218
           *    cot, atan
 
17219
           *
 
17220
           * @param {Number | Boolean | Complex | Array | Matrix | null} x   Function input
 
17221
           * @return {Number | Complex | Array | Matrix} The arc cotangent of x
 
17222
           */
 
17223
          math.acot = function acot(x) {
 
17224
            if (arguments.length != 1) {
 
17225
              throw new math.error.ArgumentsError('acot', arguments.length, 1);
 
17226
            }
 
17227
 
 
17228
            if (isNumber(x)) {
 
17229
              return (x) ? Math.atan(1 / x) : halfPi;
 
17230
            }
 
17231
 
 
17232
            if (isComplex(x)) {
 
17233
              if (x.im == 0) {
 
17234
                return new Complex(x.re ? Math.atan(1 / x.re) : halfPi, 0);
 
17235
              }
 
17236
 
 
17237
              var den = x.re*x.re + x.im*x.im;
 
17238
              x = (den != 0)
 
17239
                ? new Complex(
 
17240
                    x.re =  x.re / den,
 
17241
                    x.im = -x.im / den)
 
17242
                : new Complex(
 
17243
                    (x.re != 0) ?  (x.re / 0) : 0,
 
17244
                    (x.im != 0) ? -(x.im / 0) : 0);
 
17245
 
 
17246
              return math.atan(x);
 
17247
            }
 
17248
 
 
17249
            if (isCollection(x)) {
 
17250
              return collection.deepMap(x, acot);
 
17251
            }
 
17252
 
 
17253
            if (isBoolean(x) || x === null) {
 
17254
              return (x) ? 0.7853981633974483 : halfPi;
 
17255
            }
 
17256
 
 
17257
            if (x instanceof BigNumber) {
 
17258
              return bigArcCot(x, BigNumber, true);
 
17259
            }
 
17260
 
 
17261
            throw new math.error.UnsupportedTypeError('acot', math['typeof'](x));
 
17262
          };
 
17263
 
 
17264
          var halfPi = 1.5707963267948966;
 
17265
        };
 
17266
 
 
17267
 
 
17268
/***/ },
 
17269
/* 132 */
 
17270
/***/ function(module, exports, __webpack_require__) {
 
17271
 
 
17272
        'use strict';
 
17273
 
 
17274
        module.exports = function (math) {
 
17275
          var util = __webpack_require__(171),
 
17276
 
 
17277
              BigNumber = math.type.BigNumber,
 
17278
              Complex = __webpack_require__(7),
 
17279
              Unit = __webpack_require__(11),
 
17280
              collection = __webpack_require__(14),
 
17281
 
 
17282
              isNumber = util.number.isNumber,
 
17283
              isBoolean = util['boolean'].isBoolean,
 
17284
              isComplex = Complex.isComplex,
 
17285
              isUnit = Unit.isUnit,
 
17286
              isCollection = collection.isCollection,
 
17287
 
 
17288
              bigAcoth = util.bignumber.atanh_acoth;
 
17289
 
 
17290
          /**
 
17291
           * Calculate the hyperbolic arccotangent of a value,
 
17292
           * defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.
 
17293
           *
 
17294
           * For matrices, the function is evaluated element wise.
 
17295
           *
 
17296
           * Syntax:
 
17297
           *
 
17298
           *    math.acoth(x)
 
17299
           *
 
17300
           * Examples:
 
17301
           *
 
17302
           *    math.acoth(0.5);       // returns 0.8047189562170503
 
17303
           *
 
17304
           * See also:
 
17305
           *
 
17306
           *    acsch, asech
 
17307
           *
 
17308
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
17309
           * @return {Number | Complex | Array | Matrix} Hyperbolic arccotangent of x
 
17310
           */
 
17311
          math.acoth = function acoth(x) {
 
17312
            if (arguments.length != 1) {
 
17313
              throw new math.error.ArgumentsError('acoth', arguments.length, 1);
 
17314
            }
 
17315
 
 
17316
            if (isNumber(x)) {
 
17317
              if (x >= 1 || x <= -1) {
 
17318
                return isFinite(x) ? (Math.log((x+1)/x) + Math.log(x/(x-1))) / 2 : 0;
 
17319
              }
 
17320
              return (x) ? acoth(new Complex(x, 0)) : new Complex(0, halfPi);
 
17321
            }
 
17322
 
 
17323
            if (isComplex(x)) {
 
17324
              if (x.re == 0 && x.im == 0) {
 
17325
                return new Complex(0, halfPi);
 
17326
              }
 
17327
 
 
17328
              // acoth(z) = -i*atanh(1/z)
 
17329
              var den = x.re*x.re + x.im*x.im;
 
17330
              x = (den != 0)
 
17331
                ? new Complex(
 
17332
                    x.re / den,
 
17333
                   -x.im / den
 
17334
                  )
 
17335
                : new Complex(
 
17336
                    (x.re != 0) ?  (x.re / 0) : 0,
 
17337
                    (x.im != 0) ? -(x.im / 0) : 0
 
17338
                  );
 
17339
 
 
17340
              return math.atanh(x);
 
17341
            }
 
17342
 
 
17343
            if (isCollection(x)) {
 
17344
              return collection.deepMap(x, acoth);
 
17345
            }
 
17346
 
 
17347
            if (isBoolean(x) || x === null) {
 
17348
              return (x) ? Infinity : new Complex(0, halfPi);
 
17349
            }
 
17350
 
 
17351
            if (x instanceof BigNumber) {
 
17352
              return bigAcoth(x, BigNumber, true);
 
17353
            }
 
17354
 
 
17355
            throw new math.error.UnsupportedTypeError('acoth', math['typeof'](x));
 
17356
          };
 
17357
 
 
17358
          var halfPi = 1.5707963267948966;
 
17359
        };
 
17360
 
 
17361
 
 
17362
/***/ },
 
17363
/* 133 */
 
17364
/***/ function(module, exports, __webpack_require__) {
 
17365
 
 
17366
        'use strict';
 
17367
 
 
17368
        module.exports = function (math) {
 
17369
          var util = __webpack_require__(171),
 
17370
 
 
17371
              BigNumber = math.type.BigNumber,
 
17372
              Complex = __webpack_require__(7),
 
17373
              collection = __webpack_require__(14),
 
17374
 
 
17375
              isNumber = util.number.isNumber,
 
17376
              isBoolean = util['boolean'].isBoolean,
 
17377
              isComplex = Complex.isComplex,
 
17378
              isCollection = collection.isCollection,
 
17379
 
 
17380
              bigArcCsc = util.bignumber.arcsin_arccsc;
 
17381
 
 
17382
          /**
 
17383
           * Calculate the inverse cosecant of a value.
 
17384
           *
 
17385
           * For matrices, the function is evaluated element wise.
 
17386
           *
 
17387
           * Syntax:
 
17388
           *
 
17389
           *    math.acsc(x)
 
17390
           *
 
17391
           * Examples:
 
17392
           *
 
17393
           *    math.acsc(0.5);           // returns Number 0.5235987755982989
 
17394
           *    math.acsc(math.csc(1.5)); // returns Number ~1.5
 
17395
           *
 
17396
           *    math.acsc(2);             // returns Complex 1.5707963267948966 -1.3169578969248166 i
 
17397
           *
 
17398
           * See also:
 
17399
           *
 
17400
           *    csc, asin, asec
 
17401
           *
 
17402
           * @param {Number | Boolean | Complex | Array | Matrix | null} x   Function input
 
17403
           * @return {Number | Complex | Array | Matrix} The arc cosecant of x
 
17404
           */
 
17405
          math.acsc = function acsc(x) {
 
17406
            if (arguments.length != 1) {
 
17407
              throw new math.error.ArgumentsError('acsc', arguments.length, 1);
 
17408
            }
 
17409
 
 
17410
            if (isNumber(x)) {
 
17411
              if (x <= -1 || x >= 1) {
 
17412
                return Math.asin(1 / x);
 
17413
              }
 
17414
              return acsc(new Complex(x, 0));
 
17415
            }
 
17416
 
 
17417
            if (isComplex(x)) {
 
17418
              if (x.re == 0 && x.im == 0) {
 
17419
                return new Complex(halfPi, Infinity);
 
17420
              }
 
17421
 
 
17422
              var den = x.re*x.re + x.im*x.im;
 
17423
              x = (den != 0)
 
17424
                ? new Complex(
 
17425
                    x.re =  x.re / den,
 
17426
                    x.im = -x.im / den)
 
17427
                : new Complex(
 
17428
                    (x.re != 0) ?  (x.re / 0) : 0,
 
17429
                    (x.im != 0) ? -(x.im / 0) : 0);
 
17430
 
 
17431
              return math.asin(x);
 
17432
            }
 
17433
 
 
17434
            if (isCollection(x)) {
 
17435
              return collection.deepMap(x, acsc);
 
17436
            }
 
17437
 
 
17438
            if (isBoolean(x) || x === null) {
 
17439
              return (x) ? halfPi : new Complex(halfPi, Infinity);
 
17440
            }
 
17441
 
 
17442
            if (x instanceof BigNumber) {
 
17443
              return bigArcCsc(x, BigNumber, true);
 
17444
            }
 
17445
 
 
17446
            throw new math.error.UnsupportedTypeError('acsc', math['typeof'](x));
 
17447
          };
 
17448
 
 
17449
          var halfPi = 1.5707963267948966;
 
17450
        };
 
17451
 
 
17452
 
 
17453
/***/ },
 
17454
/* 134 */
 
17455
/***/ function(module, exports, __webpack_require__) {
 
17456
 
 
17457
        'use strict';
 
17458
 
 
17459
        module.exports = function (math) {
 
17460
          var util = __webpack_require__(171),
 
17461
 
 
17462
              BigNumber = math.type.BigNumber,
 
17463
              Complex = __webpack_require__(7),
 
17464
              Unit = __webpack_require__(11),
 
17465
              collection = __webpack_require__(14),
 
17466
 
 
17467
              isNumber = util.number.isNumber,
 
17468
              isBoolean = util['boolean'].isBoolean,
 
17469
              isComplex = Complex.isComplex,
 
17470
              isUnit = Unit.isUnit,
 
17471
              isCollection = collection.isCollection,
 
17472
 
 
17473
              bigAcsch = util.bignumber.acosh_asinh_asech_acsch;
 
17474
 
 
17475
          /**
 
17476
           * Calculate the hyperbolic arccosecant of a value,
 
17477
           * defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.
 
17478
           *
 
17479
           * For matrices, the function is evaluated element wise.
 
17480
           *
 
17481
           * Syntax:
 
17482
           *
 
17483
           *    math.acsch(x)
 
17484
           *
 
17485
           * Examples:
 
17486
           *
 
17487
           *    math.acsch(0.5);       // returns 1.4436354751788103
 
17488
           *
 
17489
           * See also:
 
17490
           *
 
17491
           *    asech, acoth
 
17492
           *
 
17493
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
17494
           * @return {Number | Complex | Array | Matrix} Hyperbolic arccosecant of x
 
17495
           */
 
17496
          math.acsch = function acsch(x) {
 
17497
            if (arguments.length != 1) {
 
17498
              throw new math.error.ArgumentsError('acsch', arguments.length, 1);
 
17499
            }
 
17500
 
 
17501
            if (isNumber(x)) {
 
17502
              x = 1 / x;
 
17503
              return Math.log(x + Math.sqrt(x*x + 1));
 
17504
            }
 
17505
 
 
17506
            if (isComplex(x)) {
 
17507
              if (x.im == 0) {
 
17508
                x = (x.re != 0)
 
17509
                  ? Math.log(x.re + Math.sqrt(x.re*x.re + 1))
 
17510
                  : Infinity;
 
17511
                return new Complex(x, 0);
 
17512
              }
 
17513
 
 
17514
              // acsch(z) = -i*asinh(1/z)
 
17515
              var den = x.re*x.re + x.im*x.im;
 
17516
              x = (den != 0)
 
17517
                ? new Complex(
 
17518
                    x.re / den,
 
17519
                   -x.im / den
 
17520
                  )
 
17521
                : new Complex(
 
17522
                    (x.re != 0) ?  (x.re / 0) : 0,
 
17523
                    (x.im != 0) ? -(x.im / 0) : 0
 
17524
                  );
 
17525
 
 
17526
              return math.asinh(x);
 
17527
            }
 
17528
 
 
17529
            if (isCollection(x)) {
 
17530
              return collection.deepMap(x, acsch);
 
17531
            }
 
17532
 
 
17533
            if (isBoolean(x) || x === null) {
 
17534
              return (x) ? 0.881373587019543 : Infinity;
 
17535
            }
 
17536
 
 
17537
            if (x instanceof BigNumber) {
 
17538
              return bigAcsch(x, BigNumber, true, true);
 
17539
            }
 
17540
 
 
17541
            throw new math.error.UnsupportedTypeError('acsch', math['typeof'](x));
 
17542
          };
 
17543
        };
 
17544
 
 
17545
 
 
17546
/***/ },
 
17547
/* 135 */
 
17548
/***/ function(module, exports, __webpack_require__) {
 
17549
 
 
17550
        'use strict';
 
17551
 
 
17552
        module.exports = function (math) {
 
17553
          var util = __webpack_require__(171),
 
17554
 
 
17555
              BigNumber = math.type.BigNumber,
 
17556
              Complex = __webpack_require__(7),
 
17557
              collection = __webpack_require__(14),
 
17558
 
 
17559
              isNumber = util.number.isNumber,
 
17560
              isBoolean = util['boolean'].isBoolean,
 
17561
              isComplex = Complex.isComplex,
 
17562
              isCollection = collection.isCollection,
 
17563
 
 
17564
              bigArcSec = util.bignumber.arccos_arcsec;
 
17565
 
 
17566
          /**
 
17567
           * Calculate the inverse secant of a value.
 
17568
           *
 
17569
           * For matrices, the function is evaluated element wise.
 
17570
           *
 
17571
           * Syntax:
 
17572
           *
 
17573
           *    math.asec(x)
 
17574
           *
 
17575
           * Examples:
 
17576
           *
 
17577
           *    math.asec(0.5);           // returns 1.0471975511965979
 
17578
           *    math.asec(math.sec(1.5)); // returns 1.5
 
17579
           *
 
17580
           *    math.asec(2);             // returns 0 + 1.3169578969248166 i
 
17581
           *
 
17582
           * See also:
 
17583
           *
 
17584
           *    acos, acot, acsc
 
17585
           *
 
17586
           * @param {Number | Boolean | Complex | Array | Matrix | null} x  Function input
 
17587
           * @return {Number | Complex | Array | Matrix} The arc secant of x
 
17588
           */
 
17589
          math.asec = function asec(x) {
 
17590
            if (arguments.length != 1) {
 
17591
              throw new math.error.ArgumentsError('asec', arguments.length, 1);
 
17592
            }
 
17593
 
 
17594
            if (isNumber(x)) {
 
17595
              if (x <= -1 || x >= 1) {
 
17596
                return Math.acos(1 / x);
 
17597
              }
 
17598
              return asec(new Complex(x, 0));
 
17599
            }
 
17600
 
 
17601
            if (isComplex(x)) {
 
17602
              if (x.re == 0 && x.im == 0) {
 
17603
                return new Complex(0, Infinity);
 
17604
              }
 
17605
 
 
17606
              var den = x.re*x.re + x.im*x.im;
 
17607
              x = (den != 0)
 
17608
                ? new Complex(
 
17609
                    x.re =  x.re / den,
 
17610
                    x.im = -x.im / den)
 
17611
                : new Complex(
 
17612
                    (x.re != 0) ?  (x.re / 0) : 0,
 
17613
                    (x.im != 0) ? -(x.im / 0) : 0);
 
17614
 
 
17615
              return math.acos(x);
 
17616
            }
 
17617
 
 
17618
            if (isCollection(x)) {
 
17619
              return collection.deepMap(x, asec);
 
17620
            }
 
17621
 
 
17622
            if (isBoolean(x) || x === null) {
 
17623
              return (x) ? 0 : new Complex(0, Infinity);
 
17624
            }
 
17625
 
 
17626
            if (x instanceof BigNumber) {
 
17627
              return bigArcSec(x, BigNumber, true);
 
17628
            }
 
17629
 
 
17630
            throw new math.error.UnsupportedTypeError('asec', math['typeof'](x));
 
17631
          };
 
17632
        };
 
17633
 
 
17634
 
 
17635
/***/ },
 
17636
/* 136 */
 
17637
/***/ function(module, exports, __webpack_require__) {
 
17638
 
 
17639
        'use strict';
 
17640
 
 
17641
        module.exports = function (math) {
 
17642
          var util = __webpack_require__(171),
 
17643
 
 
17644
              BigNumber = math.type.BigNumber,
 
17645
              Complex = __webpack_require__(7),
 
17646
              Unit = __webpack_require__(11),
 
17647
              collection = __webpack_require__(14),
 
17648
 
 
17649
              isNumber = util.number.isNumber,
 
17650
              isBoolean = util['boolean'].isBoolean,
 
17651
              isComplex = Complex.isComplex,
 
17652
              isUnit = Unit.isUnit,
 
17653
              isCollection = collection.isCollection,
 
17654
 
 
17655
              bigAsech = util.bignumber.acosh_asinh_asech_acsch;
 
17656
 
 
17657
          /**
 
17658
           * Calculate the hyperbolic arccos of a value,
 
17659
           * defined as `asech(x) = ln(sqrt(1/x^2 - 1) + 1/x)`.
 
17660
           *
 
17661
           * For matrices, the function is evaluated element wise.
 
17662
           *
 
17663
           * Syntax:
 
17664
           *
 
17665
           *    math.asech(x)
 
17666
           *
 
17667
           * Examples:
 
17668
           *
 
17669
           *    math.asech(0.5);       // returns 1.3169578969248166
 
17670
           *
 
17671
           * See also:
 
17672
           *
 
17673
           *    acsch, acoth
 
17674
           *
 
17675
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
17676
           * @return {Number | Complex | Array | Matrix} Hyperbolic arcsecant of x
 
17677
           */
 
17678
          math.asech = function asech(x) {
 
17679
            if (arguments.length != 1) {
 
17680
              throw new math.error.ArgumentsError('asech', arguments.length, 1);
 
17681
            }
 
17682
 
 
17683
            if (isNumber(x)) {
 
17684
              if (x <= 1 && x >= -1) {
 
17685
                x = 1 / x;
 
17686
 
 
17687
                var ret = Math.sqrt(x*x - 1);
 
17688
                if (x > 0) {
 
17689
                  return Math.log(ret + x);
 
17690
                }
 
17691
 
 
17692
                return new Complex(Math.log(ret - x), Math.PI);
 
17693
              }
 
17694
 
 
17695
              return asech(new Complex(x, 0));
 
17696
            }
 
17697
 
 
17698
            if (isComplex(x)) {
 
17699
              if (x.re == 0 && x.im == 0) {
 
17700
                return new Complex(Infinity, 0);
 
17701
              }
 
17702
 
 
17703
              // acsch(z) = -i*asinh(1/z)
 
17704
              var den = x.re*x.re + x.im*x.im;
 
17705
              x = (den != 0)
 
17706
                ? new Complex(
 
17707
                    x.re / den,
 
17708
                   -x.im / den
 
17709
                  )
 
17710
                : new Complex(
 
17711
                    (x.re != 0) ?  (x.re / 0) : 0,
 
17712
                    (x.im != 0) ? -(x.im / 0) : 0
 
17713
                  );
 
17714
 
 
17715
              return math.acosh(x);
 
17716
            }
 
17717
 
 
17718
            if (isCollection(x)) {
 
17719
              return collection.deepMap(x, asech);
 
17720
            }
 
17721
 
 
17722
            if (isBoolean(x) || x === null) {
 
17723
              return (x) ? 0 : Infinity;
 
17724
            }
 
17725
 
 
17726
            if (x instanceof BigNumber) {
 
17727
              return bigAsech(x, BigNumber, false, true);
 
17728
            }
 
17729
 
 
17730
            throw new math.error.UnsupportedTypeError('asech', math['typeof'](x));
 
17731
          };
 
17732
        };
 
17733
 
 
17734
 
 
17735
/***/ },
 
17736
/* 137 */
 
17737
/***/ function(module, exports, __webpack_require__) {
 
17738
 
 
17739
        'use strict';
 
17740
 
 
17741
        module.exports = function (math) {
 
17742
          var util = __webpack_require__(171),
 
17743
 
 
17744
              BigNumber = math.type.BigNumber,
 
17745
              Complex = __webpack_require__(7),
 
17746
              collection = __webpack_require__(14),
 
17747
 
 
17748
              isNumber = util.number.isNumber,
 
17749
              isBoolean = util['boolean'].isBoolean,
 
17750
              isComplex = Complex.isComplex,
 
17751
              isCollection = collection.isCollection,
 
17752
 
 
17753
              bigArcSin = util.bignumber.arcsin_arccsc;
16575
17754
 
16576
17755
          /**
16577
17756
           * Calculate the inverse sine of a value.
16593
17772
           *
16594
17773
           *    sin, atan, acos
16595
17774
           *
16596
 
           * @param {Number | Boolean | Complex | Array | Matrix | null} x   Function input
16597
 
           * @return {Number | Complex | Array | Matrix} The arc sine of x
 
17775
           * @param {Number | BigNumber | Boolean | Complex | Array | Matrix | null} x   Function input
 
17776
           * @return {Number | BigNumber | Complex | Array | Matrix} The arc sine of x
16598
17777
           */
16599
17778
          math.asin = function asin(x) {
16600
17779
            if (arguments.length != 1) {
16637
17816
            }
16638
17817
 
16639
17818
            if (x instanceof BigNumber) {
16640
 
              // TODO: implement BigNumber support
16641
 
              // downgrade to Number
16642
 
              return asin(x.toNumber());
 
17819
              return bigArcSin(x, BigNumber, false);
16643
17820
            }
16644
17821
 
16645
17822
            throw new math.error.UnsupportedTypeError('asin', math['typeof'](x));
16648
17825
 
16649
17826
 
16650
17827
/***/ },
16651
 
/* 128 */
16652
 
/***/ function(module, exports, __webpack_require__) {
16653
 
 
16654
 
        'use strict';
16655
 
 
16656
 
        module.exports = function (math) {
16657
 
          var util = __webpack_require__(160),
16658
 
 
16659
 
              BigNumber = math.type.BigNumber,
16660
 
              Complex = __webpack_require__(6),
16661
 
              collection = __webpack_require__(13),
16662
 
 
16663
 
              isNumber = util.number.isNumber,
16664
 
              isBoolean = util['boolean'].isBoolean,
16665
 
              isComplex = Complex.isComplex,
16666
 
              isCollection = collection.isCollection;
 
17828
/* 138 */
 
17829
/***/ function(module, exports, __webpack_require__) {
 
17830
 
 
17831
        'use strict';
 
17832
 
 
17833
        module.exports = function (math) {
 
17834
          var util = __webpack_require__(171),
 
17835
 
 
17836
              BigNumber = math.type.BigNumber,
 
17837
              Complex = __webpack_require__(7),
 
17838
              Unit = __webpack_require__(11),
 
17839
              collection = __webpack_require__(14),
 
17840
 
 
17841
              isNumber = util.number.isNumber,
 
17842
              isBoolean = util['boolean'].isBoolean,
 
17843
              isComplex = Complex.isComplex,
 
17844
              isUnit = Unit.isUnit,
 
17845
              isCollection = collection.isCollection,
 
17846
 
 
17847
              bigAsinh = util.bignumber.acosh_asinh_asech_acsch;
 
17848
 
 
17849
          /**
 
17850
           * Calculate the hyperbolic arcsine of a value,
 
17851
           * defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.
 
17852
           *
 
17853
           * For matrices, the function is evaluated element wise.
 
17854
           *
 
17855
           * Syntax:
 
17856
           *
 
17857
           *    math.asinh(x)
 
17858
           *
 
17859
           * Examples:
 
17860
           *
 
17861
           *    math.asinh(0.5);       // returns 0.48121182505960347
 
17862
           *
 
17863
           * See also:
 
17864
           *
 
17865
           *    acosh, atanh
 
17866
           *
 
17867
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
17868
           * @return {Number | Complex | Array | Matrix} Hyperbolic arcsine of x
 
17869
           */
 
17870
          math.asinh = function asinh(x) {
 
17871
            if (arguments.length != 1) {
 
17872
              throw new math.error.ArgumentsError('asinh', arguments.length, 1);
 
17873
            }
 
17874
 
 
17875
            if (isNumber(x)) {
 
17876
              return Math.log(Math.sqrt(x*x + 1) + x);
 
17877
            }
 
17878
 
 
17879
            if (isComplex(x)) {
 
17880
              // asinh(z) = (-asin((z.im, -z.re)).im, asin((z.im, -z.re)).re)
 
17881
              var temp = x.im;
 
17882
              x.im = -x.re;
 
17883
              x.re = temp;
 
17884
 
 
17885
              var asin = math.asin(x);
 
17886
 
 
17887
              // restore original values
 
17888
              x.re = -x.im;
 
17889
              x.im = temp;
 
17890
 
 
17891
              temp = asin.re;
 
17892
              asin.re = -asin.im;
 
17893
              asin.im = temp;
 
17894
 
 
17895
              return asin;
 
17896
            }
 
17897
 
 
17898
            if (isCollection(x)) {
 
17899
              return collection.deepMap(x, asinh);
 
17900
            }
 
17901
 
 
17902
            if (isBoolean(x) || x === null) {
 
17903
              return (x) ? 0.881373587019543 : 0;
 
17904
            }
 
17905
 
 
17906
            if (x instanceof BigNumber) {
 
17907
              return bigAsinh(x, BigNumber, true, false);
 
17908
            }
 
17909
 
 
17910
            throw new math.error.UnsupportedTypeError('asinh', math['typeof'](x));
 
17911
          };
 
17912
        };
 
17913
 
 
17914
 
 
17915
/***/ },
 
17916
/* 139 */
 
17917
/***/ function(module, exports, __webpack_require__) {
 
17918
 
 
17919
        'use strict';
 
17920
 
 
17921
        module.exports = function (math) {
 
17922
          var util = __webpack_require__(171),
 
17923
 
 
17924
              BigNumber = math.type.BigNumber,
 
17925
              Complex = __webpack_require__(7),
 
17926
              collection = __webpack_require__(14),
 
17927
 
 
17928
              isNumber = util.number.isNumber,
 
17929
              isBoolean = util['boolean'].isBoolean,
 
17930
              isComplex = Complex.isComplex,
 
17931
              isCollection = collection.isCollection,
 
17932
 
 
17933
              bigArcTan = util.bignumber.arctan_arccot;
16667
17934
 
16668
17935
          /**
16669
17936
           * Calculate the inverse tangent of a value.
16685
17952
           *
16686
17953
           *    tan, asin, acos
16687
17954
           *
16688
 
           * @param {Number | Boolean | Complex | Array | Matrix | null} x   Function input
16689
 
           * @return {Number | Complex | Array | Matrix} The arc tangent of x
 
17955
           * @param {Number | BigNumber | Boolean | Complex | Array | Matrix | null} x   Function input
 
17956
           * @return {Number | BigNumber | Complex | Array | Matrix} The arc tangent of x
16690
17957
           */
16691
17958
          math.atan = function atan(x) {
16692
17959
            if (arguments.length != 1) {
16698
17965
            }
16699
17966
 
16700
17967
            if (isComplex(x)) {
 
17968
              if (x.re == 0) {
 
17969
                if (x.im == 1) {
 
17970
                  return new Complex(0, Infinity);
 
17971
                }
 
17972
                if (x.im == -1) {
 
17973
                  return new Complex(0, -Infinity);
 
17974
                }
 
17975
              }
 
17976
 
16701
17977
              // atan(z) = 1/2 * i * (ln(1-iz) - ln(1+iz))
16702
17978
              var re = x.re;
16703
17979
              var im = x.im;
16724
18000
            }
16725
18001
 
16726
18002
            if (x instanceof BigNumber) {
16727
 
              // TODO: implement BigNumber support
16728
 
              // downgrade to Number
16729
 
              return atan(x.toNumber());
 
18003
              return bigArcTan(x, BigNumber, false);
16730
18004
            }
16731
18005
 
16732
18006
            throw new math.error.UnsupportedTypeError('atan', math['typeof'](x));
16735
18009
 
16736
18010
 
16737
18011
/***/ },
16738
 
/* 129 */
 
18012
/* 140 */
16739
18013
/***/ function(module, exports, __webpack_require__) {
16740
18014
 
16741
18015
        'use strict';
16742
18016
 
16743
18017
        module.exports = function (math) {
16744
 
          var util = __webpack_require__(160),
 
18018
          var util = __webpack_require__(171),
16745
18019
 
16746
18020
              BigNumber = math.type.BigNumber,
16747
 
              Complex = __webpack_require__(6),
16748
 
              collection = __webpack_require__(13),
 
18021
              Complex = __webpack_require__(7),
 
18022
              collection = __webpack_require__(14),
16749
18023
 
16750
18024
              isNumber = util.number.isNumber,
16751
18025
              isBoolean = util['boolean'].isBoolean,
16819
18093
 
16820
18094
 
16821
18095
/***/ },
16822
 
/* 130 */
 
18096
/* 141 */
16823
18097
/***/ function(module, exports, __webpack_require__) {
16824
18098
 
16825
18099
        'use strict';
16826
18100
 
16827
18101
        module.exports = function (math) {
16828
 
          var util = __webpack_require__(160),
16829
 
 
16830
 
              BigNumber = math.type.BigNumber,
16831
 
              Complex = __webpack_require__(6),
16832
 
              Unit = __webpack_require__(10),
16833
 
              collection = __webpack_require__(13),
16834
 
 
16835
 
              isNumber = util.number.isNumber,
16836
 
              isBoolean = util['boolean'].isBoolean,
16837
 
              isComplex = Complex.isComplex,
16838
 
              isUnit = Unit.isUnit,
16839
 
              isCollection = collection.isCollection;
 
18102
          var util = __webpack_require__(171),
 
18103
 
 
18104
              BigNumber = math.type.BigNumber,
 
18105
              Complex = __webpack_require__(7),
 
18106
              Unit = __webpack_require__(11),
 
18107
              collection = __webpack_require__(14),
 
18108
 
 
18109
              isNumber = util.number.isNumber,
 
18110
              isBoolean = util['boolean'].isBoolean,
 
18111
              isComplex = Complex.isComplex,
 
18112
              isUnit = Unit.isUnit,
 
18113
              isCollection = collection.isCollection,
 
18114
 
 
18115
              bigAtanh = util.bignumber.atanh_acoth;
 
18116
 
 
18117
          /**
 
18118
           * Calculate the hyperbolic arctangent of a value,
 
18119
           * defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.
 
18120
           *
 
18121
           * For matrices, the function is evaluated element wise.
 
18122
           *
 
18123
           * Syntax:
 
18124
           *
 
18125
           *    math.atanh(x)
 
18126
           *
 
18127
           * Examples:
 
18128
           *
 
18129
           *    math.atanh(0.5);       // returns 0.5493061443340549
 
18130
           *
 
18131
           * See also:
 
18132
           *
 
18133
           *    acosh, asinh
 
18134
           *
 
18135
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
18136
           * @return {Number | Complex | Array | Matrix} Hyperbolic arctangent of x
 
18137
           */
 
18138
          math.atanh = function atanh(x) {
 
18139
            if (arguments.length != 1) {
 
18140
              throw new math.error.ArgumentsError('atanh', arguments.length, 1);
 
18141
            }
 
18142
 
 
18143
            if (isNumber(x)) {
 
18144
              if (x <= 1 && x >= -1) {
 
18145
                return Math.log((1 + x)/(1 - x)) / 2;
 
18146
              }
 
18147
              return atanh(new Complex(x, 0));
 
18148
            }
 
18149
 
 
18150
            if (isComplex(x)) {
 
18151
              // x.im should equal -pi / 2 in this case
 
18152
              var noIM = x.re > 1 && x.im == 0;
 
18153
 
 
18154
              var oneMinus = 1 - x.re;
 
18155
              var onePlus = 1 + x.re;
 
18156
              var den = oneMinus*oneMinus + x.im*x.im;
 
18157
              x = (den != 0)
 
18158
                ? new Complex(
 
18159
                    (onePlus*oneMinus - x.im*x.im) / den,
 
18160
                    (x.im*oneMinus + onePlus*x.im) / den
 
18161
                  )
 
18162
                : new Complex(
 
18163
                    (x.re != -1) ? (x.re / 0) : 0,
 
18164
                    (x.im != 0) ? (x.im / 0) : 0
 
18165
                  );
 
18166
 
 
18167
              var temp = x.re;
 
18168
              x.re = Math.log(Math.sqrt(x.re*x.re + x.im*x.im)) / 2;
 
18169
              x.im = Math.atan2(x.im, temp) / 2;
 
18170
 
 
18171
              if (noIM) {
 
18172
                x.im = -x.im;
 
18173
              }
 
18174
              return x;
 
18175
            }
 
18176
 
 
18177
            if (isCollection(x)) {
 
18178
              return collection.deepMap(x, atanh);
 
18179
            }
 
18180
 
 
18181
            if (isBoolean(x) || x === null) {
 
18182
              return (x) ? Infinity : 0;
 
18183
            }
 
18184
 
 
18185
            if (x instanceof BigNumber) {
 
18186
              return bigAtanh(x, BigNumber, false);
 
18187
            }
 
18188
 
 
18189
            throw new math.error.UnsupportedTypeError('atanh', math['typeof'](x));
 
18190
          };
 
18191
        };
 
18192
 
 
18193
 
 
18194
/***/ },
 
18195
/* 142 */
 
18196
/***/ function(module, exports, __webpack_require__) {
 
18197
 
 
18198
        'use strict';
 
18199
 
 
18200
        module.exports = function (math, config) {
 
18201
          var util = __webpack_require__(171),
 
18202
 
 
18203
              BigNumber = math.type.BigNumber,
 
18204
              Complex = __webpack_require__(7),
 
18205
              Unit = __webpack_require__(11),
 
18206
              collection = __webpack_require__(14),
 
18207
 
 
18208
              isNumber = util.number.isNumber,
 
18209
              isBoolean = util['boolean'].isBoolean,
 
18210
              isComplex = Complex.isComplex,
 
18211
              isUnit = Unit.isUnit,
 
18212
              isCollection = collection.isCollection,
 
18213
 
 
18214
              bigCos = util.bignumber.cos_sin_sec_csc;
16840
18215
 
16841
18216
          /**
16842
18217
           * Calculate the cosine of a value.
16861
18236
           *
16862
18237
           *    cos, tan
16863
18238
           *
16864
 
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
16865
 
           * @return {Number | Complex | Array | Matrix} Cosine of x
 
18239
           * @param {Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
18240
           * @return {Number | BigNumber | Complex | Array | Matrix} Cosine of x
16866
18241
           */
16867
18242
          math.cos = function cos(x) {
16868
18243
            if (arguments.length != 1) {
16897
18272
            }
16898
18273
 
16899
18274
            if (x instanceof BigNumber) {
16900
 
              // TODO: implement BigNumber support
16901
 
              // downgrade to Number
16902
 
              return cos(x.toNumber());
 
18275
              return bigCos(x, BigNumber, 0, false);
16903
18276
            }
16904
18277
 
16905
18278
            throw new math.error.UnsupportedTypeError('cos', math['typeof'](x));
16908
18281
 
16909
18282
 
16910
18283
/***/ },
16911
 
/* 131 */
 
18284
/* 143 */
16912
18285
/***/ function(module, exports, __webpack_require__) {
16913
18286
 
16914
18287
        'use strict';
16915
18288
 
16916
18289
        module.exports = function (math) {
16917
 
          var util = __webpack_require__(160),
 
18290
          var util = __webpack_require__(171),
16918
18291
 
16919
18292
              BigNumber = math.type.BigNumber,
16920
 
              Complex = __webpack_require__(6),
16921
 
              Unit = __webpack_require__(10),
16922
 
              collection = __webpack_require__(13),
 
18293
              Complex = __webpack_require__(7),
 
18294
              Unit = __webpack_require__(11),
 
18295
              collection = __webpack_require__(14),
16923
18296
 
16924
18297
              isNumber = util.number.isNumber,
16925
18298
              isBoolean = util['boolean'].isBoolean,
16926
18299
              isComplex = Complex.isComplex,
16927
18300
              isUnit = Unit.isUnit,
16928
 
              isCollection = collection.isCollection;
 
18301
              isCollection = collection.isCollection,
 
18302
 
 
18303
              bigCosh = util.bignumber.cosh_sinh_csch_sech;
16929
18304
 
16930
18305
          /**
16931
18306
           * Calculate the hyperbolic cosine of a value,
16945
18320
           *
16946
18321
           *    sinh, tanh
16947
18322
           *
16948
 
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
16949
 
           * @return {Number | Complex | Array | Matrix} Hyperbolic cosine of x
 
18323
           * @param {Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
18324
           * @return {Number | BigNumber | Complex | Array | Matrix} Hyperbolic cosine of x
16950
18325
           */
16951
18326
          math.cosh = function cosh(x) {
16952
18327
            if (arguments.length != 1) {
16979
18354
            }
16980
18355
 
16981
18356
            if (x instanceof BigNumber) {
16982
 
              // TODO: implement BigNumber support
16983
 
              // downgrade to Number
16984
 
              return cosh(x.toNumber());
 
18357
              return bigCosh(x, BigNumber, false, false);
16985
18358
            }
16986
18359
 
16987
18360
            throw new math.error.UnsupportedTypeError('cosh', math['typeof'](x));
16990
18363
 
16991
18364
 
16992
18365
/***/ },
16993
 
/* 132 */
 
18366
/* 144 */
16994
18367
/***/ function(module, exports, __webpack_require__) {
16995
18368
 
16996
18369
        'use strict';
16997
18370
 
16998
 
        module.exports = function (math) {
16999
 
          var util = __webpack_require__(160),
 
18371
        module.exports = function (math, config) {
 
18372
          var util = __webpack_require__(171),
17000
18373
 
17001
18374
              BigNumber = math.type.BigNumber,
17002
 
              Complex = __webpack_require__(6),
17003
 
              Unit = __webpack_require__(10),
17004
 
              collection = __webpack_require__(13),
 
18375
              Complex = __webpack_require__(7),
 
18376
              Unit = __webpack_require__(11),
 
18377
              collection = __webpack_require__(14),
17005
18378
 
17006
18379
              isNumber = util.number.isNumber,
17007
18380
              isBoolean = util['boolean'].isBoolean,
17008
18381
              isComplex = Complex.isComplex,
17009
18382
              isUnit = Unit.isUnit,
17010
 
              isCollection = collection.isCollection;
 
18383
              isCollection = collection.isCollection,
 
18384
 
 
18385
              bigCot = util.bignumber.tan_cot;
17011
18386
 
17012
18387
          /**
17013
18388
           * Calculate the cotangent of a value. `cot(x)` is defined as `1 / tan(x)`.
17065
18440
            }
17066
18441
 
17067
18442
            if (x instanceof BigNumber) {
17068
 
              // TODO: implement BigNumber support
17069
 
              // downgrade to Number
17070
 
              return cot(x.toNumber());
 
18443
              return bigCot(x, BigNumber, true);
17071
18444
            }
17072
18445
 
17073
18446
            throw new math.error.UnsupportedTypeError('cot', math['typeof'](x));
17076
18449
 
17077
18450
 
17078
18451
/***/ },
17079
 
/* 133 */
 
18452
/* 145 */
17080
18453
/***/ function(module, exports, __webpack_require__) {
17081
18454
 
17082
18455
        'use strict';
17083
18456
 
17084
18457
        module.exports = function (math) {
17085
 
          var util = __webpack_require__(160),
 
18458
          var util = __webpack_require__(171),
17086
18459
 
17087
18460
              BigNumber = math.type.BigNumber,
17088
 
              Complex = __webpack_require__(6),
17089
 
              Unit = __webpack_require__(10),
17090
 
              collection = __webpack_require__(13),
 
18461
              Complex = __webpack_require__(7),
 
18462
              Unit = __webpack_require__(11),
 
18463
              collection = __webpack_require__(14),
17091
18464
 
17092
18465
              isNumber = util.number.isNumber,
17093
18466
              isBoolean = util['boolean'].isBoolean,
17094
18467
              isComplex = Complex.isComplex,
17095
18468
              isUnit = Unit.isUnit,
17096
 
              isCollection = collection.isCollection;
 
18469
              isCollection = collection.isCollection,
 
18470
 
 
18471
              bigCoth = util.bignumber.tanh_coth;
17097
18472
 
17098
18473
          /**
17099
18474
           * Calculate the hyperbolic cotangent of a value,
17155
18530
            }
17156
18531
 
17157
18532
            if (x instanceof BigNumber) {
17158
 
              // TODO: implement BigNumber support
17159
 
              // downgrade to Number
17160
 
              return coth(x.toNumber());
 
18533
              return bigCoth(x, BigNumber, true);
17161
18534
            }
17162
18535
 
17163
18536
            throw new math.error.UnsupportedTypeError('coth', math['typeof'](x));
17166
18539
 
17167
18540
 
17168
18541
/***/ },
17169
 
/* 134 */
 
18542
/* 146 */
17170
18543
/***/ function(module, exports, __webpack_require__) {
17171
18544
 
17172
18545
        'use strict';
17173
18546
 
17174
 
        module.exports = function (math) {
17175
 
          var util = __webpack_require__(160),
 
18547
        module.exports = function (math, config) {
 
18548
          var util = __webpack_require__(171),
17176
18549
 
17177
18550
              BigNumber = math.type.BigNumber,
17178
 
              Complex = __webpack_require__(6),
17179
 
              Unit = __webpack_require__(10),
17180
 
              collection = __webpack_require__(13),
 
18551
              Complex = __webpack_require__(7),
 
18552
              Unit = __webpack_require__(11),
 
18553
              collection = __webpack_require__(14),
17181
18554
 
17182
18555
              isNumber = util.number.isNumber,
17183
18556
              isBoolean = util['boolean'].isBoolean,
17184
18557
              isComplex = Complex.isComplex,
17185
18558
              isUnit = Unit.isUnit,
17186
 
              isCollection = collection.isCollection;
 
18559
              isCollection = collection.isCollection,
 
18560
 
 
18561
              bigCsc = util.bignumber.cos_sin_sec_csc;
17187
18562
 
17188
18563
          /**
17189
18564
           * Calculate the cosecant of a value, defined as `csc(x) = 1/sin(x)`.
17242
18617
            }
17243
18618
 
17244
18619
            if (x instanceof BigNumber) {
17245
 
              // TODO: implement BigNumber support
17246
 
              // downgrade to Number
17247
 
              return csc(x.toNumber());
 
18620
              return bigCsc(x, BigNumber, 1, true);
17248
18621
            }
17249
18622
 
17250
18623
            throw new math.error.UnsupportedTypeError('csc', math['typeof'](x));
17253
18626
 
17254
18627
 
17255
18628
/***/ },
17256
 
/* 135 */
 
18629
/* 147 */
17257
18630
/***/ function(module, exports, __webpack_require__) {
17258
18631
 
17259
18632
        'use strict';
17260
18633
 
17261
18634
        module.exports = function (math) {
17262
 
          var util = __webpack_require__(160),
 
18635
          var util = __webpack_require__(171),
17263
18636
 
17264
18637
              BigNumber = math.type.BigNumber,
17265
 
              Complex = __webpack_require__(6),
17266
 
              Unit = __webpack_require__(10),
17267
 
              collection = __webpack_require__(13),
 
18638
              Complex = __webpack_require__(7),
 
18639
              Unit = __webpack_require__(11),
 
18640
              collection = __webpack_require__(14),
17268
18641
              number = util.number,
17269
18642
 
17270
18643
              isNumber = util.number.isNumber,
17271
18644
              isBoolean = util['boolean'].isBoolean,
17272
18645
              isComplex = Complex.isComplex,
17273
18646
              isUnit = Unit.isUnit,
17274
 
              isCollection = collection.isCollection;
 
18647
              isCollection = collection.isCollection,
 
18648
 
 
18649
              bigCsch = util.bignumber.cosh_sinh_csch_sech;
17275
18650
 
17276
18651
          /**
17277
18652
           * Calculate the hyperbolic cosecant of a value,
17303
18678
 
17304
18679
            if (isNumber(x)) {
17305
18680
              // x == 0
17306
 
              if (x == 0) return Number.NaN;
 
18681
              if (x == 0) return Number.POSITIVE_INFINITY;
17307
18682
              // consider values close to zero (+/-)
17308
18683
              return Math.abs(2 / (Math.exp(x) - Math.exp(-x))) * number.sign(x);
17309
18684
            }
17333
18708
            }
17334
18709
 
17335
18710
            if (x instanceof BigNumber) {
17336
 
              // TODO: implement BigNumber support
17337
 
              // downgrade to Number
17338
 
              return csch(x.toNumber());
 
18711
              return bigCsch(x, BigNumber, true, true);
17339
18712
            }
17340
18713
 
17341
18714
            throw new math.error.UnsupportedTypeError('csch', math['typeof'](x));
17344
18717
 
17345
18718
 
17346
18719
/***/ },
17347
 
/* 136 */
 
18720
/* 148 */
17348
18721
/***/ function(module, exports, __webpack_require__) {
17349
18722
 
17350
18723
        'use strict';
17351
18724
 
17352
 
        module.exports = function (math) {
17353
 
          var util = __webpack_require__(160),
 
18725
        module.exports = function (math, config) {
 
18726
          var util = __webpack_require__(171),
17354
18727
 
17355
18728
              BigNumber = math.type.BigNumber,
17356
 
              Complex = __webpack_require__(6),
17357
 
              Unit = __webpack_require__(10),
17358
 
              collection = __webpack_require__(13),
 
18729
              Complex = __webpack_require__(7),
 
18730
              Unit = __webpack_require__(11),
 
18731
              collection = __webpack_require__(14),
17359
18732
 
17360
18733
              isNumber = util.number.isNumber,
17361
18734
              isBoolean = util['boolean'].isBoolean,
17362
18735
              isComplex = Complex.isComplex,
17363
18736
              isUnit = Unit.isUnit,
17364
 
              isCollection = collection.isCollection;
 
18737
              isCollection = collection.isCollection,
 
18738
 
 
18739
              bigSec = util.bignumber.cos_sin_sec_csc;
17365
18740
 
17366
18741
          /**
17367
18742
           * Calculate the secant of a value, defined as `sec(x) = 1/cos(x)`.
17420
18795
            }
17421
18796
 
17422
18797
            if (x instanceof BigNumber) {
17423
 
              // TODO: implement BigNumber support
17424
 
              // downgrade to Number
17425
 
              return sec(x.toNumber());
 
18798
              return bigSec(x, BigNumber, 0, true);
17426
18799
            }
17427
18800
 
17428
18801
            throw new math.error.UnsupportedTypeError('sec', math['typeof'](x));
17431
18804
 
17432
18805
 
17433
18806
/***/ },
17434
 
/* 137 */
 
18807
/* 149 */
17435
18808
/***/ function(module, exports, __webpack_require__) {
17436
18809
 
17437
18810
        'use strict';
17438
18811
 
17439
18812
        module.exports = function (math) {
17440
 
          var util = __webpack_require__(160),
 
18813
          var util = __webpack_require__(171),
17441
18814
 
17442
18815
              BigNumber = math.type.BigNumber,
17443
 
              Complex = __webpack_require__(6),
17444
 
              Unit = __webpack_require__(10),
17445
 
              collection = __webpack_require__(13),
 
18816
              Complex = __webpack_require__(7),
 
18817
              Unit = __webpack_require__(11),
 
18818
              collection = __webpack_require__(14),
17446
18819
 
17447
18820
              isNumber = util.number.isNumber,
17448
18821
              isBoolean = util['boolean'].isBoolean,
17449
18822
              isComplex = Complex.isComplex,
17450
18823
              isUnit = Unit.isUnit,
17451
 
              isCollection = collection.isCollection;
 
18824
              isCollection = collection.isCollection,
 
18825
 
 
18826
              bigSech = util.bignumber.cosh_sinh_csch_sech;
17452
18827
 
17453
18828
          /**
17454
18829
           * Calculate the hyperbolic secant of a value,
17464
18839
           *
17465
18840
           *    // sech(x) = 1/ cosh(x)
17466
18841
           *    math.sech(0.5);       // returns 0.886818883970074
17467
 
           *    1 / math.cosh(0.5);   // returns 1.9190347513349437
 
18842
           *    1 / math.cosh(0.5);   // returns 0.886818883970074
17468
18843
           *
17469
18844
           * See also:
17470
18845
           *
17507
18882
            }
17508
18883
 
17509
18884
            if (x instanceof BigNumber) {
17510
 
              // TODO: implement BigNumber support
17511
 
              // downgrade to Number
17512
 
              return sech(x.toNumber());
 
18885
              return bigSech(x, BigNumber, false, true);
17513
18886
            }
17514
18887
 
17515
18888
            throw new math.error.UnsupportedTypeError('sech', math['typeof'](x));
17518
18891
 
17519
18892
 
17520
18893
/***/ },
17521
 
/* 138 */
 
18894
/* 150 */
17522
18895
/***/ function(module, exports, __webpack_require__) {
17523
18896
 
17524
18897
        'use strict';
17525
18898
 
17526
 
        module.exports = function (math) {
17527
 
          var util = __webpack_require__(160),
 
18899
        module.exports = function (math, config) {
 
18900
          var util = __webpack_require__(171),
17528
18901
 
17529
18902
              BigNumber = math.type.BigNumber,
17530
 
              Complex = __webpack_require__(6),
17531
 
              Unit = __webpack_require__(10),
17532
 
              collection = __webpack_require__(13),
 
18903
              Complex = __webpack_require__(7),
 
18904
              Unit = __webpack_require__(11),
 
18905
              collection = __webpack_require__(14),
17533
18906
 
17534
18907
              isNumber = util.number.isNumber,
17535
18908
              isBoolean = util['boolean'].isBoolean,
17536
18909
              isComplex = Complex.isComplex,
17537
18910
              isUnit = Unit.isUnit,
17538
 
              isCollection = collection.isCollection;
 
18911
              isCollection = collection.isCollection,
 
18912
 
 
18913
              bigSin = util.bignumber.cos_sin_sec_csc;
17539
18914
 
17540
18915
          /**
17541
18916
           * Calculate the sine of a value.
17560
18935
           *
17561
18936
           *    cos, tan
17562
18937
           *
17563
 
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
17564
 
           * @return {Number | Complex | Array | Matrix} Sine of x
 
18938
           * @param {Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
18939
           * @return {Number | BigNumber | Complex | Array | Matrix} Sine of x
17565
18940
           */
17566
18941
          math.sin = function sin(x) {
17567
18942
            if (arguments.length != 1) {
17595
18970
            }
17596
18971
 
17597
18972
            if (x instanceof BigNumber) {
17598
 
              // TODO: implement BigNumber support
17599
 
              // downgrade to Number
17600
 
              return sin(x.toNumber());
 
18973
              return bigSin(x, BigNumber, 1, false);
17601
18974
            }
17602
18975
 
17603
18976
            throw new math.error.UnsupportedTypeError('sin', math['typeof'](x));
17606
18979
 
17607
18980
 
17608
18981
/***/ },
17609
 
/* 139 */
 
18982
/* 151 */
17610
18983
/***/ function(module, exports, __webpack_require__) {
17611
18984
 
17612
18985
        'use strict';
17613
18986
 
17614
18987
        module.exports = function (math) {
17615
 
          var util = __webpack_require__(160),
 
18988
          var util = __webpack_require__(171),
17616
18989
 
17617
18990
              BigNumber = math.type.BigNumber,
17618
 
              Complex = __webpack_require__(6),
17619
 
              Unit = __webpack_require__(10),
17620
 
              collection = __webpack_require__(13),
 
18991
              Complex = __webpack_require__(7),
 
18992
              Unit = __webpack_require__(11),
 
18993
              collection = __webpack_require__(14),
17621
18994
 
17622
18995
              isNumber = util.number.isNumber,
17623
18996
              isBoolean = util['boolean'].isBoolean,
17624
18997
              isComplex = Complex.isComplex,
17625
18998
              isUnit = Unit.isUnit,
17626
 
              isCollection = collection.isCollection;
 
18999
              isCollection = collection.isCollection,
 
19000
 
 
19001
              bigSinh = util.bignumber.cosh_sinh_csch_sech;
17627
19002
 
17628
19003
          /**
17629
19004
           * Calculate the hyperbolic sine of a value,
17643
19018
           *
17644
19019
           *    cosh, tanh
17645
19020
           *
17646
 
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
17647
 
           * @return {Number | Complex | Array | Matrix} Hyperbolic sine of x
 
19021
           * @param {Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
19022
           * @return {Number | BigNumber | Complex | Array | Matrix} Hyperbolic sine of x
17648
19023
           */
17649
19024
          math.sinh = function sinh(x) {
17650
19025
            if (arguments.length != 1) {
17683
19058
            }
17684
19059
 
17685
19060
            if (x instanceof BigNumber) {
17686
 
              // TODO: implement BigNumber support
17687
 
              // downgrade to Number
17688
 
              return sinh(x.toNumber());
 
19061
              return bigSinh(x, BigNumber, true, false);
17689
19062
            }
17690
19063
 
17691
19064
            throw new math.error.UnsupportedTypeError('sinh', math['typeof'](x));
17694
19067
 
17695
19068
 
17696
19069
/***/ },
17697
 
/* 140 */
 
19070
/* 152 */
17698
19071
/***/ function(module, exports, __webpack_require__) {
17699
19072
 
17700
19073
        'use strict';
17701
19074
 
17702
 
        module.exports = function (math) {
17703
 
          var util = __webpack_require__(160),
 
19075
        module.exports = function (math, config) {
 
19076
          var util = __webpack_require__(171),
17704
19077
 
17705
19078
              BigNumber = math.type.BigNumber,
17706
 
              Complex = __webpack_require__(6),
17707
 
              Unit = __webpack_require__(10),
17708
 
              collection = __webpack_require__(13),
 
19079
              Complex = __webpack_require__(7),
 
19080
              Unit = __webpack_require__(11),
 
19081
              collection = __webpack_require__(14),
17709
19082
 
17710
19083
              isNumber = util.number.isNumber,
17711
19084
              isBoolean = util['boolean'].isBoolean,
17712
19085
              isComplex = Complex.isComplex,
17713
19086
              isUnit = Unit.isUnit,
17714
 
              isCollection = collection.isCollection;
 
19087
              isCollection = collection.isCollection,
 
19088
 
 
19089
              bigTan = util.bignumber.tan_cot;
17715
19090
 
17716
19091
          /**
17717
19092
           * Calculate the tangent of a value. `tan(x)` is equal to `sin(x) / cos(x)`.
17733
19108
           *
17734
19109
           *    atan, sin, cos
17735
19110
           *
17736
 
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
17737
 
           * @return {Number | Complex | Array | Matrix} Tangent of x
 
19111
           * @param {Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
19112
           * @return {Number | BigNumber | Complex | Array | Matrix} Tangent of x
17738
19113
           */
17739
19114
          math.tan = function tan(x) {
17740
19115
            if (arguments.length != 1) {
17772
19147
            }
17773
19148
 
17774
19149
            if (x instanceof BigNumber) {
17775
 
              // TODO: implement BigNumber support
17776
 
              // downgrade to Number
17777
 
              return tan(x.toNumber());
 
19150
              return bigTan(x, BigNumber, false);
17778
19151
            }
17779
19152
 
17780
19153
            throw new math.error.UnsupportedTypeError('tan', math['typeof'](x));
17783
19156
 
17784
19157
 
17785
19158
/***/ },
17786
 
/* 141 */
 
19159
/* 153 */
17787
19160
/***/ function(module, exports, __webpack_require__) {
17788
19161
 
17789
19162
        'use strict';
17790
19163
 
17791
19164
        module.exports = function (math) {
17792
 
          var util = __webpack_require__(160),
 
19165
          var util = __webpack_require__(171),
17793
19166
 
17794
19167
              BigNumber = math.type.BigNumber,
17795
 
              Complex = __webpack_require__(6),
17796
 
              Unit = __webpack_require__(10),
17797
 
              collection = __webpack_require__(13),
 
19168
              Complex = __webpack_require__(7),
 
19169
              Unit = __webpack_require__(11),
 
19170
              collection = __webpack_require__(14),
17798
19171
 
17799
19172
              isNumber = util.number.isNumber,
17800
19173
              isBoolean = util['boolean'].isBoolean,
17801
19174
              isComplex = Complex.isComplex,
17802
19175
              isUnit = Unit.isUnit,
17803
 
              isCollection = collection.isCollection;
 
19176
              isCollection = collection.isCollection,
 
19177
 
 
19178
              bigTanh = util.bignumber.tanh_coth;
17804
19179
 
17805
19180
          /**
17806
19181
           * Calculate the hyperbolic tangent of a value,
17823
19198
           *
17824
19199
           *    sinh, cosh, coth
17825
19200
           *
17826
 
           * @param {Number | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
17827
 
           * @return {Number | Complex | Array | Matrix} Hyperbolic tangent of x
 
19201
           * @param {Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null} x  Function input
 
19202
           * @return {Number | BigNumber | Complex | Array | Matrix} Hyperbolic tangent of x
17828
19203
           */
17829
19204
          math.tanh = function tanh(x) {
17830
19205
            if (arguments.length != 1) {
17863
19238
            }
17864
19239
 
17865
19240
            if (x instanceof BigNumber) {
17866
 
              // TODO: implement BigNumber support
17867
 
              // downgrade to Number
17868
 
              return tanh(x.toNumber());
 
19241
              return bigTanh(x, BigNumber, false);
17869
19242
            }
17870
19243
 
17871
19244
            throw new math.error.UnsupportedTypeError('tanh', math['typeof'](x));
17874
19247
 
17875
19248
 
17876
19249
/***/ },
17877
 
/* 142 */
 
19250
/* 154 */
17878
19251
/***/ function(module, exports, __webpack_require__) {
17879
19252
 
17880
19253
        'use strict';
17881
19254
 
17882
19255
        module.exports = function (math) {
17883
 
          var util = __webpack_require__(160),
 
19256
          var util = __webpack_require__(171),
17884
19257
 
17885
 
              Unit = __webpack_require__(10),
17886
 
              collection = __webpack_require__(13),
 
19258
              Unit = __webpack_require__(11),
 
19259
              collection = __webpack_require__(14),
17887
19260
 
17888
19261
              isString = util.string.isString,
17889
19262
              isUnit = Unit.isUnit,
17936
19309
 
17937
19310
 
17938
19311
/***/ },
17939
 
/* 143 */
 
19312
/* 155 */
17940
19313
/***/ function(module, exports, __webpack_require__) {
17941
19314
 
17942
19315
        'use strict';
17943
19316
 
17944
19317
        module.exports = function (math) {
17945
 
          var util = __webpack_require__(160),
 
19318
          var util = __webpack_require__(171),
17946
19319
              object = util.object;
17947
19320
 
17948
19321
          /**
17954
19327
           *
17955
19328
           * Examples:
17956
19329
           *
17957
 
           *    math.clone(3.5);              // returns number 3.5
17958
 
           *    math.clone(2 - 4i);           // returns Complex 2 - 4i
17959
 
           *    math.clone(45 deg);           // returns Unit 45 deg
17960
 
           *    math.clone([[1, 2], [3, 4]]); // returns Array [[1, 2], [3, 4]]
17961
 
           *    math.clone("hello world");    // returns string "hello world"
 
19330
           *    math.clone(3.5);                   // returns number 3.5
 
19331
           *    math.clone(math.complex('2 - 4i'); // returns Complex 2 - 4i
 
19332
           *    math.clone(math.unit(45, 'deg'));  // returns Unit 45 deg
 
19333
           *    math.clone([[1, 2], [3, 4]]);      // returns Array [[1, 2], [3, 4]]
 
19334
           *    math.clone("hello world");         // returns string "hello world"
17962
19335
           *
17963
19336
           * @param {*} x   Object to be cloned
17964
19337
           * @return {*} A clone of object x
17974
19347
 
17975
19348
 
17976
19349
/***/ },
17977
 
/* 144 */
 
19350
/* 156 */
17978
19351
/***/ function(module, exports, __webpack_require__) {
17979
19352
 
17980
19353
        'use strict';
17981
19354
 
17982
19355
        module.exports = function (math) {
17983
 
          var Matrix = __webpack_require__(9);
 
19356
          var Matrix = __webpack_require__(10);
17984
19357
 
17985
19358
          /**
17986
19359
           * Sort the items in a matrix.
18054
19427
        };
18055
19428
 
18056
19429
/***/ },
18057
 
/* 145 */
 
19430
/* 157 */
18058
19431
/***/ function(module, exports, __webpack_require__) {
18059
19432
 
18060
19433
        'use strict';
18061
19434
 
18062
19435
        module.exports = function (math) {
18063
 
          var util = __webpack_require__(160),
 
19436
          var util = __webpack_require__(171),
18064
19437
              string = util.string;
18065
19438
 
18066
19439
          /**
18139
19512
 
18140
19513
 
18141
19514
/***/ },
18142
 
/* 146 */
 
19515
/* 158 */
18143
19516
/***/ function(module, exports, __webpack_require__) {
18144
19517
 
18145
19518
        'use strict';
18146
19519
 
18147
19520
        module.exports = function (math) {
18148
 
          var util = __webpack_require__(160),
 
19521
          var util = __webpack_require__(171),
18149
19522
 
18150
 
              Complex = __webpack_require__(6),
18151
 
              Unit = __webpack_require__(10),
 
19523
              Complex = __webpack_require__(7),
 
19524
              Unit = __webpack_require__(11),
18152
19525
 
18153
19526
              isNumber = util.number.isNumber,
18154
19527
              isString = util.string.isString,
18218
19591
              // istanbul ignore else (we cannot unit test the else case in a node.js environment)
18219
19592
              if (true) {
18220
19593
                // load the file using require
18221
 
                var _module = __webpack_require__(195)(object);
 
19594
                var _module = __webpack_require__(202)(object);
18222
19595
                math_import(_module, options);
18223
19596
              }
18224
19597
              else {
18264
19637
                  }
18265
19638
                  return value.apply(math, args);
18266
19639
                };
 
19640
                if (value && value.transform) {
 
19641
                  math[name].transform = value.transform;
 
19642
                }
18267
19643
              }
18268
19644
              else {
18269
19645
                // just create a link to the function or value
18270
19646
                math[name] = value;
18271
19647
              }
18272
19648
 
 
19649
              // register the transform function if any
 
19650
              if (value && value.transform) {
 
19651
                math.expression.transform[name] = value.transform;
 
19652
              }
 
19653
 
18273
19654
              // create a proxy for the chain
18274
19655
              math.chaining.Chain.createProxy(name, value);
18275
19656
            }
18291
19672
 
18292
19673
 
18293
19674
/***/ },
18294
 
/* 147 */
 
19675
/* 159 */
18295
19676
/***/ function(module, exports, __webpack_require__) {
18296
19677
 
18297
19678
        'use strict';
18298
19679
 
18299
19680
        module.exports = function (math) {
18300
 
          var Matrix = __webpack_require__(9);
 
19681
          var Matrix = __webpack_require__(10);
18301
19682
 
18302
19683
 
18303
19684
          /**
18357
19738
 
18358
19739
 
18359
19740
/***/ },
18360
 
/* 148 */
 
19741
/* 160 */
18361
19742
/***/ function(module, exports, __webpack_require__) {
18362
19743
 
18363
19744
        'use strict';
18364
19745
 
18365
19746
        module.exports = function (math) {
18366
 
          var util = __webpack_require__(160),
 
19747
          var util = __webpack_require__(171),
18367
19748
 
18368
19749
              isString = util.string.isString;
18369
19750
 
18441
19822
 
18442
19823
 
18443
19824
/***/ },
18444
 
/* 149 */
 
19825
/* 161 */
18445
19826
/***/ function(module, exports, __webpack_require__) {
18446
19827
 
18447
19828
        'use strict';
18448
19829
 
18449
19830
        module.exports = function (math) {
18450
 
          var Matrix = __webpack_require__(9);
 
19831
          var Matrix = __webpack_require__(10);
18451
19832
 
18452
19833
          /**
18453
19834
           * Sort the items in a matrix.
18521
19902
        };
18522
19903
 
18523
19904
/***/ },
18524
 
/* 150 */
 
19905
/* 162 */
18525
19906
/***/ function(module, exports, __webpack_require__) {
18526
19907
 
18527
19908
        'use strict';
18528
19909
 
18529
19910
        module.exports = function (math) {
18530
 
          var types = __webpack_require__(196),
 
19911
          var types = __webpack_require__(334),
18531
19912
 
18532
 
              Complex = __webpack_require__(6),
18533
 
              Matrix = __webpack_require__(9),
18534
 
              Unit = __webpack_require__(10),
18535
 
              Index = __webpack_require__(8),
18536
 
              Range = __webpack_require__(7),
18537
 
              Help = __webpack_require__(11);
 
19913
              Complex = __webpack_require__(7),
 
19914
              Matrix = __webpack_require__(10),
 
19915
              Unit = __webpack_require__(11),
 
19916
              Index = __webpack_require__(9),
 
19917
              Range = __webpack_require__(8),
 
19918
              Help = __webpack_require__(12);
18538
19919
 
18539
19920
          /**
18540
19921
           * Determine the type of a variable.
18603
19984
 
18604
19985
 
18605
19986
/***/ },
18606
 
/* 151 */
 
19987
/* 163 */
18607
19988
/***/ function(module, exports, __webpack_require__) {
18608
19989
 
18609
19990
        'use strict';
18610
19991
 
18611
19992
        module.exports = function (math) {
18612
 
          var Matrix = __webpack_require__(9);
 
19993
          var Matrix = __webpack_require__(10);
18613
19994
 
18614
19995
          /**
18615
19996
           * Iterate over all elements of a matrix/array, and executes the given callback function.
18665
20046
        };
18666
20047
 
18667
20048
/***/ },
18668
 
/* 152 */
 
20049
/* 164 */
18669
20050
/***/ function(module, exports, __webpack_require__) {
18670
20051
 
18671
20052
        'use strict';
18672
20053
 
18673
 
        var BigNumber = __webpack_require__(159);
18674
 
        var isNumber = __webpack_require__(4).isNumber;
18675
 
        var digits = __webpack_require__(4).digits;
 
20054
        var BigNumber = __webpack_require__(5);
 
20055
        var isNumber = __webpack_require__(3).isNumber;
 
20056
        var digits = __webpack_require__(3).digits;
 
20057
        var memoize = __webpack_require__(335).memoize;
18676
20058
 
18677
20059
        /**
18678
20060
         * Test whether value is a BigNumber
18684
20066
        };
18685
20067
 
18686
20068
 
18687
 
        /* BigNumber constants. */
18688
 
 
 
20069
        /*************************************
 
20070
         *             Constants             *
 
20071
         *************************************/
18689
20072
 
18690
20073
        /**
18691
20074
         * Calculate BigNumber e
18692
20075
         * @param {Number} precision
18693
20076
         * @returns {BigNumber} Returns e
18694
20077
         */
18695
 
        exports.e = function (precision) {
 
20078
        exports.e = memoize(function (precision) {
18696
20079
          var Big = BigNumber.constructor({precision: precision});
18697
20080
 
18698
20081
          return new Big(1).exp();
18699
 
        };
 
20082
        });
18700
20083
 
18701
20084
        /**
18702
20085
         * Calculate BigNumber golden ratio, phi = (1+sqrt(5))/2
18703
20086
         * @param {Number} precision
18704
20087
         * @returns {BigNumber} Returns phi
18705
20088
         */
18706
 
        exports.phi = function (precision) {
 
20089
        exports.phi = memoize(function (precision) {
18707
20090
          var Big = BigNumber.constructor({precision: precision});
18708
20091
 
18709
20092
          return new Big(1).plus(new Big(5).sqrt()).div(2);
18710
 
        };
18711
 
 
18712
 
        /**
18713
 
         * Calculate the arc tangent of x
18714
 
         *
18715
 
         * arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + x^9/9 - ...
18716
 
         *           = x - x^2*x^1/3 + x^2*x^3/5 - x^2*x^5/7 + x^2*x^7/9 - ...
18717
 
         *
18718
 
         * @param {BigNumber} x
18719
 
         * @returns {BigNumber} arc tangent of x
18720
 
         */
18721
 
        exports.arctan = function (x) {
18722
 
          var y = x;
18723
 
          var yPrev = NaN;
18724
 
          var x2 = x.times(x);
18725
 
          var num = x;
18726
 
          var sign = -1;
18727
 
 
18728
 
          for (var k = 3; !y.equals(yPrev); k += 2) {
18729
 
            num = num.times(x2);
18730
 
 
18731
 
            yPrev = y;
18732
 
            y = (sign > 0) ? y.plus(num.div(k)) : y.minus(num.div(k));
18733
 
            sign = -sign;
18734
 
          }
18735
 
 
18736
 
          return y;
18737
 
        };
 
20093
        });
18738
20094
 
18739
20095
        /**
18740
20096
         * Calculate BigNumber pi.
18744
20100
         * @param {Number} precision
18745
20101
         * @returns {BigNumber} Returns pi
18746
20102
         */
18747
 
        exports.pi = function (precision) {
 
20103
        exports.pi = memoize(function (precision) {
18748
20104
          // we calculate pi with a few decimal places extra to prevent round off issues
18749
20105
          var Big = BigNumber.constructor({precision: precision + 4});
18750
 
          var pi4th = new Big(4).times(exports.arctan(new Big(1).div(5)))
18751
 
              .minus(exports.arctan(new Big(1).div(239)));
 
20106
          var pi4th = new Big(4).times(arctan_taylor(new Big(1).div(5)))
 
20107
              .minus(arctan_taylor(new Big(1).div(239)));
18752
20108
 
18753
20109
          Big.config({precision: precision});
18754
20110
 
18755
20111
          // the final pi has the requested number of decimals
18756
20112
          return new Big(4).times(pi4th);
18757
 
        };
 
20113
        });
18758
20114
 
18759
20115
        /**
18760
20116
         * Calculate BigNumber tau, tau = 2 * pi
18761
20117
         * @param {Number} precision
18762
20118
         * @returns {BigNumber} Returns tau
18763
20119
         */
18764
 
        exports.tau = function (precision) {
 
20120
        exports.tau = memoize(function (precision) {
18765
20121
          // we calculate pi at a slightly higher precision than configured to prevent round off errors
18766
20122
          // when multiplying by two in the end
18767
20123
 
18770
20126
          var Big = BigNumber.constructor({precision: precision});
18771
20127
 
18772
20128
          return new Big(2).times(pi);
18773
 
        };
18774
 
 
18775
 
 
18776
 
        /* BigNumber functions. */
18777
 
 
 
20129
        });
 
20130
 
 
20131
 
 
20132
        /*************************************
 
20133
         *         Bitwise functions         *
 
20134
         *************************************/
18778
20135
 
18779
20136
        /*
18780
20137
         * Special Cases:
18800
20157
            throw new Error('Parameters in function bitAnd must be integer numbers');
18801
20158
          }
18802
20159
 
18803
 
          var BigNumber = x['constructor'];
 
20160
          var BigNumber = x.constructor;
18804
20161
          if (x.isNaN() || y.isNaN()) {
18805
20162
            return new BigNumber(NaN);
18806
20163
          }
18862
20219
            throw new Error('Parameters in function leftShift must be integer numbers');
18863
20220
          }
18864
20221
 
18865
 
          var BigNumber = x['constructor'];
 
20222
          var BigNumber = x.constructor;
18866
20223
          if (x.isNaN() || y.isNaN() || (y.isNegative() && !y.isZero())) {
18867
20224
            return new BigNumber(NaN);
18868
20225
          }
18890
20247
            throw new Error('Parameter in function bitNot must be integer numbers');
18891
20248
          }
18892
20249
 
18893
 
          var BigNumber = x['constructor'];
18894
 
          var prevPrec = BigNumber['precision'];
18895
 
          BigNumber['precision'] = 1E9;
18896
 
 
18897
 
          var x = x.plus(BigNumber['ONE']);
18898
 
          x['s'] = -x['s'] || null;
18899
 
 
18900
 
          BigNumber['precision'] = prevPrec;
 
20250
          var BigNumber = x.constructor;
 
20251
          var prevPrec = BigNumber.precision;
 
20252
          BigNumber.config({precision: 1E9});
 
20253
 
 
20254
          var x = x.plus(BigNumber.ONE);
 
20255
          x.s = -x.s || null;
 
20256
 
 
20257
          BigNumber.config({precision: prevPrec});
18901
20258
          return x;
18902
20259
        };
18903
20260
 
18925
20282
            throw new Error('Parameters in function bitOr must be integer numbers');
18926
20283
          }
18927
20284
 
18928
 
          var BigNumber = x['constructor'];
 
20285
          var BigNumber = x.constructor;
18929
20286
          if (x.isNaN() || y.isNaN()) {
18930
20287
            return new BigNumber(NaN);
18931
20288
          }
18941
20298
          if (!x.isFinite() || !y.isFinite()) {
18942
20299
            if ((!x.isFinite() && !x.isNegative() && y.isNegative()) ||
18943
20300
                   (x.isNegative() && !y.isNegative() && !y.isFinite())) {
18944
 
                return negOne;
 
20301
              return negOne;
18945
20302
            }
18946
20303
            if (x.isNegative() && y.isNegative()) {
18947
 
                return x.isFinite() ? x : y;
 
20304
              return x.isFinite() ? x : y;
18948
20305
            }
18949
20306
            return x.isFinite() ? y : x;
18950
20307
          }
18975
20332
            throw new Error('Parameters in function rightArithShift must be integer numbers');
18976
20333
          }
18977
20334
 
18978
 
          var BigNumber = x['constructor'];
 
20335
          var BigNumber = x.constructor;
18979
20336
          if (x.isNaN() || y.isNaN() || (y.isNegative() && !y.isZero())) {
18980
20337
            return new BigNumber(NaN);
18981
20338
          }
19021
20378
            throw new Error('Parameters in function bitXor must be integer numbers');
19022
20379
          }
19023
20380
 
19024
 
          var BigNumber = x['constructor'];
 
20381
          var BigNumber = x.constructor;
19025
20382
          if (x.isNaN() || y.isNaN()) {
19026
20383
            return new BigNumber(NaN);
19027
20384
          }
19055
20412
          return bitwise(x, y, function (a, b) { return a ^ b });
19056
20413
        };
19057
20414
 
19058
 
 
19059
 
        /**
19060
 
         * Convert a number to a formatted string representation.
19061
 
         *
19062
 
         * Syntax:
19063
 
         *
19064
 
         *    format(value)
19065
 
         *    format(value, options)
19066
 
         *    format(value, precision)
19067
 
         *    format(value, fn)
19068
 
         *
19069
 
         * Where:
19070
 
         *
19071
 
         *    {Number} value   The value to be formatted
19072
 
         *    {Object} options An object with formatting options. Available options:
19073
 
         *                     {String} notation
19074
 
         *                         Number notation. Choose from:
19075
 
         *                         'fixed'          Always use regular number notation.
19076
 
         *                                          For example '123.40' and '14000000'
19077
 
         *                         'exponential'    Always use exponential notation.
19078
 
         *                                          For example '1.234e+2' and '1.4e+7'
19079
 
         *                         'auto' (default) Regular number notation for numbers
19080
 
         *                                          having an absolute value between
19081
 
         *                                          `lower` and `upper` bounds, and uses
19082
 
         *                                          exponential notation elsewhere.
19083
 
         *                                          Lower bound is included, upper bound
19084
 
         *                                          is excluded.
19085
 
         *                                          For example '123.4' and '1.4e7'.
19086
 
         *                     {Number} precision   A number between 0 and 16 to round
19087
 
         *                                          the digits of the number.
19088
 
         *                                          In case of notations 'exponential' and
19089
 
         *                                          'auto', `precision` defines the total
19090
 
         *                                          number of significant digits returned
19091
 
         *                                          and is undefined by default.
19092
 
         *                                          In case of notation 'fixed',
19093
 
         *                                          `precision` defines the number of
19094
 
         *                                          significant digits after the decimal
19095
 
         *                                          point, and is 0 by default.
19096
 
         *                     {Object} exponential An object containing two parameters,
19097
 
         *                                          {Number} lower and {Number} upper,
19098
 
         *                                          used by notation 'auto' to determine
19099
 
         *                                          when to return exponential notation.
19100
 
         *                                          Default values are `lower=1e-3` and
19101
 
         *                                          `upper=1e5`.
19102
 
         *                                          Only applicable for notation `auto`.
19103
 
         *    {Function} fn    A custom formatting function. Can be used to override the
19104
 
         *                     built-in notations. Function `fn` is called with `value` as
19105
 
         *                     parameter and must return a string. Is useful for example to
19106
 
         *                     format all values inside a matrix in a particular way.
19107
 
         *
19108
 
         * Examples:
19109
 
         *
19110
 
         *    format(6.4);                                        // '6.4'
19111
 
         *    format(1240000);                                    // '1.24e6'
19112
 
         *    format(1/3);                                        // '0.3333333333333333'
19113
 
         *    format(1/3, 3);                                     // '0.333'
19114
 
         *    format(21385, 2);                                   // '21000'
19115
 
         *    format(12.071, {notation: 'fixed'});                // '12'
19116
 
         *    format(2.3,    {notation: 'fixed', precision: 2});  // '2.30'
19117
 
         *    format(52.8,   {notation: 'exponential'});          // '5.28e+1'
19118
 
         *
19119
 
         * @param {BigNumber} value
19120
 
         * @param {Object | Function | Number} [options]
19121
 
         * @return {String} str The formatted value
19122
 
         */
19123
 
        exports.format = function(value, options) {
19124
 
          if (typeof options === 'function') {
19125
 
            // handle format(value, fn)
19126
 
            return options(value);
19127
 
          }
19128
 
 
19129
 
          // handle special cases
19130
 
          if (!value.isFinite()) {
19131
 
            return value.isNaN() ? 'NaN' : (value.gt(0) ? 'Infinity' : '-Infinity');
19132
 
          }
19133
 
 
19134
 
          // default values for options
19135
 
          var notation = 'auto';
19136
 
          var precision = undefined;
19137
 
 
19138
 
          if (options !== undefined) {
19139
 
            // determine notation from options
19140
 
            if (options.notation) {
19141
 
              notation = options.notation;
19142
 
            }
19143
 
 
19144
 
            // determine precision from options
19145
 
            if (isNumber(options)) {
19146
 
              precision = options;
19147
 
            }
19148
 
            else if (options.precision) {
19149
 
              precision = options.precision;
19150
 
            }
19151
 
          }
19152
 
 
19153
 
          // handle the various notations
19154
 
          switch (notation) {
19155
 
            case 'fixed':
19156
 
              return exports.toFixed(value, precision);
19157
 
 
19158
 
            case 'exponential':
19159
 
              return exports.toExponential(value, precision);
19160
 
 
19161
 
            case 'auto':
19162
 
              // determine lower and upper bound for exponential notation.
19163
 
                // TODO: implement support for upper and lower to be BigNumbers themselves
19164
 
              var lower = 1e-3;
19165
 
              var upper = 1e5;
19166
 
              if (options && options.exponential) {
19167
 
                if (options.exponential.lower !== undefined) {
19168
 
                  lower = options.exponential.lower;
19169
 
                }
19170
 
                if (options.exponential.upper !== undefined) {
19171
 
                  upper = options.exponential.upper;
19172
 
                }
19173
 
              }
19174
 
 
19175
 
              // adjust the configuration of the BigNumber constructor (yeah, this is quite tricky...)
19176
 
              var oldConfig = {
19177
 
                toExpNeg: value.constructor.toExpNeg,
19178
 
                toExpPos: value.constructor.toExpPos
19179
 
              };
19180
 
 
19181
 
              value.constructor.config({
19182
 
                toExpNeg: Math.round(Math.log(lower) / Math.LN10),
19183
 
                toExpPos: Math.round(Math.log(upper) / Math.LN10)
19184
 
              });
19185
 
 
19186
 
              // handle special case zero
19187
 
              if (value.isZero()) return '0';
19188
 
 
19189
 
              // determine whether or not to output exponential notation
19190
 
              var str;
19191
 
              var abs = value.abs();
19192
 
              if (abs.gte(lower) && abs.lt(upper)) {
19193
 
                // normal number notation
19194
 
                str = value.toSignificantDigits(precision).toFixed();
19195
 
              }
19196
 
              else {
19197
 
                // exponential notation
19198
 
                str = exports.toExponential(value, precision);
19199
 
              }
19200
 
 
19201
 
              // remove trailing zeros after the decimal point
19202
 
              return str.replace(/((\.\d*?)(0+))($|e)/, function () {
19203
 
                var digits = arguments[2];
19204
 
                var e = arguments[4];
19205
 
                return (digits !== '.') ? digits + e : e;
19206
 
              });
19207
 
 
19208
 
            default:
19209
 
              throw new Error('Unknown notation "' + notation + '". ' +
19210
 
                  'Choose "auto", "exponential", or "fixed".');
19211
 
          }
19212
 
        };
19213
 
 
19214
 
        /**
19215
 
         * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'
19216
 
         * @param {BigNumber} value
19217
 
         * @param {Number} [precision]  Number of digits in formatted output.
19218
 
         *                              If not provided, the maximum available digits
19219
 
         *                              is used.
19220
 
         * @returns {string} str
19221
 
         */
19222
 
        exports.toExponential = function(value, precision) {
19223
 
          if (precision !== undefined) {
19224
 
            return value.toExponential(precision - 1); // Note the offset of one
19225
 
          }
19226
 
          else {
19227
 
            return value.toExponential();
19228
 
          }
19229
 
        };
19230
 
 
19231
 
        /**
19232
 
         * Format a number with fixed notation.
19233
 
         * @param {BigNumber} value
19234
 
         * @param {Number} [precision=0]        Optional number of decimals after the
19235
 
         *                                      decimal point. Zero by default.
19236
 
         */
19237
 
        exports.toFixed = function(value, precision) {
19238
 
          return value.toFixed(precision || 0);
19239
 
          // Note: the (precision || 0) is needed as the toFixed of BigNumber has an
19240
 
          // undefined default precision instead of 0.
19241
 
        };
19242
 
 
19243
 
 
19244
 
        /* Private functions. */
19245
 
 
19246
 
 
 
20415
        /* Applies bitwise function to numbers. */
19247
20416
        function bitwise(x, y, func) {
19248
 
          var BigNumber = x['constructor'];
 
20417
          var BigNumber = x.constructor;
19249
20418
 
19250
20419
          var xBits, yBits;
19251
 
          var xSign = +(x['s'] < 0);
19252
 
          var ySign = +(y['s'] < 0);
 
20420
          var xSign = +(x.s < 0);
 
20421
          var ySign = +(y.s < 0);
19253
20422
          if (xSign) {
19254
 
            xBits = decToBinary(coefficientToString(exports.not(x)));
 
20423
            xBits = decCoefficientToBinaryString(exports.not(x));
19255
20424
            for (var i = 0; i < xBits.length; ++i) {
19256
20425
              xBits[i] ^= 1;
19257
20426
            }
19258
20427
          } else {
19259
 
            xBits = decToBinary(coefficientToString(x));
 
20428
            xBits = decCoefficientToBinaryString(x);
19260
20429
          }
19261
20430
          if (ySign) {
19262
 
            yBits = decToBinary(coefficientToString(exports.not(y)));
 
20431
            yBits = decCoefficientToBinaryString(exports.not(y));
19263
20432
            for (var i = 0; i < yBits.length; ++i) {
19264
20433
              yBits[i] ^= 1;
19265
20434
            }
19266
20435
          } else {
19267
 
            yBits = decToBinary(coefficientToString(y));
 
20436
            yBits = decCoefficientToBinaryString(y);
19268
20437
          }
19269
20438
 
19270
20439
          var minBits, maxBits, minSign;
19282
20451
          var longLen = maxBits.length;
19283
20452
          var expFuncVal = func(xSign, ySign) ^ 1;
19284
20453
          var outVal = new BigNumber(expFuncVal ^ 1);
19285
 
          var twoPower = BigNumber['ONE'];
 
20454
          var twoPower = BigNumber.ONE;
19286
20455
          var two = new BigNumber(2);
19287
20456
 
19288
 
          var prevPrec = BigNumber['precision'];
19289
 
          BigNumber['precision'] = 1E9;
 
20457
          var prevPrec = BigNumber.precision;
 
20458
          BigNumber.config({precision: 1E9});
19290
20459
 
19291
20460
          while (shortLen > 0) {
19292
20461
            if (func(minBits[--shortLen], maxBits[--longLen]) == expFuncVal) {
19301
20470
            twoPower = twoPower.times(two);
19302
20471
          }
19303
20472
 
19304
 
          BigNumber['precision'] = prevPrec;
 
20473
          BigNumber.config({precision: prevPrec});
19305
20474
 
19306
20475
          if (expFuncVal == 0) {
19307
 
            outVal['s'] = -outVal['s'];
 
20476
            outVal.s = -outVal.s;
19308
20477
          }
19309
20478
          return outVal;
19310
20479
        }
19311
20480
 
19312
 
 
19313
 
        /* Private functions extracted from decimal.js, and edited to specialize. */
19314
 
 
19315
 
 
19316
 
        function coefficientToString(x) {
19317
 
          var a = x['c'];
 
20481
        /* Extracted from decimal.js, and edited to specialize. */
 
20482
        function decCoefficientToBinaryString(x) {
 
20483
          // Convert to string
 
20484
          var a = x.c;
19318
20485
          var r = a[0] + '';
19319
20486
 
19320
20487
          for (var i = 1; i < a.length; ++i) {
19329
20496
          var j;
19330
20497
          for (j = r.length - 1; r.charAt(j) == '0'; --j);
19331
20498
 
19332
 
          var xe = x['e'];
 
20499
          var xe = x.e;
19333
20500
          var str = r.slice(0, j + 1 || 1);
19334
20501
          var strL = str.length;
19335
20502
          if (xe > 0) {
19340
20507
              str = str.slice(0, xe) + '.' + str.slice(xe);
19341
20508
            }
19342
20509
          }
19343
 
          return str;
19344
 
        }
19345
20510
 
19346
 
        function decToBinary(str) {
 
20511
          // Convert from base 10 (decimal) to base 2
19347
20512
          var arr = [0];
19348
20513
          for (var i = 0; i < str.length; ) {
19349
20514
            for (var arrL = arr.length; arrL--; arr[arrL] *= 10);
19365
20530
        }
19366
20531
 
19367
20532
 
 
20533
        /*************************************
 
20534
         *      Trigonometric functions      *
 
20535
         *************************************/
 
20536
 
 
20537
        /**
 
20538
         * Calculate the arccosine or arcsecant of x
 
20539
         *
 
20540
         * acos(x) = 2*atan(sqrt(1-x^2)/(1+x))
 
20541
         *
 
20542
         * asec(x) = acos(1/x)
 
20543
         *
 
20544
         * @param {BigNumber} x
 
20545
         * @param {DecimalFactory} Big   current BigNumber constructor
 
20546
         * @param {Boolean} reciprocal   is sec
 
20547
         * @returns {BigNumber} arccosine or arcsecant of x
 
20548
         */
 
20549
        exports.arccos_arcsec = function (x, Big, reciprocal) {
 
20550
          var precision = Big.precision;
 
20551
          if (reciprocal) {
 
20552
            if (x.abs().lt(Big.ONE)) {
 
20553
              throw new Error('asec() only has non-complex values for |x| >= 1.');
 
20554
            }
 
20555
          } else if (x.abs().gt(Big.ONE)) {
 
20556
            throw new Error('acos() only has non-complex values for |x| <= 1.');
 
20557
          }
 
20558
          if (x.eq(-1)) {
 
20559
            return exports.pi(precision);
 
20560
          }
 
20561
 
 
20562
          Big.config({precision: precision + 4});
 
20563
 
 
20564
          if (reciprocal) {
 
20565
            x = Big.ONE.div(x);
 
20566
          }
 
20567
 
 
20568
          var acos = exports.arctan_arccot(Big.ONE.minus(x.times(x)).sqrt()
 
20569
                                              .div(x.plus(Big.ONE)), Big).times(2);
 
20570
 
 
20571
          Big.config({precision: precision});
 
20572
          return acos.toDP(precision - 1);
 
20573
        };
 
20574
 
 
20575
        /**
 
20576
         * Calculate the arcsine or arccosecant of x
 
20577
         *
 
20578
         * @param {BigNumber} x
 
20579
         * @param {DecimalFactory} Big   current BigNumber constructor
 
20580
         * @param {Boolean} reciprocal   is csc
 
20581
         * @returns {BigNumber} arcsine or arccosecant of x
 
20582
         */
 
20583
        exports.arcsin_arccsc = function (x, Big, reciprocal) {
 
20584
          if (x.isNaN()) {
 
20585
            return new Big(NaN);
 
20586
          }
 
20587
 
 
20588
          var precision = Big.precision;
 
20589
          var absX = x.abs();
 
20590
          if (reciprocal) {
 
20591
            if (absX.lt(Big.ONE)) {
 
20592
              throw new Error('acsc() only has non-complex values for |x| >= 1.');
 
20593
            }
 
20594
 
 
20595
            Big.config({precision: precision + 2});
 
20596
            x = Big.ONE.div(x);
 
20597
            Big.config({precision: precision});
 
20598
 
 
20599
            absX = x.abs();
 
20600
          } else if (absX.gt(Big.ONE)) {
 
20601
            throw new Error('asin() only has non-complex values for |x| <= 1.');
 
20602
          }
 
20603
 
 
20604
          // Get x below 0.58
 
20605
          if (absX.gt(0.8)) {
 
20606
            Big.config({precision: precision + 4});
 
20607
 
 
20608
            // arcsin(x) = sign(x)*(Pi/2 - arcsin(sqrt(1 - x^2)))
 
20609
            var sign = x.s;
 
20610
            var halfPi = exports.pi(precision + 4).div(2);
 
20611
            x = halfPi.minus(exports.arcsin_arccsc(Big.ONE.minus(x.times(x)).sqrt(), Big));
 
20612
            x.s = sign;
 
20613
 
 
20614
            x.constructor = Big;
 
20615
            Big.config({precision: precision});
 
20616
            return x.toDP(precision - 1);
 
20617
          }
 
20618
          var wasReduced = absX.gt(0.58);
 
20619
          if (wasReduced) {
 
20620
            Big.config({precision: precision + 8});
 
20621
 
 
20622
            // arcsin(x) = 2*arcsin(x / (sqrt(2)*sqrt(sqrt(1 - x^2) + 1)))
 
20623
            x = x.div(new Big(2).sqrt().times(Big.ONE.minus(x.times(x)).sqrt()
 
20624
                  .plus(Big.ONE).sqrt()));
 
20625
 
 
20626
            Big.config({precision: precision});
 
20627
          }
 
20628
 
 
20629
          // Avoid overhead of Newton's Method if feasible
 
20630
          var ret = (precision <= 60 || ((x.dp() <= Math.log(precision)) && x.lt(0.05)))
 
20631
            ? arcsin_taylor(x, precision)
 
20632
            : arcsin_newton(x, Big);
 
20633
 
 
20634
          if (wasReduced) {
 
20635
            return ret.times(2);
 
20636
          }
 
20637
          return ret;
 
20638
        };
 
20639
 
 
20640
        /**
 
20641
         * Calculate the arctangent or arccotangent of x
 
20642
         *
 
20643
         * @param {BigNumber} x
 
20644
         * @param {DecimalFactory} Big   current BigNumber constructor
 
20645
         * @param {Boolean} reciprocal   is cot
 
20646
         * @returns {BigNumber} arctangent or arccotangent of x
 
20647
         */
 
20648
        exports.arctan_arccot = function (x, Big, reciprocal) {
 
20649
          if (x.isNaN()) {
 
20650
            return new Big(NaN);
 
20651
          }
 
20652
          if ((!reciprocal && x.isZero()) || (reciprocal && !x.isFinite())) {
 
20653
            return new Big(0);
 
20654
          }
 
20655
 
 
20656
          var precision = Big.precision;
 
20657
          if ((!reciprocal && !x.isFinite()) || (reciprocal && x.isZero())) {
 
20658
            var halfPi = exports.pi(precision + 2).div(2).toDP(precision - 1);
 
20659
            halfPi.s = x.s;
 
20660
 
 
20661
            return halfPi;
 
20662
          }
 
20663
 
 
20664
          Big.config({precision: precision + 4});
 
20665
 
 
20666
          if (reciprocal) {
 
20667
            x = Big.ONE.div(x);
 
20668
          }
 
20669
 
 
20670
          var absX = x.abs();
 
20671
          if (absX.lte(0.875)) {
 
20672
            var ret = arctan_taylor(x);
 
20673
 
 
20674
            ret.constructor = Big;
 
20675
            Big.config({precision: precision});
 
20676
            return ret.toDP(Big.precision - 1);
 
20677
          }
 
20678
          if (absX.gte(1.143)) {
 
20679
            // arctan(x) = sign(x)*((PI / 2) - arctan(1 / |x|))
 
20680
            var halfPi = exports.pi(precision + 4).div(2);
 
20681
            var ret = halfPi.minus(arctan_taylor(Big.ONE.div(absX)));
 
20682
            ret.s = x.s;
 
20683
 
 
20684
            ret.constructor = Big;
 
20685
            Big.config({precision: precision});
 
20686
            return ret.toDP(Big.precision - 1);
 
20687
          }
 
20688
 
 
20689
          // arctan(x) = arcsin(x / [sqrt(1 + x^2)])
 
20690
          x = x.div(x.times(x).plus(1).sqrt());
 
20691
 
 
20692
          Big.config({precision: precision});
 
20693
          return exports.arcsin_arccsc(x, Big);
 
20694
        };
 
20695
 
 
20696
        /**
 
20697
         * Calculate the hyperbolic arccosine, arcsine, arcsecant, or arccosecant of x
 
20698
         *
 
20699
         * acosh(x) = ln(x + sqrt(x^2 - 1))
 
20700
         *
 
20701
         * asinh(x) = ln(x + sqrt(x^2 + 1))
 
20702
         *
 
20703
         * asech(x) = acosh(1 / x)
 
20704
         *
 
20705
         * acsch(x) = asinh(1 / x)
 
20706
         *
 
20707
         * @param {BigNumber} x
 
20708
         * @param {DecimalFactory} Big   current BigNumber constructor
 
20709
         * @param {Boolean} mode         sine function if true, cosine function if false
 
20710
         * @param {Boolean} reciprocal   is sec or csc
 
20711
         * @returns {BigNumber} hyperbolic arccosine, arcsine, arcsecant, or arccosecant of x
 
20712
         */
 
20713
        exports.acosh_asinh_asech_acsch = function (x, Big, mode, reciprocal) {
 
20714
          if (x.isNaN()) {
 
20715
            return new Big(NaN);
 
20716
          }
 
20717
          if (reciprocal && x.isZero()) {
 
20718
            return new Big(Infinity);
 
20719
          }
 
20720
          if (!mode) {
 
20721
            if (reciprocal) {
 
20722
              if (x.isNegative() || x.gt(Big.ONE)) {
 
20723
                throw new Error('asech() only has non-complex values for 0 <= x <= 1.');
 
20724
              }
 
20725
            } else if (x.lt(Big.ONE)) {
 
20726
              throw new Error('acosh() only has non-complex values for x >= 1.');
 
20727
            }
 
20728
          }
 
20729
 
 
20730
          var precision = Big.precision;
 
20731
          Big.config({precision: precision + 4});
 
20732
 
 
20733
          var y = new Big(x);
 
20734
          y.constructor = Big;
 
20735
 
 
20736
          if (reciprocal) {
 
20737
            y = Big.ONE.div(y);
 
20738
          }
 
20739
 
 
20740
          var x2PlusOrMinus = (mode) ? y.times(y).plus(Big.ONE) : y.times(y).minus(Big.ONE);
 
20741
          var ret = y.plus(x2PlusOrMinus.sqrt()).ln();
 
20742
 
 
20743
          Big.config({precision: precision});
 
20744
          return new Big(ret.toPrecision(precision));
 
20745
        };
 
20746
 
 
20747
        /**
 
20748
         * Calculate the hyperbolic arctangent or arccotangent of x
 
20749
         *
 
20750
         * atanh(x) = ln((1 + x)/(1 - x)) / 2
 
20751
         *
 
20752
         * acoth(x) = atanh(1 / x)
 
20753
         *
 
20754
         * @param {BigNumber} x
 
20755
         * @param {DecimalFactory} Big   current BigNumber constructor
 
20756
         * @param {Boolean} reciprocal   is sec or csc
 
20757
         * @returns {BigNumber} hyperbolic arctangent or arccotangent of x
 
20758
         */
 
20759
        exports.atanh_acoth = function (x, Big, reciprocal) {
 
20760
          if (x.isNaN()) {
 
20761
            return new Big(NaN);
 
20762
          }
 
20763
 
 
20764
          var absX = x.abs();
 
20765
          if (absX.eq(Big.ONE)) {
 
20766
            return new Big(x.isNegative() ? -Infinity : Infinity);
 
20767
          }
 
20768
          if (absX.gt(Big.ONE)) {
 
20769
            if (!reciprocal) {
 
20770
              throw new Error('atanh() only has non-complex values for |x| <= 1.');
 
20771
            }
 
20772
          } else if (reciprocal) {
 
20773
            throw new Error('acoth() has complex values for |x| < 1.');
 
20774
          }
 
20775
 
 
20776
          if (x.isZero()) {
 
20777
            return new Big(0);
 
20778
          }
 
20779
 
 
20780
          var precision = Big.precision;
 
20781
          Big.config({precision: precision + 4});
 
20782
 
 
20783
          var y = new Big(x);
 
20784
          y.constructor = Big;
 
20785
 
 
20786
          if (reciprocal) {
 
20787
            y = Big.ONE.div(y);
 
20788
          }
 
20789
          var ret = Big.ONE.plus(y).div(Big.ONE.minus(y)).ln().div(2);
 
20790
 
 
20791
          Big.config({precision: precision});
 
20792
          return new Big(ret.toPrecision(precision));
 
20793
        };
 
20794
 
 
20795
        /**
 
20796
         * Calculate the cosine/sine of x using the multiple angle identity:
 
20797
         *
 
20798
         * cos(4x) = 8[cos(x)^4 - cos(x)^2] + 1
 
20799
         *
 
20800
         * sin(5x) = 16sin(x)^5 - 20sin(x)^3 + 5sin(x)
 
20801
         * http://www.tc.umn.edu/~ringx004/sidebar.html
 
20802
         *
 
20803
         * @param {BigNumber} x
 
20804
         * @param {DecimalFactory} Big   current BigNumber constructor
 
20805
         * @param {Number} mode          cosine function if 0, sine function if 1
 
20806
         * @param {Boolean} reciprocal   is sec or csc
 
20807
         * @returns {BigNumber} cosine, sine, secant, or cosecant of x
 
20808
         */
 
20809
        exports.cos_sin_sec_csc = function (x, Big, mode, reciprocal) {
 
20810
          if (x.isNaN() || !x.isFinite()) {
 
20811
            return new Big(NaN);
 
20812
          }
 
20813
          var precision = Big.precision;
 
20814
 
 
20815
          // Avoid changing the original value
 
20816
          var y = new Big(x);
 
20817
 
 
20818
          // sin(-x) == -sin(x), cos(-x) == cos(x)
 
20819
          var isNeg = y.isNegative();
 
20820
          if (isNeg) {
 
20821
            y.s = -y.s;
 
20822
          }
 
20823
 
 
20824
          // Apply ~log(precision) guard bits
 
20825
          var precPlusGuardDigits = precision + (Math.log(precision) | 0) + 3;
 
20826
          Big.config({precision: precPlusGuardDigits});
 
20827
 
 
20828
          y = reduceToPeriod(y, precPlusGuardDigits, mode);  // Make this destructive
 
20829
          y[0].constructor = Big;
 
20830
          if (y[1]) {
 
20831
            y = y[0];
 
20832
            if (reciprocal && y.isZero()) {
 
20833
              y = new Big(Infinity);
 
20834
            }
 
20835
 
 
20836
            Big.config({precision: precision});
 
20837
            return y;
 
20838
          }
 
20839
 
 
20840
          var ret;
 
20841
          y = y[0];
 
20842
          if (mode) {
 
20843
            ret = cos_sin_taylor(y.div(3125), mode);
 
20844
            Big.config({precision: Math.min(precPlusGuardDigits, precision + 15)});
 
20845
 
 
20846
            var five = new Big(5);
 
20847
            var sixteen = new Big(16);
 
20848
            var twenty = new Big(20);
 
20849
            for (var i = 0; i < 5; ++i) {
 
20850
              var ret2 = ret.times(ret);
 
20851
              var ret3 = ret2.times(ret);
 
20852
              var ret5 = ret3.times(ret2);
 
20853
              ret = sixteen.times(ret5).minus(
 
20854
                      twenty.times(ret3)).plus(
 
20855
                        five.times(ret));
 
20856
            }
 
20857
 
 
20858
            if (isNeg) {
 
20859
              ret.s = -ret.s;
 
20860
            }
 
20861
          } else {
 
20862
            var div_factor, loops;
 
20863
            if (y.abs().lt(Big.ONE)) {
 
20864
              div_factor = 64;
 
20865
              loops = 3;
 
20866
            } else {
 
20867
              div_factor = 256;
 
20868
              loops = 4;
 
20869
            }
 
20870
 
 
20871
            ret = cos_sin_taylor(y.div(div_factor), mode);
 
20872
            Big.config({precision: Math.min(precPlusGuardDigits, precision + 8)});
 
20873
 
 
20874
            var eight = new Big(8);
 
20875
            for (; loops > 0; --loops) {
 
20876
              var ret2 = ret.times(ret);
 
20877
              var ret4 = ret2.times(ret2);
 
20878
              ret = eight.times(ret4.minus(ret2)).plus(Big.ONE);
 
20879
            }
 
20880
          }
 
20881
 
 
20882
          if (reciprocal) {
 
20883
            ret = (ret.e <= -precision)
 
20884
              ? new Big(Infinity)
 
20885
              : Big.ONE.div(ret);
 
20886
          }
 
20887
 
 
20888
          Big.config({precision: precision});
 
20889
          return ret.toDP(precision - 1);
 
20890
        };
 
20891
 
 
20892
        /**
 
20893
         * Calculate the tangent of x
 
20894
         *
 
20895
         * tan(x) = sin(x) / cos(x)
 
20896
         *
 
20897
         * cot(x) = cos(x) / sin(x)
 
20898
         *
 
20899
         * @param {BigNumber} x
 
20900
         * @param {DecimalFactory} Big   current BigNumber constructor
 
20901
         * @param {Boolean} reciprocal   is cot
 
20902
         * @returns {BigNumber} tangent or cotangent of x
 
20903
         */
 
20904
        exports.tan_cot = function (x, Big, reciprocal) {
 
20905
          if (x.isNaN()) {
 
20906
            return new Big(NaN);
 
20907
          }
 
20908
 
 
20909
          var precision = Big.precision;
 
20910
          var pi = exports.pi(precision + 2);
 
20911
          var halfPi = pi.div(2).toDP(precision - 1);
 
20912
          pi = pi.toDP(precision - 1);
 
20913
 
 
20914
          var y = reduceToPeriod(x, precision, 1)[0];
 
20915
          if (y.abs().eq(pi)) {
 
20916
            return new Big(Infinity);
 
20917
          }
 
20918
 
 
20919
          Big.config({precision: precision + 2});
 
20920
          var sin = exports.cos_sin_sec_csc(y, Big, 1, false);
 
20921
          var cos = sinToCos(sin);
 
20922
 
 
20923
          sin = sin.toDP(precision);
 
20924
          cos = cos.toDP(precision);
 
20925
 
 
20926
          // Make sure sign for cosine is correct
 
20927
          if (y.eq(x)) {
 
20928
            if (y.gt(halfPi)) {
 
20929
              cos.s = -cos.s;
 
20930
            }
 
20931
          } else if (pi.minus(y.abs()).gt(halfPi)) {
 
20932
            cos.s = -cos.s;
 
20933
          }
 
20934
 
 
20935
          var tan = (reciprocal) ? cos.div(sin) : sin.div(cos);
 
20936
 
 
20937
          Big.config({precision: precision});
 
20938
          return new Big(tan.toPrecision(precision));
 
20939
        };
 
20940
 
 
20941
        /**
 
20942
         * Calculate the hyperbolic sine, cosine, secant, or cosecant of x
 
20943
         *
 
20944
         * cosh(x) = (exp(x) + exp(-x)) / 2
 
20945
         *         = (e^x + 1/e^x) / 2
 
20946
         *
 
20947
         * sinh(x) = (exp(x) - exp(-x)) / 2
 
20948
         *         = (e^x - 1/e^x) / 2
 
20949
         *
 
20950
         * sech(x) = 2 / (exp(x) + exp(-x))
 
20951
         *         = 2 / (e^x + 1/e^x)
 
20952
         *
 
20953
         * csch(x) = 2 / (exp(x) - exp(-x))
 
20954
         *         = 2 / (e^x - 1/e^x)
 
20955
         *
 
20956
         * @param {BigNumber} x
 
20957
         * @param {DecimalFactory} Big   current BigNumber constructor
 
20958
         * @param {Boolean} mode         sinh function if true, cosh function if false
 
20959
         * @param {Boolean} reciprocal   is sech or csch
 
20960
         * @returns {BigNumber} hyperbolic cosine, sine, secant. or cosecant of x
 
20961
         */
 
20962
        exports.cosh_sinh_csch_sech = function (x, Big, mode, reciprocal) {
 
20963
          if (x.isNaN()) {
 
20964
            return new Big(NaN);
 
20965
          }
 
20966
          if (!x.isFinite()) {
 
20967
            if (reciprocal) {
 
20968
              return new Big(0);
 
20969
            }
 
20970
            return new Big((mode) ? x : Infinity);
 
20971
          }
 
20972
 
 
20973
          var precision = Big.precision;
 
20974
          Big.config({precision: precision + 4});
 
20975
 
 
20976
          var y = new Big(x);
 
20977
          y.constructor = Big;
 
20978
 
 
20979
          y = y.exp();
 
20980
          y = (mode) ? y.minus(Big.ONE.div(y)) : y.plus(Big.ONE.div(y));
 
20981
          y = (reciprocal) ? new Big(2).div(y) : y.div(2);
 
20982
 
 
20983
          Big.config({precision: precision});
 
20984
          return new Big(y.toPrecision(precision));
 
20985
        };
 
20986
 
 
20987
        /**
 
20988
         * Calculate the hyperbolic tangent of x
 
20989
         *
 
20990
         * tanh(x) = (exp(x) + exp(-x)) / (exp(x) - exp(-x))
 
20991
         *         = (exp(2x) - 1) / (exp(2x) + 1)
 
20992
         *         = (e^x - 1/e^x) / (e^x + 1/e^x)
 
20993
         *
 
20994
         * coth(x) = (exp(x) - exp(-x)) / (exp(x) + exp(-x))
 
20995
         *         = (exp(2x) + 1) / (exp(2x) - 1)
 
20996
         *         = (e^x + 1/e^x) / (e^x - 1/e^x)
 
20997
         *
 
20998
         * @param {BigNumber} x
 
20999
         * @param {DecimalFactory} Big   current BigNumber constructor
 
21000
         * @param {Boolean} reciprocal   is coth
 
21001
         * @returns {BigNumber} hyperbolic tangent or cotangent of x
 
21002
         */
 
21003
        exports.tanh_coth = function (x, Big, reciprocal) {
 
21004
          if (x.isNaN()) {
 
21005
            return new Big(NaN);
 
21006
          }
 
21007
          if (!x.isFinite()) {
 
21008
            return new Big(x.s);
 
21009
          }
 
21010
 
 
21011
          var precision = Big.precision;
 
21012
          Big.config({precision: precision + 4});
 
21013
 
 
21014
          var y = new Big(x);
 
21015
          y.constructor = Big;
 
21016
 
 
21017
          var posExp = y.exp();
 
21018
          var negExp = Big.ONE.div(posExp);
 
21019
          var ret = posExp.minus(negExp);
 
21020
          ret = (reciprocal) ? posExp.plus(negExp).div(ret) : ret.div(posExp.plus(negExp));
 
21021
 
 
21022
          Big.config({precision: precision});
 
21023
          return ret.toDP(precision - 1);
 
21024
        };
 
21025
 
 
21026
        /**
 
21027
         * Calculate the arc sine of x using Newton's method
 
21028
         *
 
21029
         * f(x) = sin(x) = N  =>  f(x)  = sin(x) - N
 
21030
         *                        f'(x) = cos(x)
 
21031
         *
 
21032
         * Thus we solve each step as follows:
 
21033
         *     x_(i+1) = x_i - (sin(x_i) - N)/cos(x_i)
 
21034
         *
 
21035
         * @param {BigNumber} x
 
21036
         * @param {DecimalFactory} Big   current BigNumber constructor
 
21037
         * @returns {BigNumber} arc sine of x
 
21038
         */
 
21039
        function arcsin_newton(x, Big) {
 
21040
          var oldPrecision = Big.precision;
 
21041
 
 
21042
          // Calibration variables, adjusted from MAPM
 
21043
          var tolerance = -(oldPrecision + 4);
 
21044
          var maxp = oldPrecision + 8 - x.e;
 
21045
          var localPrecision = 25 - x.e;
 
21046
          var maxIter = Math.max(Math.log(oldPrecision + 2) * 1.442695 | 0 + 5, 5);
 
21047
          Big.config({precision: localPrecision});
 
21048
 
 
21049
          var i = 0;
 
21050
          var curr = new Big(Math.asin(x.toNumber()) + '');
 
21051
          do {
 
21052
            var tmp0 = exports.cos_sin_sec_csc(curr, Big, 1, false);
 
21053
            var tmp1 = sinToCos(tmp0);
 
21054
            if (!tmp0.isZero()) {
 
21055
              tmp0.s = curr.s;
 
21056
            }
 
21057
 
 
21058
            var tmp2 = tmp0.minus(x).div(tmp1);
 
21059
            curr = curr.minus(tmp2);
 
21060
 
 
21061
            localPrecision = Math.min(2*localPrecision, maxp);
 
21062
            Big.config({precision: localPrecision});
 
21063
          } while ((2*tmp2.e >= tolerance) && !tmp2.isZero() && (++i <= maxIter))
 
21064
 
 
21065
          if (i == maxIter) {
 
21066
            throw new Error('asin() failed to converge to the requested accuracy.' +
 
21067
                            'Try with a higher precision.');
 
21068
          }
 
21069
 
 
21070
          Big.config({precision: oldPrecision});
 
21071
          return curr.toDP(oldPrecision - 1);
 
21072
        }
 
21073
 
 
21074
        /**
 
21075
         * Calculate the arc sine of x
 
21076
         *
 
21077
         * arcsin(x) = x + (1/2)*x^3/3 + (3/8)*x^5/5 + (15/48)*x^7/7 ...
 
21078
         *           = x + (1/2)*x^2*x^1/3 + [(1*3)/(2*4)]*x^2*x^3/5 + [(1*3*5)/(2*4*6)]*x^2*x^5/7 ...
 
21079
         *
 
21080
         * @param {BigNumber} x
 
21081
         * @param {Number} precision
 
21082
         * @returns {BigNumber} arc sine of x
 
21083
         */
 
21084
        function arcsin_taylor(x, precision) {
 
21085
          var Big = x.constructor;
 
21086
          Big.config({precision: precision + Math.log(precision) | 0 + 4});
 
21087
 
 
21088
          var one = new Big(1);
 
21089
          var y = x;
 
21090
          var yPrev = NaN;
 
21091
          var x2 = x.times(x);
 
21092
          var polyNum = x;
 
21093
          var constNum = new Big(one);
 
21094
          var constDen = new Big(one);
 
21095
 
 
21096
          var bigK = new Big(one);
 
21097
          for (var k = 3; !y.equals(yPrev); k += 2) {
 
21098
            polyNum = polyNum.times(x2);
 
21099
 
 
21100
            constNum = constNum.times(bigK);
 
21101
            constDen = constDen.times(bigK.plus(one));
 
21102
 
 
21103
            yPrev = y;
 
21104
            bigK = new Big(k);
 
21105
            y = y.plus(polyNum.times(constNum).div(bigK.times(constDen)));
 
21106
          }
 
21107
 
 
21108
          Big.config({precision: precision});
 
21109
          return y.toDP(precision - 1);
 
21110
        }
 
21111
 
 
21112
        /**
 
21113
         * Calculate the arc tangent of x using a Taylor expansion
 
21114
         *
 
21115
         * arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + x^9/9 - ...
 
21116
         *           = x - x^2*x^1/3 + x^2*x^3/5 - x^2*x^5/7 + x^2*x^7/9 - ...
 
21117
         *
 
21118
         * @param {BigNumber} x
 
21119
         * @returns {BigNumber} arc tangent of x
 
21120
         */
 
21121
        function arctan_taylor(x) {
 
21122
          var y = x;
 
21123
          var yPrev = NaN;
 
21124
          var x2 = x.times(x);
 
21125
          var num = x;
 
21126
          var add = true;
 
21127
 
 
21128
          for (var k = 3; !y.equals(yPrev); k += 2) {
 
21129
            num = num.times(x2);
 
21130
 
 
21131
            yPrev = y;
 
21132
            add = !add;
 
21133
            y = (add) ? y.plus(num.div(k)) : y.minus(num.div(k));
 
21134
          }
 
21135
 
 
21136
          return y;
 
21137
        }
 
21138
 
 
21139
        /**
 
21140
         * Calculate the cosine or sine of x using Taylor Series.
 
21141
         *
 
21142
         * cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! - ...
 
21143
         *        = 1 - 1*x^2/2! + x^2*x^2/4! - x^2*x^4/6! + x^2*x^6/8! - ...
 
21144
         *
 
21145
         * sin(x) = x - x^3/3! + x^5/5! - x^7/7! + x^9/9! - ...
 
21146
         *        = x - x^2*x^1/3! + x^2*x^3/5! - x^2*x^5/7! + x^2*x^7/9! - ...
 
21147
         *
 
21148
         * @param {BigNumber} x     reduced argument
 
21149
         * @param {Number} mode     sine function if 1, cosine function if 0
 
21150
         * @returns {BigNumber} sine or cosine of x
 
21151
         */
 
21152
        function cos_sin_taylor(x, mode) {
 
21153
          var one = x.constructor.ONE;
 
21154
 
 
21155
          var y = x;
 
21156
          var yPrev = NaN;
 
21157
          var x2 = x.times(x);
 
21158
          var num = (mode) ? y : y = one;
 
21159
          var den = one;
 
21160
          var add = true;
 
21161
 
 
21162
          for (var k = mode; !y.equals(yPrev); k += 2) {
 
21163
            num = num.times(x2);
 
21164
            den = den.times(k+1).times(k+2);
 
21165
 
 
21166
            yPrev = y;
 
21167
            add = !add;
 
21168
            y = (add) ? y.plus(num.div(den)) : y.minus(num.div(den));
 
21169
          }
 
21170
 
 
21171
          return y;
 
21172
        }
 
21173
 
 
21174
        /**
 
21175
         * Reduce x within a period of pi (0, pi] with guard digits.
 
21176
         *
 
21177
         * @param {BigNumber} x
 
21178
         * @param {Number} precision
 
21179
         * @param {Number} mode
 
21180
         * @returns {Array} [Reduced x, is tau multiple?]
 
21181
         */
 
21182
        function reduceToPeriod(x, precision, mode) {
 
21183
          var pi = exports.pi(precision + 2);
 
21184
          var tau = exports.tau(precision);
 
21185
          if (x.abs().lte(pi.toDP(x.dp()))) {
 
21186
            return [x, false];
 
21187
          }
 
21188
 
 
21189
          var Big = x.constructor;
 
21190
          // Catch if input is tau multiple using pi's precision
 
21191
          if (x.div(pi.toDP(x.dp())).toNumber() % 2 == 0) {
 
21192
            return [new Big(mode ^ 1), true];
 
21193
          }
 
21194
 
 
21195
          var y = x.mod(tau);
 
21196
 
 
21197
          // Catch if tau multiple with tau's precision
 
21198
          if (y.toDP(x.dp(), 1).isZero()) {
 
21199
            return [new Big(mode ^ 1), true];
 
21200
          }
 
21201
 
 
21202
          if (y.gt(pi)) {
 
21203
            if (mode) {
 
21204
              // sin(x + pi) = -sin(x)
 
21205
              y = y.minus(pi);
 
21206
              y.s = -y.s;
 
21207
            } else {
 
21208
              // cos(x) = cos(tau - x)
 
21209
              y = tau.minus(y);
 
21210
            }
 
21211
          }
 
21212
 
 
21213
          y.constructor = Big;
 
21214
          return [y, false];
 
21215
        }
 
21216
 
 
21217
        /**
 
21218
         * Convert from sine to cosine
 
21219
         *
 
21220
         * |cos(x)| = sqrt(1 - sin(x)^2)
 
21221
         *
 
21222
         * @param {BigNumber} sine of x
 
21223
         * @returns {BigNumber} sine as cosine
 
21224
         */
 
21225
        function sinToCos(sinVal) {
 
21226
          var Big = sinVal.constructor;
 
21227
          var precision = Big.precision;
 
21228
          Big.config({precision: precision + 2});
 
21229
 
 
21230
          var ret = Big.ONE.minus(sinVal.times(sinVal)).sqrt();
 
21231
 
 
21232
          Big.config({precision: precision});
 
21233
          return ret.toDP(precision - 1);
 
21234
        }
 
21235
 
 
21236
 
 
21237
        /************************************
 
21238
         *         Format functions         *
 
21239
         ************************************/
 
21240
 
 
21241
        /**
 
21242
         * Convert a number to a formatted string representation.
 
21243
         *
 
21244
         * Syntax:
 
21245
         *
 
21246
         *    format(value)
 
21247
         *    format(value, options)
 
21248
         *    format(value, precision)
 
21249
         *    format(value, fn)
 
21250
         *
 
21251
         * Where:
 
21252
         *
 
21253
         *    {Number} value   The value to be formatted
 
21254
         *    {Object} options An object with formatting options. Available options:
 
21255
         *                     {String} notation
 
21256
         *                         Number notation. Choose from:
 
21257
         *                         'fixed'          Always use regular number notation.
 
21258
         *                                          For example '123.40' and '14000000'
 
21259
         *                         'exponential'    Always use exponential notation.
 
21260
         *                                          For example '1.234e+2' and '1.4e+7'
 
21261
         *                         'auto' (default) Regular number notation for numbers
 
21262
         *                                          having an absolute value between
 
21263
         *                                          `lower` and `upper` bounds, and uses
 
21264
         *                                          exponential notation elsewhere.
 
21265
         *                                          Lower bound is included, upper bound
 
21266
         *                                          is excluded.
 
21267
         *                                          For example '123.4' and '1.4e7'.
 
21268
         *                     {Number} precision   A number between 0 and 16 to round
 
21269
         *                                          the digits of the number.
 
21270
         *                                          In case of notations 'exponential' and
 
21271
         *                                          'auto', `precision` defines the total
 
21272
         *                                          number of significant digits returned
 
21273
         *                                          and is undefined by default.
 
21274
         *                                          In case of notation 'fixed',
 
21275
         *                                          `precision` defines the number of
 
21276
         *                                          significant digits after the decimal
 
21277
         *                                          point, and is 0 by default.
 
21278
         *                     {Object} exponential An object containing two parameters,
 
21279
         *                                          {Number} lower and {Number} upper,
 
21280
         *                                          used by notation 'auto' to determine
 
21281
         *                                          when to return exponential notation.
 
21282
         *                                          Default values are `lower=1e-3` and
 
21283
         *                                          `upper=1e5`.
 
21284
         *                                          Only applicable for notation `auto`.
 
21285
         *    {Function} fn    A custom formatting function. Can be used to override the
 
21286
         *                     built-in notations. Function `fn` is called with `value` as
 
21287
         *                     parameter and must return a string. Is useful for example to
 
21288
         *                     format all values inside a matrix in a particular way.
 
21289
         *
 
21290
         * Examples:
 
21291
         *
 
21292
         *    format(6.4);                                        // '6.4'
 
21293
         *    format(1240000);                                    // '1.24e6'
 
21294
         *    format(1/3);                                        // '0.3333333333333333'
 
21295
         *    format(1/3, 3);                                     // '0.333'
 
21296
         *    format(21385, 2);                                   // '21000'
 
21297
         *    format(12.071, {notation: 'fixed'});                // '12'
 
21298
         *    format(2.3,    {notation: 'fixed', precision: 2});  // '2.30'
 
21299
         *    format(52.8,   {notation: 'exponential'});          // '5.28e+1'
 
21300
         *
 
21301
         * @param {BigNumber} value
 
21302
         * @param {Object | Function | Number} [options]
 
21303
         * @return {String} str The formatted value
 
21304
         */
 
21305
        exports.format = function(value, options) {
 
21306
          if (typeof options === 'function') {
 
21307
            // handle format(value, fn)
 
21308
            return options(value);
 
21309
          }
 
21310
 
 
21311
          // handle special cases
 
21312
          if (!value.isFinite()) {
 
21313
            return value.isNaN() ? 'NaN' : (value.gt(0) ? 'Infinity' : '-Infinity');
 
21314
          }
 
21315
 
 
21316
          // default values for options
 
21317
          var notation = 'auto';
 
21318
          var precision = undefined;
 
21319
 
 
21320
          if (options !== undefined) {
 
21321
            // determine notation from options
 
21322
            if (options.notation) {
 
21323
              notation = options.notation;
 
21324
            }
 
21325
 
 
21326
            // determine precision from options
 
21327
            if (isNumber(options)) {
 
21328
              precision = options;
 
21329
            }
 
21330
            else if (options.precision) {
 
21331
              precision = options.precision;
 
21332
            }
 
21333
          }
 
21334
 
 
21335
          // handle the various notations
 
21336
          switch (notation) {
 
21337
            case 'fixed':
 
21338
              return exports.toFixed(value, precision);
 
21339
 
 
21340
            case 'exponential':
 
21341
              return exports.toExponential(value, precision);
 
21342
 
 
21343
            case 'auto':
 
21344
              // determine lower and upper bound for exponential notation.
 
21345
                // TODO: implement support for upper and lower to be BigNumbers themselves
 
21346
              var lower = 1e-3;
 
21347
              var upper = 1e5;
 
21348
              if (options && options.exponential) {
 
21349
                if (options.exponential.lower !== undefined) {
 
21350
                  lower = options.exponential.lower;
 
21351
                }
 
21352
                if (options.exponential.upper !== undefined) {
 
21353
                  upper = options.exponential.upper;
 
21354
                }
 
21355
              }
 
21356
 
 
21357
              // adjust the configuration of the BigNumber constructor (yeah, this is quite tricky...)
 
21358
              var oldConfig = {
 
21359
                toExpNeg: value.constructor.toExpNeg,
 
21360
                toExpPos: value.constructor.toExpPos
 
21361
              };
 
21362
 
 
21363
              value.constructor.config({
 
21364
                toExpNeg: Math.round(Math.log(lower) / Math.LN10),
 
21365
                toExpPos: Math.round(Math.log(upper) / Math.LN10)
 
21366
              });
 
21367
 
 
21368
              // handle special case zero
 
21369
              if (value.isZero()) return '0';
 
21370
 
 
21371
              // determine whether or not to output exponential notation
 
21372
              var str;
 
21373
              var abs = value.abs();
 
21374
              if (abs.gte(lower) && abs.lt(upper)) {
 
21375
                // normal number notation
 
21376
                str = value.toSignificantDigits(precision).toFixed();
 
21377
              }
 
21378
              else {
 
21379
                // exponential notation
 
21380
                str = exports.toExponential(value, precision);
 
21381
              }
 
21382
 
 
21383
              // remove trailing zeros after the decimal point
 
21384
              return str.replace(/((\.\d*?)(0+))($|e)/, function () {
 
21385
                var digits = arguments[2];
 
21386
                var e = arguments[4];
 
21387
                return (digits !== '.') ? digits + e : e;
 
21388
              });
 
21389
 
 
21390
            default:
 
21391
              throw new Error('Unknown notation "' + notation + '". ' +
 
21392
                  'Choose "auto", "exponential", or "fixed".');
 
21393
          }
 
21394
        };
 
21395
 
 
21396
        /**
 
21397
         * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'
 
21398
         * @param {BigNumber} value
 
21399
         * @param {Number} [precision]  Number of digits in formatted output.
 
21400
         *                              If not provided, the maximum available digits
 
21401
         *                              is used.
 
21402
         * @returns {string} str
 
21403
         */
 
21404
        exports.toExponential = function(value, precision) {
 
21405
          if (precision !== undefined) {
 
21406
            return value.toExponential(precision - 1); // Note the offset of one
 
21407
          }
 
21408
          else {
 
21409
            return value.toExponential();
 
21410
          }
 
21411
        };
 
21412
 
 
21413
        /**
 
21414
         * Format a number with fixed notation.
 
21415
         * @param {BigNumber} value
 
21416
         * @param {Number} [precision=0]        Optional number of decimals after the
 
21417
         *                                      decimal point. Zero by default.
 
21418
         */
 
21419
        exports.toFixed = function(value, precision) {
 
21420
          return value.toFixed(precision || 0);
 
21421
          // Note: the (precision || 0) is needed as the toFixed of BigNumber has an
 
21422
          // undefined default precision instead of 0.
 
21423
        };
 
21424
 
 
21425
        /* Helper functions */
 
21426
        function BigNumberCopy(x) {
 
21427
          var Big = BigNumber.constructor({precision: x.constructor.precision});
 
21428
          var y = new Big(x);
 
21429
          y.constructor = Big;      // Not sure why I have to do this...
 
21430
 
 
21431
          return y;
 
21432
        }
 
21433
 
 
21434
 
19368
21435
/***/ },
19369
 
/* 153 */
 
21436
/* 165 */
19370
21437
/***/ function(module, exports, __webpack_require__) {
19371
21438
 
19372
21439
        'use strict';
19373
21440
 
19374
 
        var number = __webpack_require__(4),
19375
 
            string = __webpack_require__(176),
19376
 
            object = __webpack_require__(3),
19377
 
            types = __webpack_require__(196),
 
21441
        var number = __webpack_require__(3),
 
21442
            string = __webpack_require__(205),
 
21443
            object = __webpack_require__(2),
 
21444
            types = __webpack_require__(334),
19378
21445
 
19379
 
            DimensionError = __webpack_require__(156),
19380
 
            IndexError = __webpack_require__(157),
 
21446
            DimensionError = __webpack_require__(168),
 
21447
            IndexError = __webpack_require__(169),
19381
21448
 
19382
21449
            isArray = Array.isArray;
19383
21450
 
19748
21815
        exports.isArray = isArray;
19749
21816
 
19750
21817
/***/ },
19751
 
/* 154 */
 
21818
/* 166 */
19752
21819
/***/ function(module, exports, __webpack_require__) {
19753
21820
 
19754
 
        module.exports = '1.2.0';
 
21821
        module.exports = '1.4.0';
19755
21822
        // Note: This file is automatically generated when building math.js.
19756
21823
        // Changes made in this file will be overwritten.
19757
21824
 
19758
21825
 
19759
21826
/***/ },
19760
 
/* 155 */
 
21827
/* 167 */
19761
21828
/***/ function(module, exports, __webpack_require__) {
19762
21829
 
19763
21830
        'use strict';
19796
21863
 
19797
21864
 
19798
21865
/***/ },
19799
 
/* 156 */
 
21866
/* 168 */
19800
21867
/***/ function(module, exports, __webpack_require__) {
19801
21868
 
19802
21869
        'use strict';
19836
21903
 
19837
21904
 
19838
21905
/***/ },
19839
 
/* 157 */
 
21906
/* 169 */
19840
21907
/***/ function(module, exports, __webpack_require__) {
19841
21908
 
19842
21909
        'use strict';
19887
21954
 
19888
21955
 
19889
21956
/***/ },
19890
 
/* 158 */
 
21957
/* 170 */
19891
21958
/***/ function(module, exports, __webpack_require__) {
19892
21959
 
19893
21960
        'use strict';
19930
21997
 
19931
21998
 
19932
21999
/***/ },
19933
 
/* 159 */
19934
 
/***/ function(module, exports, __webpack_require__) {
19935
 
 
19936
 
        var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v4.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
 
22000
/* 171 */
 
22001
/***/ function(module, exports, __webpack_require__) {
 
22002
 
 
22003
        'use strict';
 
22004
 
 
22005
        exports.array = __webpack_require__(165);
 
22006
        exports['boolean'] = __webpack_require__(204);
 
22007
        exports.number = __webpack_require__(3);
 
22008
        exports.bignumber = __webpack_require__(164);
 
22009
        exports.object = __webpack_require__(2);
 
22010
        exports.string = __webpack_require__(205);
 
22011
        exports.types = __webpack_require__(334);
 
22012
 
 
22013
 
 
22014
/***/ },
 
22015
/* 172 */
 
22016
/***/ function(module, exports, __webpack_require__) {
 
22017
 
 
22018
        'use strict';
 
22019
 
 
22020
        var Node = __webpack_require__(180),
 
22021
            object = __webpack_require__(2),
 
22022
            string = __webpack_require__(205),
 
22023
            collection = __webpack_require__(14),
 
22024
            util = __webpack_require__(171),
 
22025
 
 
22026
            isArray = Array.isArray,
 
22027
            isNode = Node.isNode;
 
22028
 
 
22029
        /**
 
22030
         * @constructor ArrayNode
 
22031
         * @extends {Node}
 
22032
         * Holds an 1-dimensional array with nodes
 
22033
         * @param {Node[]} [nodes]   1 dimensional array with nodes
 
22034
         */
 
22035
        function ArrayNode(nodes) {
 
22036
          if (!(this instanceof ArrayNode)) {
 
22037
            throw new SyntaxError('Constructor must be called with the new operator');
 
22038
          }
 
22039
 
 
22040
          this.nodes = nodes || [];
 
22041
 
 
22042
          // validate input
 
22043
          if (!isArray(this.nodes) || !this.nodes.every(isNode)) {
 
22044
            throw new TypeError('Array containing Nodes expected')
 
22045
          }
 
22046
        }
 
22047
 
 
22048
        ArrayNode.prototype = new Node();
 
22049
 
 
22050
        ArrayNode.prototype.type = 'ArrayNode';
 
22051
 
 
22052
        /**
 
22053
         * Compile the node to javascript code
 
22054
         * @param {Object} defs     Object which can be used to define functions
 
22055
         *                          or constants globally available for the compiled
 
22056
         *                          expression
 
22057
         * @private
 
22058
         */
 
22059
        ArrayNode.prototype._compile = function (defs) {
 
22060
          var asMatrix = (defs.math.config().matrix !== 'array');
 
22061
 
 
22062
          var nodes = this.nodes.map(function (node) {
 
22063
            return node._compile(defs);
 
22064
          });
 
22065
 
 
22066
          return (asMatrix ? 'math.matrix([' : '[') +
 
22067
              nodes.join(',') +
 
22068
              (asMatrix ? '])' : ']');
 
22069
        };
 
22070
 
 
22071
        /**
 
22072
         * Execute a callback for each of the child nodes of this node
 
22073
         * @param {function(child: Node, path: string, parent: Node)} callback
 
22074
         */
 
22075
        ArrayNode.prototype.forEach = function (callback) {
 
22076
          for (var i = 0; i < this.nodes.length; i++) {
 
22077
            var node = this.nodes[i];
 
22078
            callback(node, 'nodes[' + i + ']', this);
 
22079
          }
 
22080
        };
 
22081
 
 
22082
        /**
 
22083
         * Create a new ArrayNode having it's childs be the results of calling
 
22084
         * the provided callback function for each of the childs of the original node.
 
22085
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
22086
         * @returns {ArrayNode} Returns a transformed copy of the node
 
22087
         */
 
22088
        ArrayNode.prototype.map = function (callback) {
 
22089
          var nodes = [];
 
22090
          for (var i = 0; i < this.nodes.length; i++) {
 
22091
            nodes[i] = this._ifNode(callback(this.nodes[i], 'nodes[' + i + ']', this));
 
22092
          }
 
22093
          return new ArrayNode(nodes);
 
22094
        };
 
22095
 
 
22096
        /**
 
22097
         * Create a clone of this node, a shallow copy
 
22098
         * @return {ArrayNode}
 
22099
         */
 
22100
        ArrayNode.prototype.clone = function() {
 
22101
          return new ArrayNode(this.nodes.slice(0))
 
22102
        };
 
22103
 
 
22104
        /**
 
22105
         * Get string representation
 
22106
         * @return {String} str
 
22107
         * @override
 
22108
         */
 
22109
        ArrayNode.prototype.toString = function() {
 
22110
          return string.format(this.nodes);
 
22111
        };
 
22112
 
 
22113
        /**
 
22114
         * Get LaTeX representation
 
22115
         * @return {String} str
 
22116
         */
 
22117
        ArrayNode.prototype.toTex = function(type) {
 
22118
          type = type || 'bmatrix';
 
22119
          var s = '\\begin{' + type + '}';
 
22120
 
 
22121
          this.nodes.forEach(function(node) {
 
22122
            if (node.nodes) {
 
22123
              s += node.nodes.map(function(childNode) {
 
22124
                return childNode.toTex();
 
22125
              }).join('&');
 
22126
            }
 
22127
            else {
 
22128
              s += node.toTex();
 
22129
            }
 
22130
 
 
22131
            // new line
 
22132
            s += '\\\\';
 
22133
          });
 
22134
          s += '\\end{' + type + '}';
 
22135
          return s;
 
22136
        };
 
22137
 
 
22138
        module.exports = ArrayNode;
 
22139
 
 
22140
 
 
22141
/***/ },
 
22142
/* 173 */
 
22143
/***/ function(module, exports, __webpack_require__) {
 
22144
 
 
22145
        'use strict';
 
22146
 
 
22147
        var Node = __webpack_require__(180),
 
22148
            ArrayNode = __webpack_require__(172),
 
22149
 
 
22150
            keywords = __webpack_require__(337),
 
22151
 
 
22152
            latex = __webpack_require__(338),
 
22153
            isString = __webpack_require__(205).isString;
 
22154
 
 
22155
        /**
 
22156
         * @constructor AssignmentNode
 
22157
         * @extends {Node}
 
22158
         * Define a symbol, like "a = 3.2"
 
22159
         *
 
22160
         * @param {String} name       Symbol name
 
22161
         * @param {Node} expr         The expression defining the symbol
 
22162
         */
 
22163
        function AssignmentNode(name, expr) {
 
22164
          if (!(this instanceof AssignmentNode)) {
 
22165
            throw new SyntaxError('Constructor must be called with the new operator');
 
22166
          }
 
22167
 
 
22168
          // validate input
 
22169
          if (!isString(name))          throw new TypeError('String expected for parameter "name"');
 
22170
          if (!(expr instanceof Node))  throw new TypeError('Node expected for parameter "expr"');
 
22171
          if (name in keywords)         throw new Error('Illegal symbol name, "'  + name +  '" is a reserved keyword');
 
22172
 
 
22173
          this.name = name;
 
22174
          this.expr = expr;
 
22175
        }
 
22176
 
 
22177
        AssignmentNode.prototype = new Node();
 
22178
 
 
22179
        AssignmentNode.prototype.type = 'AssignmentNode';
 
22180
 
 
22181
        /**
 
22182
         * Compile the node to javascript code
 
22183
         * @param {Object} defs     Object which can be used to define functions
 
22184
         *                          or constants globally available for the compiled
 
22185
         *                          expression
 
22186
         * @private
 
22187
         */
 
22188
        AssignmentNode.prototype._compile = function (defs) {
 
22189
          return 'scope["' + this.name + '"] = ' + this.expr._compile(defs) + '';
 
22190
        };
 
22191
 
 
22192
 
 
22193
        /**
 
22194
         * Execute a callback for each of the child nodes of this node
 
22195
         * @param {function(child: Node, path: string, parent: Node)} callback
 
22196
         */
 
22197
        AssignmentNode.prototype.forEach = function (callback) {
 
22198
          callback(this.expr, 'expr', this);
 
22199
        };
 
22200
 
 
22201
        /**
 
22202
         * Create a new AssignmentNode having it's childs be the results of calling
 
22203
         * the provided callback function for each of the childs of the original node.
 
22204
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
22205
         * @returns {AssignmentNode} Returns a transformed copy of the node
 
22206
         */
 
22207
        AssignmentNode.prototype.map = function (callback) {
 
22208
          return new AssignmentNode(this.name, this._ifNode(callback(this.expr, 'expr', this)));
 
22209
        };
 
22210
 
 
22211
        /**
 
22212
         * Create a clone of this node, a shallow copy
 
22213
         * @return {AssignmentNode}
 
22214
         */
 
22215
        AssignmentNode.prototype.clone = function() {
 
22216
          return new AssignmentNode(this.name, this.expr);
 
22217
        };
 
22218
 
 
22219
        /**
 
22220
         * Get string representation
 
22221
         * @return {String}
 
22222
         */
 
22223
        AssignmentNode.prototype.toString = function() {
 
22224
          return this.name + ' = ' + this.expr.toString();
 
22225
        };
 
22226
 
 
22227
        /**
 
22228
         * Get LaTeX representation
 
22229
         * @return {String}
 
22230
         */
 
22231
        AssignmentNode.prototype.toTex = function() {
 
22232
          var brace;
 
22233
          if (this.expr instanceof ArrayNode) {
 
22234
            brace = ['\\mathbf{', '}'];
 
22235
          }
 
22236
          return latex.addBraces(latex.toSymbol(this.name), brace) + '=' +
 
22237
              latex.addBraces(this.expr.toTex());
 
22238
        };
 
22239
 
 
22240
        module.exports = AssignmentNode;
 
22241
 
 
22242
/***/ },
 
22243
/* 174 */
 
22244
/***/ function(module, exports, __webpack_require__) {
 
22245
 
 
22246
        'use strict';
 
22247
 
 
22248
        var Node = __webpack_require__(180);
 
22249
        var ResultSet = __webpack_require__(13);
 
22250
        var isBoolean = __webpack_require__(204).isBoolean;
 
22251
 
 
22252
        /**
 
22253
         * @constructor BlockNode
 
22254
         * @extends {Node}
 
22255
         * Holds a set with blocks
 
22256
         * @param {Array.<{node: Node} | {node: Node, visible: boolean}>} blocks
 
22257
         *            An array with blocks, where a block is constructed as an Object
 
22258
         *            with properties block, which is a Node, and visible, which is
 
22259
         *            a boolean. The property visible is optional and is true by default
 
22260
         */
 
22261
        function BlockNode(blocks) {
 
22262
          if (!(this instanceof BlockNode)) {
 
22263
            throw new SyntaxError('Constructor must be called with the new operator');
 
22264
          }
 
22265
 
 
22266
          // validate input, copy blocks
 
22267
          if (!Array.isArray(blocks)) throw new Error('Array expected');
 
22268
          this.blocks = blocks.map(function (block) {
 
22269
            var node    = block && block.node;
 
22270
            var visible = block && block.visible !== undefined ? block.visible : true;
 
22271
 
 
22272
            if (!(node instanceof Node))  throw new TypeError('Property "node" must be a Node');
 
22273
            if (!isBoolean(visible))      throw new TypeError('Property "visible" must be a boolean');
 
22274
 
 
22275
            return {
 
22276
              node: node,
 
22277
              visible: visible
 
22278
            }
 
22279
          });
 
22280
        }
 
22281
 
 
22282
        BlockNode.prototype = new Node();
 
22283
 
 
22284
        BlockNode.prototype.type = 'BlockNode';
 
22285
 
 
22286
        /**
 
22287
         * Compile the node to javascript code
 
22288
         * @param {Object} defs     Object which can be used to define functions
 
22289
         *                          or constants globally available for the compiled
 
22290
         *                          expression
 
22291
         * @return {String} js
 
22292
         * @private
 
22293
         */
 
22294
        BlockNode.prototype._compile = function (defs) {
 
22295
          defs.ResultSet = ResultSet;
 
22296
          var blocks = this.blocks.map(function (param) {
 
22297
            var js = param.node._compile(defs);
 
22298
            if (param.visible) {
 
22299
              return 'results.push(' + js + ');';
 
22300
            }
 
22301
            else {
 
22302
              return js + ';';
 
22303
            }
 
22304
          });
 
22305
 
 
22306
          return '(function () {' +
 
22307
              'var results = [];' +
 
22308
              blocks.join('') +
 
22309
              'return new ResultSet(results);' +
 
22310
              '})()';
 
22311
        };
 
22312
 
 
22313
        /**
 
22314
         * Execute a callback for each of the child blocks of this node
 
22315
         * @param {function(child: Node, path: string, parent: Node)} callback
 
22316
         */
 
22317
        BlockNode.prototype.forEach = function (callback) {
 
22318
          for (var i = 0; i < this.blocks.length; i++) {
 
22319
            callback(this.blocks[i].node, 'blocks[' + i + '].node', this);
 
22320
          }
 
22321
        };
 
22322
 
 
22323
        /**
 
22324
         * Create a new BlockNode having it's childs be the results of calling
 
22325
         * the provided callback function for each of the childs of the original node.
 
22326
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
22327
         * @returns {BlockNode} Returns a transformed copy of the node
 
22328
         */
 
22329
        BlockNode.prototype.map = function (callback) {
 
22330
          var blocks = [];
 
22331
          for (var i = 0; i < this.blocks.length; i++) {
 
22332
            var block = this.blocks[i];
 
22333
            var node = this._ifNode(callback(block.node, 'blocks[' + i + '].node', this));
 
22334
            blocks[i] = {
 
22335
              node: node,
 
22336
              visible: block.visible
 
22337
            };
 
22338
          }
 
22339
          return new BlockNode(blocks);
 
22340
        };
 
22341
 
 
22342
        /**
 
22343
         * Create a clone of this node, a shallow copy
 
22344
         * @return {BlockNode}
 
22345
         */
 
22346
        BlockNode.prototype.clone = function() {
 
22347
          var blocks = this.blocks.map(function(block) {
 
22348
            return {
 
22349
              node: block.node,
 
22350
              visible: block.visible
 
22351
            };
 
22352
          });
 
22353
 
 
22354
          return new BlockNode(blocks);
 
22355
        };
 
22356
 
 
22357
        /**
 
22358
         * Get string representation
 
22359
         * @return {String} str
 
22360
         * @override
 
22361
         */
 
22362
        BlockNode.prototype.toString = function() {
 
22363
          return this.blocks.map(function (param) {
 
22364
            return param.node.toString() + (param.visible ? '' : ';');
 
22365
          }).join('\n');
 
22366
        };
 
22367
 
 
22368
        /**
 
22369
         * Get LaTeX representation
 
22370
         * @return {String} str
 
22371
         */
 
22372
        BlockNode.prototype.toTex = function() {
 
22373
          return this.blocks.map(function (param) {
 
22374
            return param.node.toTex() + (param.visible ? '' : ';');
 
22375
          }).join('\n');
 
22376
        };
 
22377
 
 
22378
        module.exports = BlockNode;
 
22379
 
 
22380
 
 
22381
/***/ },
 
22382
/* 175 */
 
22383
/***/ function(module, exports, __webpack_require__) {
 
22384
 
 
22385
        'use strict';
 
22386
 
 
22387
        var Node = __webpack_require__(180);
 
22388
        var latex = __webpack_require__(338);
 
22389
        var BigNumber = __webpack_require__(5);
 
22390
        var Complex = __webpack_require__(7);
 
22391
        var Unit = __webpack_require__(11);
 
22392
        var util = __webpack_require__(171);
 
22393
        var isString = util.string.isString;
 
22394
        var isNumber = util.number.isNumber;
 
22395
        var isBoolean = util['boolean'].isBoolean;
 
22396
 
 
22397
        /**
 
22398
         * A lazy evaluating conditional operator: 'condition ? trueExpr : falseExpr'
 
22399
         *
 
22400
         * @param {Node} condition   Condition, must result in a boolean
 
22401
         * @param {Node} trueExpr    Expression evaluated when condition is true
 
22402
         * @param {Node} falseExpr   Expression evaluated when condition is true
 
22403
         *
 
22404
         * @constructor ConditionalNode
 
22405
         * @extends {Node}
 
22406
         */
 
22407
        function ConditionalNode (condition, trueExpr, falseExpr) {
 
22408
          if (!(this instanceof ConditionalNode)) {
 
22409
            throw new SyntaxError('Constructor must be called with the new operator');
 
22410
          }
 
22411
          if (!(condition instanceof Node)) throw new TypeError('Parameter condition must be a Node');
 
22412
          if (!(trueExpr instanceof Node))  throw new TypeError('Parameter trueExpr must be a Node');
 
22413
          if (!(falseExpr instanceof Node)) throw new TypeError('Parameter falseExpr must be a Node');
 
22414
 
 
22415
          this.condition = condition;
 
22416
          this.trueExpr = trueExpr;
 
22417
          this.falseExpr = falseExpr;
 
22418
        }
 
22419
 
 
22420
        ConditionalNode.prototype = new Node();
 
22421
 
 
22422
        ConditionalNode.prototype.type = 'ConditionalNode';
 
22423
 
 
22424
        /**
 
22425
         * Compile the node to javascript code
 
22426
         * @param {Object} defs     Object which can be used to define functions
 
22427
         *                          or constants globally available for the compiled
 
22428
         *                          expression
 
22429
         * @return {String} js
 
22430
         * @private
 
22431
         */
 
22432
        ConditionalNode.prototype._compile = function(defs) {
 
22433
          /**
 
22434
           * Test whether a condition is met
 
22435
           * @param {*} condition
 
22436
           * @returns {boolean} true if condition is true or non-zero, else false
 
22437
           */
 
22438
          defs.testCondition = function (condition) {
 
22439
            if (isNumber(condition) || isBoolean(condition) || isString(condition)) {
 
22440
              return condition ? true : false;
 
22441
            }
 
22442
 
 
22443
            if (condition instanceof BigNumber) {
 
22444
              return condition.isZero() ? false : true;
 
22445
            }
 
22446
 
 
22447
            if (condition instanceof Complex) {
 
22448
              return (condition.re || condition.im) ? true : false;
 
22449
            }
 
22450
 
 
22451
            if (condition instanceof Unit) {
 
22452
              return condition.value ? true : false;
 
22453
            }
 
22454
 
 
22455
            if (condition === null || condition === undefined) {
 
22456
              return false;
 
22457
            }
 
22458
 
 
22459
            throw new TypeError('Unsupported type of condition "' + defs.math['typeof'](condition) + '"');
 
22460
          };
 
22461
 
 
22462
          return (
 
22463
              'testCondition(' + this.condition._compile(defs) + ') ? ' +
 
22464
              '( ' + this.trueExpr._compile(defs) + ') : ' +
 
22465
              '( ' + this.falseExpr._compile(defs) + ')'
 
22466
              );
 
22467
        };
 
22468
 
 
22469
        /**
 
22470
         * Execute a callback for each of the child nodes of this node
 
22471
         * @param {function(child: Node, path: string, parent: Node)} callback
 
22472
         */
 
22473
        ConditionalNode.prototype.forEach = function (callback) {
 
22474
          callback(this.condition, 'condition', this);
 
22475
          callback(this.trueExpr, 'trueExpr', this);
 
22476
          callback(this.falseExpr, 'falseExpr', this);
 
22477
        };
 
22478
 
 
22479
        /**
 
22480
         * Create a new ConditionalNode having it's childs be the results of calling
 
22481
         * the provided callback function for each of the childs of the original node.
 
22482
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
22483
         * @returns {ConditionalNode} Returns a transformed copy of the node
 
22484
         */
 
22485
        ConditionalNode.prototype.map = function (callback) {
 
22486
          return new ConditionalNode(
 
22487
              this._ifNode(callback(this.condition, 'condition', this)),
 
22488
              this._ifNode(callback(this.trueExpr, 'trueExpr', this)),
 
22489
              this._ifNode(callback(this.falseExpr, 'falseExpr', this))
 
22490
          );
 
22491
        };
 
22492
 
 
22493
        /**
 
22494
         * Create a clone of this node, a shallow copy
 
22495
         * @return {ConditionalNode}
 
22496
         */
 
22497
        ConditionalNode.prototype.clone = function() {
 
22498
          return new ConditionalNode(this.condition, this.trueExpr, this.falseExpr);
 
22499
        };
 
22500
 
 
22501
        /**
 
22502
         * Get string representation
 
22503
         * @return {String} str
 
22504
         */
 
22505
        ConditionalNode.prototype.toString = function() {
 
22506
          // TODO: not nice adding parenthesis al the time
 
22507
          return '(' + this.condition.toString() + ') ? (' +
 
22508
              this.trueExpr.toString() + ') : (' +
 
22509
              this.falseExpr.toString() + ')';
 
22510
        };
 
22511
 
 
22512
        /**
 
22513
         * Get LaTeX representation
 
22514
         * @return {String} str
 
22515
         */
 
22516
        ConditionalNode.prototype.toTex = function() {
 
22517
          var s = (
 
22518
              latex.addBraces(this.trueExpr.toTex()) +
 
22519
              ', &\\quad' +
 
22520
              latex.addBraces('\\text{if}\\;' + this.condition.toTex())
 
22521
              ) + '\\\\' + (
 
22522
              latex.addBraces(this.falseExpr.toTex()) +
 
22523
              ', &\\quad' +
 
22524
              latex.addBraces('\\text{otherwise}')
 
22525
              );
 
22526
 
 
22527
          return latex.addBraces(s, [
 
22528
            '\\left\\{\\begin{array}{l l}',
 
22529
            '\\end{array}\\right.'
 
22530
          ]);
 
22531
        };
 
22532
 
 
22533
        module.exports = ConditionalNode;
 
22534
 
 
22535
 
 
22536
/***/ },
 
22537
/* 176 */
 
22538
/***/ function(module, exports, __webpack_require__) {
 
22539
 
 
22540
        'use strict';
 
22541
 
 
22542
        var Node = __webpack_require__(180);
 
22543
        var BigNumber = __webpack_require__(5);
 
22544
        var type = __webpack_require__(334).type;
 
22545
        var isString = __webpack_require__(205).isString;
 
22546
 
 
22547
        /**
 
22548
         * A ConstantNode holds a constant value like a number or string. A ConstantNode
 
22549
         * stores a stringified version of the value and uses this to compile to
 
22550
         * JavaScript.
 
22551
         *
 
22552
         * In case of a stringified number as input, this may be compiled to a BigNumber
 
22553
         * when the math instance is configured for BigNumbers.
 
22554
         *
 
22555
         * Usage:
 
22556
         *
 
22557
         *     // stringified values with type
 
22558
         *     new ConstantNode('2.3', 'number');
 
22559
         *     new ConstantNode('true', 'boolean');
 
22560
         *     new ConstantNode('hello', 'string');
 
22561
         *
 
22562
         *     // non-stringified values, type will be automatically detected
 
22563
         *     new ConstantNode(2.3);
 
22564
         *     new ConstantNode('hello');
 
22565
         *
 
22566
         * @param {String | Number | Boolean | null | undefined} value
 
22567
         *                            When valueType is provided, value must contain
 
22568
         *                            an uninterpreted string representing the value.
 
22569
         *                            When valueType is undefined, value can be a
 
22570
         *                            number, string, boolean, null, or undefined, and
 
22571
         *                            the type will be determined automatically.
 
22572
         * @param {String} [valueType]  The type of value. Choose from 'number', 'string',
 
22573
         *                              'boolean', 'undefined', 'null'
 
22574
         * @constructor ConstantNode
 
22575
         * @extends {Node}
 
22576
         */
 
22577
        function ConstantNode(value, valueType) {
 
22578
          if (!(this instanceof ConstantNode)) {
 
22579
            throw new SyntaxError('Constructor must be called with the new operator');
 
22580
          }
 
22581
 
 
22582
          if (valueType) {
 
22583
            if (!isString(valueType)) {
 
22584
              throw new TypeError('String expected for parameter "valueType"');
 
22585
            }
 
22586
            if (!isString(value)){
 
22587
              throw new TypeError('String expected for parameter "value"');
 
22588
            }
 
22589
 
 
22590
            this.value = value;
 
22591
            this.valueType = valueType;
 
22592
          }
 
22593
          else {
 
22594
            // stringify the value and determine the type
 
22595
            this.value = value + '';
 
22596
            this.valueType = type(value);
 
22597
          }
 
22598
 
 
22599
          if (!SUPPORTED_TYPES[this.valueType]) {
 
22600
            throw new TypeError('Unsupported type of value "' + this.valueType + '"');
 
22601
          }
 
22602
        }
 
22603
 
 
22604
        var SUPPORTED_TYPES = {
 
22605
          'number': true,
 
22606
          'string': true,
 
22607
          'boolean': true,
 
22608
          'undefined': true,
 
22609
          'null': true
 
22610
        };
 
22611
 
 
22612
        ConstantNode.prototype = new Node();
 
22613
 
 
22614
        ConstantNode.prototype.type = 'ConstantNode';
 
22615
 
 
22616
        /**
 
22617
         * Compile the node to javascript code
 
22618
         * @param {Object} defs     Object which can be used to define functions
 
22619
         *                          or constants globally available for the compiled
 
22620
         *                          expression
 
22621
         * @return {String} js
 
22622
         * @private
 
22623
         */
 
22624
        ConstantNode.prototype._compile = function (defs) {
 
22625
          switch (this.valueType) {
 
22626
            case 'number':
 
22627
              if (defs.math.config().number === 'bignumber') {
 
22628
                return 'math.bignumber("' + this.value + '")';
 
22629
              }
 
22630
              else {
 
22631
                // remove leading zeros like '003.2' which are not allowed by JavaScript
 
22632
                return this.value.replace(/^(0*)[0-9]/, function (match, zeros) {
 
22633
                  return match.substring(zeros.length);
 
22634
                });
 
22635
              }
 
22636
 
 
22637
            case 'string':
 
22638
              return '"' + this.value + '"';
 
22639
 
 
22640
            case 'boolean':
 
22641
              return this.value;
 
22642
 
 
22643
            case 'undefined':
 
22644
              return this.value;
 
22645
 
 
22646
            case 'null':
 
22647
              return this.value;
 
22648
 
 
22649
            default:
 
22650
                // TODO: move this error to the constructor?
 
22651
              throw new TypeError('Unsupported type of constant "' + this.valueType + '"');
 
22652
          }
 
22653
        };
 
22654
 
 
22655
        /**
 
22656
         * Execute a callback for each of the child nodes of this node
 
22657
         * @param {function(child: Node, path: string, parent: Node)} callback
 
22658
         */
 
22659
        ConstantNode.prototype.forEach = function (callback) {
 
22660
          // nothing to do, we don't have childs
 
22661
        };
 
22662
 
 
22663
 
 
22664
        /**
 
22665
         * Create a new ConstantNode having it's childs be the results of calling
 
22666
         * the provided callback function for each of the childs of the original node.
 
22667
         * @param {function(child: Node, path: string, parent: Node) : Node} callback
 
22668
         * @returns {ConstantNode} Returns a clone of the node
 
22669
         */
 
22670
        ConstantNode.prototype.map = function (callback) {
 
22671
          return this.clone();
 
22672
        };
 
22673
 
 
22674
        /**
 
22675
         * Create a clone of this node, a shallow copy
 
22676
         * @return {ConstantNode}
 
22677
         */
 
22678
        ConstantNode.prototype.clone = function() {
 
22679
          return new ConstantNode(this.value, this.valueType);
 
22680
        };
 
22681
 
 
22682
        /**
 
22683
         * Get string representation
 
22684
         * @return {String} str
 
22685
         */
 
22686
        ConstantNode.prototype.toString = function() {
 
22687
          switch (this.valueType) {
 
22688
            case 'string':
 
22689
              return '"' + this.value + '"';
 
22690
 
 
22691
            default:
 
22692
              return this.value;
 
22693
          }
 
22694
        };
 
22695
 
 
22696
        /**
 
22697
         * Get LaTeX representation
 
22698
         * @return {String} str
 
22699
         */
 
22700
        ConstantNode.prototype.toTex = function() {
 
22701
          var value = this.value,
 
22702
              index;
 
22703
          switch (this.valueType) {
 
22704
            case 'string':
 
22705
              return '\\text{' + value + '}';
 
22706
 
 
22707
            case 'number':
 
22708
              index = value.toLowerCase().indexOf('e');
 
22709
              if (index !== -1) {
 
22710
                return value.substring(0, index) + ' \\cdot 10^{' +
 
22711
                    value.substring(index + 1) + '}';
 
22712
              }
 
22713
              return value;
 
22714
 
 
22715
            default:
 
22716
              return value;
 
22717
          }
 
22718
        };
 
22719
 
 
22720
        module.exports = ConstantNode;
 
22721
 
 
22722
 
 
22723
/***/ },
 
22724
/* 177 */
 
22725
/***/ function(module, exports, __webpack_require__) {
 
22726
 
 
22727
        'use strict';
 
22728
 
 
22729
        var Node = __webpack_require__(180);
 
22730
        var RangeNode = __webpack_require__(182);
 
22731
        var SymbolNode = __webpack_require__(183);
 
22732
 
 
22733
        var BigNumber = __webpack_require__(5);
 
22734
        var Range = __webpack_require__(8);
 
22735
 
 
22736
        var isNode = Node.isNode;
 
22737
        var isArray = Array.isArray;
 
22738
 
 
22739
        /**
 
22740
         * @constructor IndexNode
 
22741
         * @extends Node
 
22742
         *
 
22743
         * get a subset of a matrix
 
22744
         *
 
22745
         * @param {Node} object
 
22746
         * @param {Node[]} ranges
 
22747
         */
 
22748
        function IndexNode (object, ranges) {
 
22749
          if (!(this instanceof IndexNode)) {
 
22750
            throw new SyntaxError('Constructor must be called with the new operator');
 
22751
          }
 
22752
 
 
22753
          // validate input
 
22754
          if (!(object instanceof Node)) throw new TypeError('Node expected for parameter "object"');
 
22755
          if (!isArray(ranges) || !ranges.every(isNode)) {
 
22756
            throw new TypeError('Array containing Nodes expected for parameter "ranges"');
 
22757
          }
 
22758
 
 
22759
          this.object = object;
 
22760
          this.ranges = ranges;
 
22761
        }
 
22762
 
 
22763
        IndexNode.prototype = new Node();
 
22764
 
 
22765
        IndexNode.prototype.type = 'IndexNode';
 
22766
 
 
22767
        /**
 
22768
         * Compile the node to javascript code
 
22769
         * @param {Object} defs     Object which can be used to define functions
 
22770
         *                          or constants globally available for the compiled
 
22771
         *                          expression
 
22772
         * @return {String} js
 
22773
         * @private
 
22774
         */
 
22775
        IndexNode.prototype._compile = function (defs) {
 
22776
          return this.compileSubset(defs);
 
22777
        };
 
22778
 
 
22779
        /**
 
22780
         * Compile the node to javascript code
 
22781
         * @param {Object} defs           Object which can be used to define functions
 
22782
         *                                or constants globally available for the
 
22783
         *                                compiled expression
 
22784
         * @param {String} [replacement]  If provided, the function returns
 
22785
         *                                  "math.subset(obj, math.index(...), replacement)"
 
22786
         *                                Else, the function returns
 
22787
         *                                  "math.subset(obj, math.index(...))"
 
22788
         * @return {String} js
 
22789
         * @returns {string}
 
22790
         */
 
22791
        IndexNode.prototype.compileSubset = function(defs, replacement) {
 
22792
          // check whether any of the ranges expressions uses the context symbol 'end'
 
22793
          function test(node) {
 
22794
            return (node instanceof SymbolNode) && (node.name == 'end');
 
22795
          }
 
22796
 
 
22797
          var someUseEnd = false;
 
22798
          var rangesUseEnd = this.ranges.map(function (range) {
 
22799
            var useEnd = range.filter(test).length > 0;
 
22800
            someUseEnd = useEnd ? useEnd : someUseEnd;
 
22801
            return useEnd;
 
22802
          });
 
22803
 
 
22804
          // create a Range from start, step and end
 
22805
          defs.range = function (start, end, step) {
 
22806
            return new Range(
 
22807
                    start instanceof BigNumber ? start.toNumber() : start,
 
22808
                    end instanceof BigNumber ? end.toNumber() : end,
 
22809
                    step instanceof BigNumber ? step.toNumber() : step
 
22810
            );
 
22811
          };
 
22812
 
 
22813
          // TODO: implement support for bignumber (currently bignumbers are silently
 
22814
          //       reduced to numbers when changing the value to zero-based)
 
22815
 
 
22816
          // TODO: Optimization: when the range values are ConstantNodes,
 
22817
          //       we can beforehand resolve the zero-based value
 
22818
 
 
22819
          var ranges = this.ranges.map(function(range, i) {
 
22820
            var useEnd = rangesUseEnd[i];
 
22821
            if (range instanceof RangeNode) {
 
22822
              if (useEnd) {
 
22823
                // resolve end and create range
 
22824
                return '(function (scope) {' +
 
22825
                    '  scope = Object.create(scope); ' +
 
22826
                    '  scope["end"] = size[' + i + '];' +
 
22827
                    '  return range(' +
 
22828
                    '    ' + range.start._compile(defs) + ', ' +
 
22829
                    '    ' + range.end._compile(defs) + ', ' +
 
22830
                    '    ' + (range.step ? range.step._compile(defs) : '1') +
 
22831
                    '  );' +
 
22832
                    '})(scope)';
 
22833
              }
 
22834
              else {
 
22835
                // create range
 
22836
                return 'range(' +
 
22837
                    range.start._compile(defs) + ', ' +
 
22838
                    range.end._compile(defs) + ', ' +
 
22839
                    (range.step ? range.step._compile(defs) : '1') +
 
22840
                    ')';
 
22841
              }
 
22842
            }
 
22843
            else {
 
22844
              if (useEnd) {
 
22845
                // resolve the parameter 'end'
 
22846
                return '(function (scope) {' +
 
22847
                    '  scope = Object.create(scope); ' +
 
22848
                    '  scope["end"] = size[' + i + '];' +
 
22849
                    '  return ' + range._compile(defs) + ';' +
 
22850
                    '})(scope)'
 
22851
              }
 
22852
              else {
 
22853
                // just evaluate the expression
 
22854
                return range._compile(defs);
 
22855
              }
 
22856
            }
 
22857
          });
 
22858
 
 
22859
          // if some parameters use the 'end' parameter, we need to calculate the size
 
22860
          if (someUseEnd) {
 
22861
            return '(function () {' +
 
22862
                '  var obj = ' + this.object._compile(defs) + ';' +
 
22863
                '  var size = math.size(obj).valueOf();' +
 
22864
                '  return math.subset(' +
 
22865
                '    obj, ' +
 
22866
                '    math.index(' + ranges.join(', ') + ')' +
 
22867
                '    ' + (replacement ? (', ' + replacement) : '') +
 
22868
                '  );' +
 
22869
                '})()';
 
22870
          }
 
22871
          else {
 
22872
            return 'math.subset(' +
 
22873
                this.object._compile(defs) + ',' +
 
22874
                'math.index(' + ranges.join(', ') + ')' +
 
22875
                (replacement ? (', ' + replacement) : '') +
 
22876
                ')';
 
22877
          }
 
22878
        };
 
22879
 
 
22880
        /**
 
22881
         * Execute a callback for each of the child nodes of this node
 
22882
         * @param {function(child: Node, path: string, parent: Node)} callback
 
22883
         */
 
22884
        IndexNode.prototype.forEach = function (callback) {
 
22885
          // object
 
22886
          callback(this.object, 'object', this);
 
22887
 
 
22888
          // ranges
 
22889
          for (var i = 0; i < this.ranges.length; i++) {
 
22890
            callback(this.ranges[i], 'ranges[' + i + ']', this);
 
22891
          }
 
22892
        };
 
22893
 
 
22894
        /**
 
22895
         * Create a new IndexNode having it's childs be the results of calling
 
22896
         * the provided callback function for each of the childs of the original node.
 
22897
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
22898
         * @returns {IndexNode} Returns a transformed copy of the node
 
22899
         */
 
22900
        IndexNode.prototype.map = function (callback) {
 
22901
          var object = this._ifNode(callback(this.object, 'object', this));
 
22902
 
 
22903
          var ranges = [];
 
22904
          for (var i = 0; i < this.ranges.length; i++) {
 
22905
            ranges[i] = this._ifNode(callback(this.ranges[i], 'ranges[' + i + ']', this));
 
22906
          }
 
22907
 
 
22908
          return new IndexNode(object, ranges);
 
22909
        };
 
22910
 
 
22911
        /**
 
22912
         * Get the name of the object linked to this IndexNode
 
22913
         * @return {string} name
 
22914
         */
 
22915
        IndexNode.prototype.objectName = function() {
 
22916
          return this.object.name;
 
22917
        };
 
22918
 
 
22919
        /**
 
22920
         * Create a clone of this node, a shallow copy
 
22921
         * @return {IndexNode}
 
22922
         */
 
22923
        IndexNode.prototype.clone = function() {
 
22924
          return new IndexNode(this.object, this.ranges.slice(0));
 
22925
        };
 
22926
 
 
22927
        /**
 
22928
         * Get string representation
 
22929
         * @return {String} str
 
22930
         */
 
22931
        IndexNode.prototype.toString = function() {
 
22932
          // format the parameters like "[1, 0:5]"
 
22933
          return this.object.toString() + '[' + this.ranges.join(', ') + ']';
 
22934
        };
 
22935
 
 
22936
        /**
 
22937
         * Get LaTeX representation
 
22938
         * @return {String} str
 
22939
         */
 
22940
        IndexNode.prototype.toTex = function() {
 
22941
          return this.object.toTex() + '[' + this.ranges.join(', ') + ']';
 
22942
        };
 
22943
 
 
22944
        module.exports = IndexNode;
 
22945
 
 
22946
/***/ },
 
22947
/* 178 */
 
22948
/***/ function(module, exports, __webpack_require__) {
 
22949
 
 
22950
        'use strict';
 
22951
 
 
22952
        var Node = __webpack_require__(180);
 
22953
        var keywords = __webpack_require__(337);
 
22954
        var latex = __webpack_require__(338);
 
22955
        var isString = __webpack_require__(205).isString;
 
22956
        var isArray = Array.isArray;
 
22957
 
 
22958
        /**
 
22959
         * @constructor FunctionAssignmentNode
 
22960
         * @extends {Node}
 
22961
         * Function assignment
 
22962
         *
 
22963
         * @param {String} name           Function name
 
22964
         * @param {String[]} params         Function parameter names
 
22965
         * @param {Node} expr             The function expression
 
22966
         */
 
22967
        function FunctionAssignmentNode(name, params, expr) {
 
22968
          if (!(this instanceof FunctionAssignmentNode)) {
 
22969
            throw new SyntaxError('Constructor must be called with the new operator');
 
22970
          }
 
22971
 
 
22972
          // validate input
 
22973
          if (!isString(name)) throw new TypeError('String expected for parameter "name"');
 
22974
          if (!isArray(params) || !params.every(isString))  throw new TypeError('Array containing strings expected for parameter "params"');
 
22975
          if (!(expr instanceof Node)) throw new TypeError('Node expected for parameter "expr"');
 
22976
          if (name in keywords) throw new Error('Illegal function name, "'  + name +  '" is a reserved keyword');
 
22977
 
 
22978
          this.name = name;
 
22979
          this.params = params;
 
22980
          this.expr = expr;
 
22981
        }
 
22982
 
 
22983
        FunctionAssignmentNode.prototype = new Node();
 
22984
 
 
22985
        FunctionAssignmentNode.prototype.type = 'FunctionAssignmentNode';
 
22986
 
 
22987
        /**
 
22988
         * Compile the node to javascript code
 
22989
         * @param {Object} defs     Object which can be used to define functions
 
22990
         *                          or constants globally available for the compiled
 
22991
         *                          expression
 
22992
         * @return {String} js
 
22993
         * @private
 
22994
         */
 
22995
        FunctionAssignmentNode.prototype._compile = function (defs) {
 
22996
          return 'scope["' + this.name + '"] = ' +
 
22997
              '  (function (scope) {' +
 
22998
              '    scope = Object.create(scope); ' +
 
22999
              '    var fn = function ' + this.name + '(' + this.params.join(',') + ') {' +
 
23000
              '      if (arguments.length != ' + this.params.length + ') {' +
 
23001
              // TODO: use util.error.ArgumentsError here
 
23002
              // TODO: test arguments error
 
23003
              '        throw new SyntaxError("Wrong number of arguments in function ' + this.name + ' (" + arguments.length + " provided, ' + this.params.length + ' expected)");' +
 
23004
              '      }' +
 
23005
              this.params.map(function (variable, index) {
 
23006
                return 'scope["' + variable + '"] = arguments[' + index + '];';
 
23007
              }).join('') +
 
23008
              '      return ' + this.expr._compile(defs) + '' +
 
23009
              '    };' +
 
23010
              '    fn.syntax = "' + this.name + '(' + this.params.join(', ') + ')";' +
 
23011
              '    return fn;' +
 
23012
              '  })(scope);';
 
23013
        };
 
23014
 
 
23015
        /**
 
23016
         * Execute a callback for each of the child nodes of this node
 
23017
         * @param {function(child: Node, path: string, parent: Node)} callback
 
23018
         */
 
23019
        FunctionAssignmentNode.prototype.forEach = function (callback) {
 
23020
          callback(this.expr, 'expr', this);
 
23021
        };
 
23022
 
 
23023
        /**
 
23024
         * Create a new FunctionAssignmentNode having it's childs be the results of calling
 
23025
         * the provided callback function for each of the childs of the original node.
 
23026
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
23027
         * @returns {FunctionAssignmentNode} Returns a transformed copy of the node
 
23028
         */
 
23029
        FunctionAssignmentNode.prototype.map = function (callback) {
 
23030
          var expr = this._ifNode(callback(this.expr, 'expr', this));
 
23031
 
 
23032
          return new FunctionAssignmentNode(this.name, this.params.slice(0), expr);
 
23033
        };
 
23034
 
 
23035
        /**
 
23036
         * Create a clone of this node, a shallow copy
 
23037
         * @return {FunctionAssignmentNode}
 
23038
         */
 
23039
        FunctionAssignmentNode.prototype.clone = function() {
 
23040
          return new FunctionAssignmentNode(this.name, this.params.slice(0), this.expr);
 
23041
        };
 
23042
 
 
23043
        /**
 
23044
         * get string representation
 
23045
         * @return {String} str
 
23046
         */
 
23047
        FunctionAssignmentNode.prototype.toString = function() {
 
23048
          return 'function ' + this.name +
 
23049
              '(' + this.params.join(', ') + ') = ' +
 
23050
              this.expr.toString();
 
23051
        };
 
23052
 
 
23053
        /**
 
23054
         * get LaTeX representation
 
23055
         * @return {String} str
 
23056
         */
 
23057
        FunctionAssignmentNode.prototype.toTex = function() {
 
23058
          return this.name +
 
23059
              latex.addBraces(this.params.map(latex.toSymbol).join(', '), true) + '=' +
 
23060
              latex.addBraces(this.expr.toTex());
 
23061
        };
 
23062
 
 
23063
        module.exports = FunctionAssignmentNode;
 
23064
 
 
23065
 
 
23066
/***/ },
 
23067
/* 179 */
 
23068
/***/ function(module, exports, __webpack_require__) {
 
23069
 
 
23070
        'use strict';
 
23071
 
 
23072
        var Node = __webpack_require__(180);
 
23073
        var SymbolNode = __webpack_require__(183);
 
23074
 
 
23075
        var latex = __webpack_require__(338);
 
23076
        var isNode = Node.isNode;
 
23077
        var isArray = Array.isArray;
 
23078
 
 
23079
        /**
 
23080
         * @constructor FunctionNode
 
23081
         * @extends {Node}
 
23082
         * invoke a list with arguments on a node
 
23083
         * @param {string} name
 
23084
         * @param {Node[]} args
 
23085
         */
 
23086
        function FunctionNode (name, args) {
 
23087
          if (!(this instanceof FunctionNode)) {
 
23088
            throw new SyntaxError('Constructor must be called with the new operator');
 
23089
          }
 
23090
 
 
23091
          // validate input
 
23092
          if (typeof name !== 'string') throw new TypeError('string expected for parameter "name"');
 
23093
          if (!isArray(args) || !args.every(isNode)) {
 
23094
            throw new TypeError('Array containing Nodes expected for parameter "args"');
 
23095
          }
 
23096
 
 
23097
          this.name = name;
 
23098
          this.args = args || [];
 
23099
        }
 
23100
 
 
23101
        FunctionNode.prototype = new Node();
 
23102
 
 
23103
        FunctionNode.prototype.type = 'FunctionNode';
 
23104
 
 
23105
        /**
 
23106
         * Compile the node to javascript code
 
23107
         * @param {Object} defs     Object which can be used to define functions
 
23108
         *                          or constants globally available for the compiled
 
23109
         *                          expression
 
23110
         * @return {String} js
 
23111
         * @private
 
23112
         */
 
23113
        FunctionNode.prototype._compile = function (defs) {
 
23114
          var fn = defs.math[this.name];
 
23115
          var isRaw = (typeof fn === 'function') && (fn.rawArgs == true);
 
23116
 
 
23117
          // compile the parameters
 
23118
          var args = this.args.map(function (arg) {
 
23119
            return arg._compile(defs);
 
23120
          });
 
23121
 
 
23122
          if (isRaw) {
 
23123
            // pass unevaluated parameters (nodes) to the function
 
23124
            var paramsName;
 
23125
            do {
 
23126
              paramsName = 'p' + Math.round(Math.random() * 10000);
 
23127
            }
 
23128
            while (paramsName in defs);
 
23129
            defs[paramsName] = this.args;
 
23130
 
 
23131
            return '("' + this.name + '" in scope ? ' +
 
23132
                'scope["' + this.name + '"](' + args.join(', ') + ') : ' +
 
23133
                'math["' + this.name + '"]' + '(' + paramsName + ', math, scope))';
 
23134
          }
 
23135
          else {
 
23136
            // "regular" evaluation
 
23137
            var symbol = new SymbolNode(this.name);
 
23138
            return symbol._compile(defs) + '(' + args.join(', ') + ')';
 
23139
          }
 
23140
        };
 
23141
 
 
23142
        /**
 
23143
         * Execute a callback for each of the child nodes of this node
 
23144
         * @param {function(child: Node, path: string, parent: Node)} callback
 
23145
         */
 
23146
        FunctionNode.prototype.forEach = function (callback) {
 
23147
          for (var i = 0; i < this.args.length; i++) {
 
23148
            callback(this.args[i], 'args[' + i + ']', this);
 
23149
          }
 
23150
        };
 
23151
 
 
23152
        /**
 
23153
         * Create a new FunctionNode having it's childs be the results of calling
 
23154
         * the provided callback function for each of the childs of the original node.
 
23155
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
23156
         * @returns {FunctionNode} Returns a transformed copy of the node
 
23157
         */
 
23158
        FunctionNode.prototype.map = function (callback) {
 
23159
          var args = [];
 
23160
          for (var i = 0; i < this.args.length; i++) {
 
23161
            args[i] = this._ifNode(callback(this.args[i], 'args[' + i + ']', this));
 
23162
          }
 
23163
          return new FunctionNode(this.name, args);
 
23164
        };
 
23165
 
 
23166
        /**
 
23167
         * Create a clone of this node, a shallow copy
 
23168
         * @return {FunctionNode}
 
23169
         */
 
23170
        FunctionNode.prototype.clone = function() {
 
23171
          return new FunctionNode(this.name, this.args.slice(0));
 
23172
        };
 
23173
 
 
23174
        /**
 
23175
         * Get string representation
 
23176
         * @return {String} str
 
23177
         */
 
23178
        FunctionNode.prototype.toString = function() {
 
23179
          // format the parameters like "add(2, 4.2)"
 
23180
          return this.name + '(' + this.args.join(', ') + ')';
 
23181
        };
 
23182
 
 
23183
        /**
 
23184
         * Get LaTeX representation
 
23185
         * @return {String} str
 
23186
         */
 
23187
        FunctionNode.prototype.toTex = function() {
 
23188
          return latex.toArgs(this);
 
23189
        };
 
23190
 
 
23191
        module.exports = FunctionNode;
 
23192
 
 
23193
 
 
23194
/***/ },
 
23195
/* 180 */
 
23196
/***/ function(module, exports, __webpack_require__) {
 
23197
 
 
23198
        'use strict';
 
23199
 
 
23200
        var keywords = __webpack_require__(337);
 
23201
 
 
23202
        /**
 
23203
         * Node
 
23204
         */
 
23205
        function Node() {
 
23206
          if (!(this instanceof Node)) {
 
23207
            throw new SyntaxError('Constructor must be called with the new operator');
 
23208
          }
 
23209
        }
 
23210
 
 
23211
        /**
 
23212
         * Evaluate the node
 
23213
         * @return {*} result
 
23214
         */
 
23215
        // TODO: cleanup deprecated code one day. Deprecated since version 0.19.0
 
23216
        Node.prototype.eval = function () {
 
23217
          throw new Error('Node.eval is deprecated. ' +
 
23218
              'Use Node.compile(math).eval([scope]) instead.');
 
23219
        };
 
23220
 
 
23221
        Node.prototype.type = 'Node';
 
23222
 
 
23223
        /**
 
23224
         * Compile the node to javascript code
 
23225
         * @param {Object} math             math.js instance
 
23226
         * @return {{eval: function}} expr  Returns an object with a function 'eval',
 
23227
         *                                  which can be invoked as expr.eval([scope]),
 
23228
         *                                  where scope is an optional object with
 
23229
         *                                  variables.
 
23230
         */
 
23231
        Node.prototype.compile = function (math) {
 
23232
          if (!(math instanceof Object)) {
 
23233
            throw new TypeError('Object expected for parameter math');
 
23234
          }
 
23235
 
 
23236
          // definitions globally available inside the closure of the compiled expressions
 
23237
          var defs = {
 
23238
            math: _transform(math),
 
23239
            _validateScope: _validateScope
 
23240
          };
 
23241
 
 
23242
          var code = this._compile(defs);
 
23243
 
 
23244
          var defsCode = Object.keys(defs).map(function (name) {
 
23245
            return '    var ' + name + ' = defs["' + name + '"];';
 
23246
          });
 
23247
 
 
23248
          var factoryCode =
 
23249
              defsCode.join(' ') +
 
23250
                  'return {' +
 
23251
                  '  "eval": function (scope) {' +
 
23252
                  '    if (scope) _validateScope(scope);' +
 
23253
                  '    scope = scope || {};' +
 
23254
                  '    return ' + code + ';' +
 
23255
                  '  }' +
 
23256
                  '};';
 
23257
 
 
23258
          var factory = new Function ('defs', factoryCode);
 
23259
          return factory(defs);
 
23260
        };
 
23261
 
 
23262
        /**
 
23263
         * Compile the node to javascript code
 
23264
         * @param {Object} defs     Object which can be used to define functions
 
23265
         *                          and constants globally available inside the closure
 
23266
         *                          of the compiled expression
 
23267
         * @return {String} js
 
23268
         * @private
 
23269
         */
 
23270
        Node.prototype._compile = function (defs) {
 
23271
          // must be implemented by each of the Node implementations
 
23272
          throw new Error('Cannot compile a Node interface');
 
23273
        };
 
23274
 
 
23275
        /**
 
23276
         * Execute a callback for each of the child nodes of this node
 
23277
         * @param {function(child: Node, path: string, parent: Node)} callback
 
23278
         */
 
23279
        Node.prototype.forEach = function (callback) {
 
23280
          // must be implemented by each of the Node implementations
 
23281
          throw new Error('Cannot run forEach on a Node interface');
 
23282
        };
 
23283
 
 
23284
        /**
 
23285
         * Create a new Node having it's childs be the results of calling
 
23286
         * the provided callback function for each of the childs of the original node.
 
23287
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
23288
         * @returns {OperatorNode} Returns a transformed copy of the node
 
23289
         */
 
23290
        Node.prototype.map = function (callback) {
 
23291
          // must be implemented by each of the Node implementations
 
23292
          throw new Error('Cannot run map on a Node interface');
 
23293
        };
 
23294
 
 
23295
        /**
 
23296
         * Validate whether an object is a Node, for use with map
 
23297
         * @param {Node} node
 
23298
         * @returns {Node} Returns the input if it's a node, else throws an Error
 
23299
         * @protected
 
23300
         */
 
23301
        Node.prototype._ifNode = function (node) {
 
23302
          if (!(node instanceof Node)) {
 
23303
            throw new TypeError('Callback function must return a Node');
 
23304
          }
 
23305
 
 
23306
          return node;
 
23307
        };
 
23308
 
 
23309
        /**
 
23310
         * Recursively traverse all nodes in a node tree. Executes given callback for
 
23311
         * this node and each of its child nodes.
 
23312
         * @param {function(node: Node, path: string, parent: Node)} callback
 
23313
         *          A callback called for every node in the node tree.
 
23314
         */
 
23315
        Node.prototype.traverse = function (callback) {
 
23316
          // execute callback for itself
 
23317
          callback(this, null, null);
 
23318
 
 
23319
          // recursively traverse over all childs of a node
 
23320
          function _traverse (node, callback) {
 
23321
            node.forEach(function(child, path, parent) {
 
23322
              callback(child, path, parent);
 
23323
              _traverse(child, callback);
 
23324
            });
 
23325
          }
 
23326
          _traverse(this, callback);
 
23327
        };
 
23328
 
 
23329
        /**
 
23330
         * Recursively transform a node tree via a transform function.
 
23331
         *
 
23332
         * For example, to replace all nodes of type SymbolNode having name 'x' with a
 
23333
         * ConstantNode with value 2:
 
23334
         *
 
23335
         *     var res = Node.transform(function (node, path, parent) {
 
23336
         *       if (node instanceof SymbolNode) && (node.name == 'x')) {
 
23337
         *         return new ConstantNode(2);
 
23338
         *       }
 
23339
         *       else {
 
23340
         *         return node;
 
23341
         *       }
 
23342
         *     });
 
23343
         *
 
23344
         * @param {function(node: Node, path: string, parent: Node) : Node} callback
 
23345
         *          A mapping function accepting a node, and returning
 
23346
         *          a replacement for the node or the original node.
 
23347
         *          Signature: callback(node: Node, index: string, parent: Node) : Node
 
23348
         * @return {Node} Returns the original node or its replacement
 
23349
         */
 
23350
        Node.prototype.transform = function (callback) {
 
23351
          // check itself
 
23352
          var replacement = callback(this, null, null);
 
23353
          if (replacement !== this) {
 
23354
            return replacement;
 
23355
          }
 
23356
 
 
23357
          // traverse over all childs
 
23358
          function _transform (node, callback) {
 
23359
            return node.map(function(child, path, parent) {
 
23360
              var replacement = callback(child, path, parent);
 
23361
              return (replacement !== child) ? replacement : _transform(child, callback);
 
23362
            });
 
23363
          }
 
23364
          return _transform(this, callback);
 
23365
        };
 
23366
 
 
23367
        /**
 
23368
         * Find any node in the node tree matching given filter function. For example, to
 
23369
         * find all nodes of type SymbolNode having name 'x':
 
23370
         *
 
23371
         *     var results = Node.filter(function (node) {
 
23372
         *       return (node instanceof SymbolNode) && (node.name == 'x');
 
23373
         *     });
 
23374
         *
 
23375
         * @param {function(node: Node, path: string, parent: Node) : Node} callback
 
23376
         *            A test function returning true when a node matches, and false
 
23377
         *            otherwise. Function signature:
 
23378
         *            callback(node: Node, index: string, parent: Node) : boolean
 
23379
         * @return {Node[]} nodes       An array with nodes matching given filter criteria
 
23380
         */
 
23381
        Node.prototype.filter = function (callback) {
 
23382
          var nodes = [];
 
23383
 
 
23384
          this.traverse(function (node, path, parent) {
 
23385
            if (callback(node, path, parent)) {
 
23386
              nodes.push(node);
 
23387
            }
 
23388
          });
 
23389
 
 
23390
          return nodes;
 
23391
        };
 
23392
 
 
23393
        // TODO: deprecated since version 1.1.0, remove this some day
 
23394
        Node.prototype.find = function () {
 
23395
          throw new Error('Function Node.find is deprecated. Use Node.filter instead.');
 
23396
        };
 
23397
 
 
23398
        // TODO: deprecated since version 1.1.0, remove this some day
 
23399
        Node.prototype.match = function () {
 
23400
          throw new Error('Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.');
 
23401
        };
 
23402
 
 
23403
        /**
 
23404
         * Create a clone of this node, a shallow copy
 
23405
         * @return {Node}
 
23406
         */
 
23407
        Node.prototype.clone = function() {
 
23408
          // must be implemented by each of the Node implementations
 
23409
          throw new Error('Cannot clone a Node interface');
 
23410
        };
 
23411
 
 
23412
        /**
 
23413
         * Get string representation
 
23414
         * @return {String}
 
23415
         */
 
23416
        Node.prototype.toString = function() {
 
23417
          return '';
 
23418
        };
 
23419
 
 
23420
        /**
 
23421
         * Get LaTeX representation
 
23422
         * @return {String}
 
23423
         */
 
23424
        Node.prototype.toTex = function() {
 
23425
          return '';
 
23426
        };
 
23427
 
 
23428
        /**
 
23429
         * Test whether an object is a Node
 
23430
         * @param {*} object
 
23431
         * @returns {boolean} isNode
 
23432
         */
 
23433
        Node.isNode = function(object) {
 
23434
          return object instanceof Node;
 
23435
        };
 
23436
 
 
23437
        /**
 
23438
         * Validate the symbol names of a scope.
 
23439
         * Throws an error when the scope contains an illegal symbol.
 
23440
         * @param {Object} scope
 
23441
         */
 
23442
        function _validateScope (scope) {
 
23443
          for (var symbol in scope) {
 
23444
            if (scope.hasOwnProperty(symbol)) {
 
23445
              if (symbol in keywords) {
 
23446
                throw new Error('Scope contains an illegal symbol, "' + symbol + '" is a reserved keyword');
 
23447
              }
 
23448
            }
 
23449
          }
 
23450
        }
 
23451
 
 
23452
        /**
 
23453
         * Replace all functions having a transform function attached at property transform
 
23454
         * with their transform.
 
23455
         * @param {Object} math
 
23456
         * @return {Object} transformed
 
23457
         * @private
 
23458
         */
 
23459
        function _transform(math) {
 
23460
          var transformed = Object.create(math);
 
23461
 
 
23462
          if (math.expression && math.expression.transform) {
 
23463
            for (var name in math.expression.transform) {
 
23464
              if (math.expression.transform.hasOwnProperty(name)) {
 
23465
                transformed[name] = math.expression.transform[name];
 
23466
              }
 
23467
            }
 
23468
          }
 
23469
 
 
23470
          return transformed;
 
23471
        }
 
23472
 
 
23473
        module.exports = Node;
 
23474
 
 
23475
 
 
23476
/***/ },
 
23477
/* 181 */
 
23478
/***/ function(module, exports, __webpack_require__) {
 
23479
 
 
23480
        'use strict';
 
23481
 
 
23482
        var Node = __webpack_require__(180),
 
23483
            ConstantNode = __webpack_require__(176),
 
23484
            SymbolNode = __webpack_require__(183),
 
23485
            FunctionNode = __webpack_require__(179),
 
23486
            latex = __webpack_require__(338);
 
23487
 
 
23488
        /**
 
23489
         * @constructor OperatorNode
 
23490
         * @extends {Node}
 
23491
         * An operator with two arguments, like 2+3
 
23492
         *
 
23493
         * @param {String} op       Operator name, for example '+'
 
23494
         * @param {String} fn       Function name, for example 'add'
 
23495
         * @param {Node[]} args     Operator arguments
 
23496
         */
 
23497
        function OperatorNode (op, fn, args) {
 
23498
          if (!(this instanceof OperatorNode)) {
 
23499
            throw new SyntaxError('Constructor must be called with the new operator');
 
23500
          }
 
23501
 
 
23502
          // TODO: validate input
 
23503
          this.op = op;
 
23504
          this.fn = fn;
 
23505
          this.args = args || [];
 
23506
        }
 
23507
 
 
23508
        OperatorNode.prototype = new Node();
 
23509
 
 
23510
        OperatorNode.prototype.type = 'OperatorNode';
 
23511
 
 
23512
        /**
 
23513
         * Compile the node to javascript code
 
23514
         * @param {Object} defs     Object which can be used to define functions
 
23515
         *                          or constants globally available for the compiled
 
23516
         *                          expression
 
23517
         * @return {String} js
 
23518
         * @private
 
23519
         */
 
23520
        OperatorNode.prototype._compile = function (defs) {
 
23521
          if (!(this.fn in defs.math)) {
 
23522
            throw new Error('Function ' + this.fn + ' missing in provided namespace "math"');
 
23523
          }
 
23524
 
 
23525
          var args = this.args.map(function (arg) {
 
23526
            return arg._compile(defs);
 
23527
          });
 
23528
          return 'math.' + this.fn + '(' + args.join(', ') + ')';
 
23529
        };
 
23530
 
 
23531
        /**
 
23532
         * Execute a callback for each of the child nodes of this node
 
23533
         * @param {function(child: Node, path: string, parent: Node)} callback
 
23534
         */
 
23535
        OperatorNode.prototype.forEach = function (callback) {
 
23536
          for (var i = 0; i < this.args.length; i++) {
 
23537
            callback(this.args[i], 'args[' + i + ']', this);
 
23538
          }
 
23539
        };
 
23540
 
 
23541
        /**
 
23542
         * Create a new OperatorNode having it's childs be the results of calling
 
23543
         * the provided callback function for each of the childs of the original node.
 
23544
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
23545
         * @returns {OperatorNode} Returns a transformed copy of the node
 
23546
         */
 
23547
        OperatorNode.prototype.map = function (callback) {
 
23548
          var args = [];
 
23549
          for (var i = 0; i < this.args.length; i++) {
 
23550
            args[i] = this._ifNode(callback(this.args[i], 'args[' + i + ']', this));
 
23551
          }
 
23552
          return new OperatorNode(this.op, this.fn, args);
 
23553
        };
 
23554
 
 
23555
        /**
 
23556
         * Create a clone of this node, a shallow copy
 
23557
         * @return {OperatorNode}
 
23558
         */
 
23559
        OperatorNode.prototype.clone = function() {
 
23560
          return new OperatorNode(this.op, this.fn, this.args.slice(0));
 
23561
        };
 
23562
 
 
23563
        /**
 
23564
         * Get string representation
 
23565
         * @return {String} str
 
23566
         */
 
23567
        OperatorNode.prototype.toString = function() {
 
23568
          var args = this.args;
 
23569
 
 
23570
          switch (args.length) {
 
23571
            case 1:
 
23572
              if (this.op == '-') {
 
23573
                // special case: unary minus
 
23574
                return '-' + args[0].toString();
 
23575
              }
 
23576
              else {
 
23577
                // for example '5!'
 
23578
                return args[0].toString() + this.op;
 
23579
              }
 
23580
 
 
23581
            case 2: // for example '2+3'
 
23582
              var lhs = args[0].toString();
 
23583
              if (args[0] instanceof OperatorNode) {
 
23584
                lhs = '(' + lhs + ')';
 
23585
              }
 
23586
              var rhs = args[1].toString();
 
23587
              if (args[1] instanceof OperatorNode) {
 
23588
                rhs = '(' + rhs + ')';
 
23589
              }
 
23590
              return lhs + ' ' + this.op + ' ' + rhs;
 
23591
 
 
23592
            default: // this should not occur. format as a function call
 
23593
              return this.op + '(' + this.args.join(', ') + ')';
 
23594
          }
 
23595
        };
 
23596
 
 
23597
        /**
 
23598
         * Get LaTeX representation
 
23599
         * @return {String} str
 
23600
         */
 
23601
        OperatorNode.prototype.toTex = function() {
 
23602
          var args = this.args,
 
23603
              mop = latex.toOperator(this.op),
 
23604
              lp = args[0],
 
23605
              rp = args[1];
 
23606
 
 
23607
          switch (args.length) {
 
23608
            case 1:
 
23609
              var operand = lp.toTex();
 
23610
              switch (this.op) {
 
23611
                case '-': //unary minus needs brackets around '-' and '+'
 
23612
                  if (lp instanceof OperatorNode && (lp.op === '-' || lp.op === '+')) {
 
23613
                    return this.op + latex.addBraces(operand, true);
 
23614
                  }
 
23615
                case '+':
 
23616
                  return this.op + operand;
 
23617
                  break;
 
23618
                default: // fox example '5!'
 
23619
                  if (lp instanceof OperatorNode) {
 
23620
                    return latex.addBraces(operand, true) + this.op;
 
23621
                  }
 
23622
                  return operand + this.op;
 
23623
              }
 
23624
 
 
23625
            case 2: // for example '2+3'
 
23626
              var lhs = lp.toTex(),
 
23627
                  lhb = false,
 
23628
                  rhs = rp.toTex(),
 
23629
                  rhb = false,
 
23630
                  lop = '',
 
23631
                  rop = '';
 
23632
 
 
23633
              switch (this.op) {
 
23634
                case '/':
 
23635
                  lop = mop;
 
23636
                  mop = '';
 
23637
 
 
23638
                  break;
 
23639
 
 
23640
                case '*':
 
23641
                  if (lp instanceof OperatorNode) {
 
23642
                    if (lp.op === '+' || lp.op === '-') {
 
23643
                      lhb = true;
 
23644
                    }
 
23645
                  }
 
23646
 
 
23647
                  if (rp instanceof OperatorNode) {
 
23648
                    if (rp.op === '+' || rp.op === '-' || rp.op === '*') {
 
23649
                      rhb = true;
 
23650
                    }
 
23651
                  }
 
23652
 
 
23653
                  if ((lp instanceof ConstantNode || lp instanceof OperatorNode) &&
 
23654
                      (rp instanceof ConstantNode || rp instanceof OperatorNode)) {
 
23655
                    mop = ' \\cdot ';
 
23656
                  }
 
23657
                  else {
 
23658
                    mop = ' \\, ';
 
23659
                  }
 
23660
 
 
23661
                  break;
 
23662
 
 
23663
                case '-':
 
23664
                  if (rp instanceof OperatorNode) {
 
23665
                    if (rp.op === '+' | rp.op === '-' ) {
 
23666
                      rhb = true;
 
23667
                    }
 
23668
                  }
 
23669
                  break;
 
23670
 
 
23671
                case '^':
 
23672
                  if (lp instanceof OperatorNode || lp instanceof FunctionNode) {
 
23673
                    lhb = true;
 
23674
                  }
 
23675
                  else if (lp instanceof SymbolNode) {
 
23676
                    lhb = null;
 
23677
                  }
 
23678
 
 
23679
                  break;
 
23680
 
 
23681
                case 'to':
 
23682
                  rhs = latex.toUnit(rhs, true);
 
23683
                  break;
 
23684
              }
 
23685
 
 
23686
              lhs = latex.addBraces(lhs, lhb);
 
23687
              rhs = latex.addBraces(rhs, rhb);
 
23688
 
 
23689
              return lop + lhs + mop + rhs + rop;
 
23690
 
 
23691
            default: // this should not occur. format as a function call
 
23692
              return mop + '(' + this.args.map(latex.toSymbol).join(', ') + ')';
 
23693
          }
 
23694
        };
 
23695
 
 
23696
        module.exports = OperatorNode;
 
23697
 
 
23698
 
 
23699
/***/ },
 
23700
/* 182 */
 
23701
/***/ function(module, exports, __webpack_require__) {
 
23702
 
 
23703
        'use strict';
 
23704
 
 
23705
        var Node = __webpack_require__(180);
 
23706
 
 
23707
        var isNode = Node.isNode;
 
23708
 
 
23709
        /**
 
23710
         * @constructor RangeNode
 
23711
         * @extends {Node}
 
23712
         * create a range
 
23713
         * @param {Node} start  included lower-bound
 
23714
         * @param {Node} end    included lower-bound
 
23715
         * @param {Node} [step] optional step
 
23716
         */
 
23717
        function RangeNode (start, end, step) {
 
23718
          if (!(this instanceof RangeNode)) {
 
23719
            throw new SyntaxError('Constructor must be called with the new operator');
 
23720
          }
 
23721
 
 
23722
          // validate inputs
 
23723
          if (!isNode(start)) throw new TypeError('Node expected');
 
23724
          if (!isNode(end)) throw new TypeError('Node expected');
 
23725
          if (step && !isNode(step)) throw new TypeError('Node expected');
 
23726
          if (arguments.length > 3) throw new Error('Too many arguments');
 
23727
 
 
23728
          this.start = start;         // included lower-bound
 
23729
          this.end   = end;           // included upper-bound
 
23730
          this.step  = step || null;  // optional step
 
23731
        }
 
23732
 
 
23733
        RangeNode.prototype = new Node();
 
23734
 
 
23735
        RangeNode.prototype.type = 'RangeNode';
 
23736
 
 
23737
        /**
 
23738
         * Compile the node to javascript code
 
23739
         * @param {Object} defs     Object which can be used to define functions
 
23740
         *                          or constants globally available for the compiled
 
23741
         *                          expression
 
23742
         * @return {String} js
 
23743
         * @private
 
23744
         */
 
23745
        RangeNode.prototype._compile = function (defs) {
 
23746
          return 'math.range(' +
 
23747
              this.start._compile(defs) + ', ' +
 
23748
              this.end._compile(defs) +
 
23749
              (this.step ? (', ' + this.step._compile(defs)) : '') +
 
23750
              ')';
 
23751
        };
 
23752
 
 
23753
        /**
 
23754
         * Execute a callback for each of the child nodes of this node
 
23755
         * @param {function(child: Node, path: string, parent: Node)} callback
 
23756
         */
 
23757
        RangeNode.prototype.forEach = function (callback) {
 
23758
          callback(this.start, 'start', this);
 
23759
          callback(this.end, 'end', this);
 
23760
          if (this.step) {
 
23761
            callback(this.step, 'step', this);
 
23762
          }
 
23763
        };
 
23764
 
 
23765
        /**
 
23766
         * Create a new RangeNode having it's childs be the results of calling
 
23767
         * the provided callback function for each of the childs of the original node.
 
23768
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
23769
         * @returns {RangeNode} Returns a transformed copy of the node
 
23770
         */
 
23771
        RangeNode.prototype.map = function (callback) {
 
23772
          return new RangeNode(
 
23773
              this._ifNode(callback(this.start, 'start', this)),
 
23774
              this._ifNode(callback(this.end, 'end', this)),
 
23775
              this.step && this._ifNode(callback(this.step, 'step', this))
 
23776
          );
 
23777
        };
 
23778
 
 
23779
        /**
 
23780
         * Create a clone of this node, a shallow copy
 
23781
         * @return {RangeNode}
 
23782
         */
 
23783
        RangeNode.prototype.clone = function() {
 
23784
          return new RangeNode(this.start, this.end, this.step && this.step);
 
23785
        };
 
23786
 
 
23787
        /**
 
23788
         * Get string representation
 
23789
         * @return {String} str
 
23790
         */
 
23791
        RangeNode.prototype.toString = function() {
 
23792
          // format the range like "start:step:end"
 
23793
          var str = this.start.toString();
 
23794
          if (this.step) {
 
23795
            str += ':' + this.step.toString();
 
23796
          }
 
23797
          str += ':' + this.end.toString();
 
23798
 
 
23799
          return str;
 
23800
        };
 
23801
 
 
23802
        /**
 
23803
         * Get LaTeX representation
 
23804
         * @return {String} str
 
23805
         */
 
23806
        RangeNode.prototype.toTex = function() {
 
23807
          var str = this.start.toTex();
 
23808
          if (this.step) {
 
23809
            str += ':' + this.step.toTex();
 
23810
          }
 
23811
          str += ':' + this.end.toTex();
 
23812
 
 
23813
          return str;
 
23814
        };
 
23815
 
 
23816
        module.exports = RangeNode;
 
23817
 
 
23818
 
 
23819
/***/ },
 
23820
/* 183 */
 
23821
/***/ function(module, exports, __webpack_require__) {
 
23822
 
 
23823
        'use strict';
 
23824
 
 
23825
        var Node = __webpack_require__(180),
 
23826
            Unit = __webpack_require__(11),
 
23827
 
 
23828
            latex = __webpack_require__(338),
 
23829
            isString = __webpack_require__(205).isString;
 
23830
 
 
23831
        /**
 
23832
         * @constructor SymbolNode
 
23833
         * @extends {Node}
 
23834
         * A symbol node can hold and resolve a symbol
 
23835
         * @param {String} name
 
23836
         * @extends {Node}
 
23837
         */
 
23838
        function SymbolNode(name) {
 
23839
          if (!(this instanceof SymbolNode)) {
 
23840
            throw new SyntaxError('Constructor must be called with the new operator');
 
23841
          }
 
23842
 
 
23843
          // validate input
 
23844
          if (!isString(name))  throw new TypeError('String expected for parameter "name"');
 
23845
 
 
23846
          this.name = name;
 
23847
        }
 
23848
 
 
23849
        SymbolNode.prototype = new Node();
 
23850
 
 
23851
        SymbolNode.prototype.type = 'SymbolNode';
 
23852
 
 
23853
        /**
 
23854
         * Compile the node to javascript code
 
23855
         * @param {Object} defs     Object which can be used to define functions
 
23856
         *                          or constants globally available for the compiled
 
23857
         *                          expression
 
23858
         * @return {String} js
 
23859
         * @private
 
23860
         */
 
23861
        SymbolNode.prototype._compile = function (defs) {
 
23862
          // add a function to the definitions
 
23863
          defs['undef'] = undef;
 
23864
          defs['Unit'] = Unit;
 
23865
 
 
23866
          if (this.name in defs.math) {
 
23867
            return '("' + this.name + '" in scope ? scope["' + this.name + '"] : math["' + this.name + '"])';
 
23868
          }
 
23869
          else {
 
23870
            return '(' +
 
23871
                '"' + this.name + '" in scope ? scope["' + this.name + '"] : ' +
 
23872
                (Unit.isValuelessUnit(this.name) ?
 
23873
                    'new Unit(null, "' + this.name + '")' :
 
23874
                    'undef("' + this.name + '")') +
 
23875
                ')';
 
23876
          }
 
23877
        };
 
23878
 
 
23879
        /**
 
23880
         * Execute a callback for each of the child nodes of this node
 
23881
         * @param {function(child: Node, path: string, parent: Node)} callback
 
23882
         */
 
23883
        SymbolNode.prototype.forEach = function (callback) {
 
23884
          // nothing to do, we don't have childs
 
23885
        };
 
23886
 
 
23887
        /**
 
23888
         * Create a new SymbolNode having it's childs be the results of calling
 
23889
         * the provided callback function for each of the childs of the original node.
 
23890
         * @param {function(child: Node, path: string, parent: Node) : Node} callback
 
23891
         * @returns {SymbolNode} Returns a clone of the node
 
23892
         */
 
23893
        SymbolNode.prototype.map = function (callback) {
 
23894
          return this.clone();
 
23895
        };
 
23896
 
 
23897
        /**
 
23898
         * Throws an error 'Undefined symbol {name}'
 
23899
         * @param {String} name
 
23900
         */
 
23901
        function undef (name) {
 
23902
          throw new Error('Undefined symbol ' + name);
 
23903
        }
 
23904
 
 
23905
        /**
 
23906
         * Create a clone of this node, a shallow copy
 
23907
         * @return {SymbolNode}
 
23908
         */
 
23909
        SymbolNode.prototype.clone = function() {
 
23910
          return new SymbolNode(this.name);
 
23911
        };
 
23912
 
 
23913
        /**
 
23914
         * Get string representation
 
23915
         * @return {String} str
 
23916
         * @override
 
23917
         */
 
23918
        SymbolNode.prototype.toString = function() {
 
23919
          return this.name;
 
23920
        };
 
23921
 
 
23922
        /**
 
23923
         * Get LaTeX representation
 
23924
         * @return {String} str
 
23925
         * @override
 
23926
         */
 
23927
        SymbolNode.prototype.toTex = function() {
 
23928
          return latex.toSymbol(this.name);
 
23929
        };
 
23930
 
 
23931
        module.exports = SymbolNode;
 
23932
 
 
23933
 
 
23934
/***/ },
 
23935
/* 184 */
 
23936
/***/ function(module, exports, __webpack_require__) {
 
23937
 
 
23938
        'use strict';
 
23939
 
 
23940
        var Node = __webpack_require__(180),
 
23941
            IndexNode = __webpack_require__(177);
 
23942
 
 
23943
        /**
 
23944
         * @constructor UpdateNode
 
23945
         * @extends {Node}
 
23946
         * Update a matrix subset, like A[2,3] = 4.5
 
23947
         *
 
23948
         * @param {IndexNode} index             IndexNode containing symbol and ranges
 
23949
         * @param {Node} expr                   The expression defining the symbol
 
23950
         */
 
23951
        function UpdateNode(index, expr) {
 
23952
          if (!(this instanceof UpdateNode)) {
 
23953
            throw new SyntaxError('Constructor must be called with the new operator');
 
23954
          }
 
23955
 
 
23956
          if (!(index instanceof IndexNode)) {
 
23957
            throw new TypeError('Expected IndexNode for parameter "index"');
 
23958
          }
 
23959
          if (!(expr instanceof Node)) {
 
23960
            throw new TypeError('Expected Node for parameter "expr"');
 
23961
          }
 
23962
 
 
23963
          this.index = index;
 
23964
          this.expr = expr;
 
23965
        }
 
23966
 
 
23967
        UpdateNode.prototype = new Node();
 
23968
 
 
23969
        UpdateNode.prototype.type = 'UpdateNode';
 
23970
 
 
23971
        /**
 
23972
         * Compile the node to javascript code
 
23973
         * @param {Object} defs     Object which can be used to define functions
 
23974
         *                          or constants globally available for the compiled
 
23975
         *                          expression
 
23976
         * @return {String} js
 
23977
         * @private
 
23978
         */
 
23979
        UpdateNode.prototype._compile = function (defs) {
 
23980
          return 'scope["' + this.index.objectName() + '\"] = ' +
 
23981
              this.index.compileSubset(defs,  this.expr._compile(defs));
 
23982
        };
 
23983
 
 
23984
        /**
 
23985
         * Execute a callback for each of the child nodes of this node
 
23986
         * @param {function(child: Node, path: string, parent: Node)} callback
 
23987
         */
 
23988
        UpdateNode.prototype.forEach = function (callback) {
 
23989
          callback(this.index, 'index', this);
 
23990
          callback(this.expr, 'expr', this);
 
23991
        };
 
23992
 
 
23993
        /**
 
23994
         * Create a new UpdateNode having it's childs be the results of calling
 
23995
         * the provided callback function for each of the childs of the original node.
 
23996
         * @param {function(child: Node, path: string, parent: Node): Node} callback
 
23997
         * @returns {UpdateNode} Returns a transformed copy of the node
 
23998
         */
 
23999
        UpdateNode.prototype.map = function (callback) {
 
24000
          return new UpdateNode(
 
24001
              this._ifNode(callback(this.index, 'index', this)),
 
24002
              this._ifNode(callback(this.expr, 'expr', this))
 
24003
          );
 
24004
        };
 
24005
 
 
24006
        /**
 
24007
         * Create a clone of this node, a shallow copy
 
24008
         * @return {UpdateNode}
 
24009
         */
 
24010
        UpdateNode.prototype.clone = function() {
 
24011
          return new UpdateNode(this.index, this.expr);
 
24012
        };
 
24013
 
 
24014
        /**
 
24015
         * Get string representation
 
24016
         * @return {String}
 
24017
         */
 
24018
        UpdateNode.prototype.toString = function() {
 
24019
          return this.index.toString() + ' = ' + this.expr.toString();
 
24020
        };
 
24021
 
 
24022
        /**
 
24023
         * Get LaTeX representation
 
24024
         * @return {String}
 
24025
         */
 
24026
        UpdateNode.prototype.toTex = function() {
 
24027
          return this.index.toTex() + ' = ' + this.expr.toTex();
 
24028
        };
 
24029
 
 
24030
        module.exports = UpdateNode;
 
24031
 
 
24032
 
 
24033
/***/ },
 
24034
/* 185 */
 
24035
/***/ function(module, exports, __webpack_require__) {
 
24036
 
 
24037
        module.exports = {
 
24038
          'name': 'e',
 
24039
          'category': 'Constants',
 
24040
          'syntax': [
 
24041
            'e'
 
24042
          ],
 
24043
          'description': 'Euler\'s number, the base of the natural logarithm. Approximately equal to 2.71828',
 
24044
          'examples': [
 
24045
            'e',
 
24046
            'e ^ 2',
 
24047
            'exp(2)',
 
24048
            'log(e)'
 
24049
          ],
 
24050
          'seealso': ['exp']
 
24051
        };
 
24052
 
 
24053
 
 
24054
/***/ },
 
24055
/* 186 */
 
24056
/***/ function(module, exports, __webpack_require__) {
 
24057
 
 
24058
        module.exports = {
 
24059
          'name': 'false',
 
24060
          'category': 'Constants',
 
24061
          'syntax': [
 
24062
            'false'
 
24063
          ],
 
24064
          'description': 'Boolean value false',
 
24065
          'examples': [
 
24066
            'false'
 
24067
          ],
 
24068
          'seealso': ['true']
 
24069
        };
 
24070
 
 
24071
 
 
24072
/***/ },
 
24073
/* 187 */
 
24074
/***/ function(module, exports, __webpack_require__) {
 
24075
 
 
24076
        module.exports = {
 
24077
          'name': 'i',
 
24078
          'category': 'Constants',
 
24079
          'syntax': [
 
24080
            'i'
 
24081
          ],
 
24082
          'description': 'Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.',
 
24083
          'examples': [
 
24084
            'i',
 
24085
            'i * i',
 
24086
            'sqrt(-1)'
 
24087
          ],
 
24088
          'seealso': []
 
24089
        };
 
24090
 
 
24091
 
 
24092
/***/ },
 
24093
/* 188 */
 
24094
/***/ function(module, exports, __webpack_require__) {
 
24095
 
 
24096
        module.exports = {
 
24097
          'name': 'Infinity',
 
24098
          'category': 'Constants',
 
24099
          'syntax': [
 
24100
            'Infinity'
 
24101
          ],
 
24102
          'description': 'Infinity, a number which is larger than the maximum number that can be handled by a floating point number.',
 
24103
          'examples': [
 
24104
            'Infinity',
 
24105
            '1 / 0'
 
24106
          ],
 
24107
          'seealso': []
 
24108
        };
 
24109
 
 
24110
 
 
24111
/***/ },
 
24112
/* 189 */
 
24113
/***/ function(module, exports, __webpack_require__) {
 
24114
 
 
24115
        module.exports = {
 
24116
          'name': 'LN2',
 
24117
          'category': 'Constants',
 
24118
          'syntax': [
 
24119
            'LN2'
 
24120
          ],
 
24121
          'description': 'Returns the natural logarithm of 2, approximately equal to 0.693',
 
24122
          'examples': [
 
24123
            'LN2',
 
24124
            'log(2)'
 
24125
          ],
 
24126
          'seealso': []
 
24127
        };
 
24128
 
 
24129
 
 
24130
/***/ },
 
24131
/* 190 */
 
24132
/***/ function(module, exports, __webpack_require__) {
 
24133
 
 
24134
        module.exports = {
 
24135
          'name': 'LN10',
 
24136
          'category': 'Constants',
 
24137
          'syntax': [
 
24138
            'LN10'
 
24139
          ],
 
24140
          'description': 'Returns the natural logarithm of 10, approximately equal to 2.302',
 
24141
          'examples': [
 
24142
            'LN10',
 
24143
            'log(10)'
 
24144
          ],
 
24145
          'seealso': []
 
24146
        };
 
24147
 
 
24148
 
 
24149
/***/ },
 
24150
/* 191 */
 
24151
/***/ function(module, exports, __webpack_require__) {
 
24152
 
 
24153
        module.exports = {
 
24154
          'name': 'LOG2E',
 
24155
          'category': 'Constants',
 
24156
          'syntax': [
 
24157
            'LOG2E'
 
24158
          ],
 
24159
          'description': 'Returns the base-2 logarithm of E, approximately equal to 1.442',
 
24160
          'examples': [
 
24161
            'LOG2E',
 
24162
            'log(e, 2)'
 
24163
          ],
 
24164
          'seealso': []
 
24165
        };
 
24166
 
 
24167
 
 
24168
/***/ },
 
24169
/* 192 */
 
24170
/***/ function(module, exports, __webpack_require__) {
 
24171
 
 
24172
        module.exports = {
 
24173
          'name': 'LOG10E',
 
24174
          'category': 'Constants',
 
24175
          'syntax': [
 
24176
            'LOG10E'
 
24177
          ],
 
24178
          'description': 'Returns the base-10 logarithm of E, approximately equal to 0.434',
 
24179
          'examples': [
 
24180
            'LOG10E',
 
24181
            'log(e, 10)'
 
24182
          ],
 
24183
          'seealso': []
 
24184
        };
 
24185
 
 
24186
 
 
24187
/***/ },
 
24188
/* 193 */
 
24189
/***/ function(module, exports, __webpack_require__) {
 
24190
 
 
24191
        module.exports = {
 
24192
          'name': 'NaN',
 
24193
          'category': 'Constants',
 
24194
          'syntax': [
 
24195
            'NaN'
 
24196
          ],
 
24197
          'description': 'Not a number',
 
24198
          'examples': [
 
24199
            'NaN',
 
24200
            '0 / 0'
 
24201
          ],
 
24202
          'seealso': []
 
24203
        };
 
24204
 
 
24205
 
 
24206
/***/ },
 
24207
/* 194 */
 
24208
/***/ function(module, exports, __webpack_require__) {
 
24209
 
 
24210
        module.exports = {
 
24211
          'name': 'null',
 
24212
          'category': 'Constants',
 
24213
          'syntax': [
 
24214
            'null'
 
24215
          ],
 
24216
          'description': 'Value null',
 
24217
          'examples': [
 
24218
            'null'
 
24219
          ],
 
24220
          'seealso': ['true', 'false']
 
24221
        };
 
24222
 
 
24223
 
 
24224
/***/ },
 
24225
/* 195 */
 
24226
/***/ function(module, exports, __webpack_require__) {
 
24227
 
 
24228
        module.exports = {
 
24229
          'name': 'pi',
 
24230
          'category': 'Constants',
 
24231
          'syntax': [
 
24232
            'pi'
 
24233
          ],
 
24234
          'description': 'The number pi is a mathematical constant that is the ratio of a circle\'s circumference to its diameter, and is approximately equal to 3.14159',
 
24235
          'examples': [
 
24236
            'pi',
 
24237
            'sin(pi/2)'
 
24238
          ],
 
24239
          'seealso': ['tau']
 
24240
        };
 
24241
 
 
24242
 
 
24243
/***/ },
 
24244
/* 196 */
 
24245
/***/ function(module, exports, __webpack_require__) {
 
24246
 
 
24247
        module.exports = {
 
24248
          'name': 'phi',
 
24249
          'category': 'Constants',
 
24250
          'syntax': [
 
24251
            'phi'
 
24252
          ],
 
24253
          'description': 'Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...',
 
24254
          'examples': [
 
24255
            'tau'
 
24256
          ],
 
24257
          'seealso': []
 
24258
        };
 
24259
 
 
24260
 
 
24261
/***/ },
 
24262
/* 197 */
 
24263
/***/ function(module, exports, __webpack_require__) {
 
24264
 
 
24265
        module.exports = {
 
24266
          'name': 'SQRT1_2',
 
24267
          'category': 'Constants',
 
24268
          'syntax': [
 
24269
            'SQRT1_2'
 
24270
          ],
 
24271
          'description': 'Returns the square root of 1/2, approximately equal to 0.707',
 
24272
          'examples': [
 
24273
            'SQRT1_2',
 
24274
            'sqrt(1/2)'
 
24275
          ],
 
24276
          'seealso': []
 
24277
        };
 
24278
 
 
24279
 
 
24280
/***/ },
 
24281
/* 198 */
 
24282
/***/ function(module, exports, __webpack_require__) {
 
24283
 
 
24284
        module.exports = {
 
24285
          'name': 'SQRT2',
 
24286
          'category': 'Constants',
 
24287
          'syntax': [
 
24288
            'SQRT2'
 
24289
          ],
 
24290
          'description': 'Returns the square root of 2, approximately equal to 1.414',
 
24291
          'examples': [
 
24292
            'SQRT2',
 
24293
            'sqrt(2)'
 
24294
          ],
 
24295
          'seealso': []
 
24296
        };
 
24297
 
 
24298
 
 
24299
/***/ },
 
24300
/* 199 */
 
24301
/***/ function(module, exports, __webpack_require__) {
 
24302
 
 
24303
        module.exports = {
 
24304
          'name': 'tau',
 
24305
          'category': 'Constants',
 
24306
          'syntax': [
 
24307
            'tau'
 
24308
          ],
 
24309
          'description': 'Tau is the ratio constant of a circle\'s circumference to radius, equal to 2 * pi, approximately 6.2832.',
 
24310
          'examples': [
 
24311
            'tau',
 
24312
            '2 * pi'
 
24313
          ],
 
24314
          'seealso': ['pi']
 
24315
        };
 
24316
 
 
24317
 
 
24318
/***/ },
 
24319
/* 200 */
 
24320
/***/ function(module, exports, __webpack_require__) {
 
24321
 
 
24322
        module.exports = {
 
24323
          'name': 'true',
 
24324
          'category': 'Constants',
 
24325
          'syntax': [
 
24326
            'true'
 
24327
          ],
 
24328
          'description': 'Boolean value true',
 
24329
          'examples': [
 
24330
            'true'
 
24331
          ],
 
24332
          'seealso': ['false']
 
24333
        };
 
24334
 
 
24335
 
 
24336
/***/ },
 
24337
/* 201 */
 
24338
/***/ function(module, exports, __webpack_require__) {
 
24339
 
 
24340
        module.exports = {
 
24341
          'name': 'version',
 
24342
          'category': 'Constants',
 
24343
          'syntax': [
 
24344
            'version'
 
24345
          ],
 
24346
          'description': 'A string with the version number of math.js',
 
24347
          'examples': [
 
24348
            'version'
 
24349
          ],
 
24350
          'seealso': []
 
24351
        };
 
24352
 
 
24353
 
 
24354
/***/ },
 
24355
/* 202 */
 
24356
/***/ function(module, exports, __webpack_require__) {
 
24357
 
 
24358
        var map = {
 
24359
                "./clone": 155,
 
24360
                "./clone.js": 155,
 
24361
                "./filter": 156,
 
24362
                "./filter.js": 156,
 
24363
                "./forEach": 163,
 
24364
                "./forEach.js": 163,
 
24365
                "./format": 157,
 
24366
                "./format.js": 157,
 
24367
                "./import": 158,
 
24368
                "./import.js": 158,
 
24369
                "./map": 159,
 
24370
                "./map.js": 159,
 
24371
                "./print": 160,
 
24372
                "./print.js": 160,
 
24373
                "./sort": 161,
 
24374
                "./sort.js": 161,
 
24375
                "./typeof": 162,
 
24376
                "./typeof.js": 162
 
24377
        };
 
24378
        function webpackContext(req) {
 
24379
                return __webpack_require__(webpackContextResolve(req));
 
24380
        };
 
24381
        function webpackContextResolve(req) {
 
24382
                return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
 
24383
        };
 
24384
        webpackContext.keys = function webpackContextKeys() {
 
24385
                return Object.keys(map);
 
24386
        };
 
24387
        webpackContext.resolve = webpackContextResolve;
 
24388
        module.exports = webpackContext;
 
24389
        webpackContext.id = 202;
 
24390
 
 
24391
 
 
24392
/***/ },
 
24393
/* 203 */
 
24394
/***/ function(module, exports, __webpack_require__) {
 
24395
 
 
24396
        var DimensionError = __webpack_require__(168);
 
24397
        var IndexError = __webpack_require__(169);
 
24398
 
 
24399
        /**
 
24400
         * Transform zero-based indices to one-based indices in errors
 
24401
         * @param {Error} err
 
24402
         * @returns {Error} Returns the transformed error
 
24403
         */
 
24404
        exports.transform = function (err) {
 
24405
          if (err instanceof IndexError) {
 
24406
            return new IndexError(err.index + 1, err.min + 1, err.max + 1);
 
24407
          }
 
24408
 
 
24409
          return err;
 
24410
        };
 
24411
 
 
24412
 
 
24413
/***/ },
 
24414
/* 204 */
 
24415
/***/ function(module, exports, __webpack_require__) {
 
24416
 
 
24417
        'use strict';
 
24418
 
 
24419
        /**
 
24420
         * Test whether value is a Boolean
 
24421
         * @param {*} value
 
24422
         * @return {Boolean} isBoolean
 
24423
         */
 
24424
        exports.isBoolean = function(value) {
 
24425
          return (value instanceof Boolean) || (typeof value == 'boolean');
 
24426
        };
 
24427
 
 
24428
 
 
24429
/***/ },
 
24430
/* 205 */
 
24431
/***/ function(module, exports, __webpack_require__) {
 
24432
 
 
24433
        'use strict';
 
24434
 
 
24435
        var number = __webpack_require__(3);
 
24436
        var bignumber = __webpack_require__(164);
 
24437
        var BigNumber = __webpack_require__(5);
 
24438
 
 
24439
        /**
 
24440
         * Test whether value is a String
 
24441
         * @param {*} value
 
24442
         * @return {Boolean} isString
 
24443
         */
 
24444
        exports.isString = function(value) {
 
24445
          return (value instanceof String) || (typeof value == 'string');
 
24446
        };
 
24447
 
 
24448
        /**
 
24449
         * Check if a text ends with a certain string.
 
24450
         * @param {String} text
 
24451
         * @param {String} search
 
24452
         */
 
24453
        exports.endsWith = function(text, search) {
 
24454
          var start = text.length - search.length;
 
24455
          var end = text.length;
 
24456
          return (text.substring(start, end) === search);
 
24457
        };
 
24458
 
 
24459
        /**
 
24460
         * Format a value of any type into a string.
 
24461
         *
 
24462
         * Usage:
 
24463
         *     math.format(value)
 
24464
         *     math.format(value, precision)
 
24465
         *
 
24466
         * If value is a function, the returned string is 'function' unless the function
 
24467
         * has a property `description`, in that case this properties value is returned.
 
24468
         *
 
24469
         * Example usage:
 
24470
         *     math.format(2/7);                // '0.2857142857142857'
 
24471
         *     math.format(math.pi, 3);         // '3.14'
 
24472
         *     math.format(new Complex(2, 3));  // '2 + 3i'
 
24473
         *     math.format('hello');            // '"hello"'
 
24474
         *
 
24475
         * @param {*} value             Value to be stringified
 
24476
         * @param {Object | Number | Function} [options]  Formatting options. See
 
24477
         *                                                lib/util/number:format for a
 
24478
         *                                                description of the available
 
24479
         *                                                options.
 
24480
         * @return {String} str
 
24481
         */
 
24482
        exports.format = function(value, options) {
 
24483
          if (number.isNumber(value)) {
 
24484
            return number.format(value, options);
 
24485
          }
 
24486
 
 
24487
          if (value instanceof BigNumber) {
 
24488
            return bignumber.format(value, options);
 
24489
          }
 
24490
 
 
24491
          if (Array.isArray(value)) {
 
24492
            return formatArray(value, options);
 
24493
          }
 
24494
 
 
24495
          if (exports.isString(value)) {
 
24496
            return '"' + value + '"';
 
24497
          }
 
24498
 
 
24499
          if (typeof value === 'function') {
 
24500
            return value.syntax ? value.syntax + '' : 'function';
 
24501
          }
 
24502
 
 
24503
          if (value instanceof Object) {
 
24504
            if (typeof value.format === 'function') {
 
24505
              return value.format(options);
 
24506
            }
 
24507
            else {
 
24508
              return value.toString();
 
24509
            }
 
24510
          }
 
24511
 
 
24512
          return String(value);
 
24513
        };
 
24514
 
 
24515
        /**
 
24516
         * Recursively format an n-dimensional matrix
 
24517
         * Example output: "[[1, 2], [3, 4]]"
 
24518
         * @param {Array} array
 
24519
         * @param {Object | Number | Function} [options]  Formatting options. See
 
24520
         *                                                lib/util/number:format for a
 
24521
         *                                                description of the available
 
24522
         *                                                options.
 
24523
         * @returns {String} str
 
24524
         */
 
24525
        function formatArray (array, options) {
 
24526
          if (Array.isArray(array)) {
 
24527
            var str = '[';
 
24528
            var len = array.length;
 
24529
            for (var i = 0; i < len; i++) {
 
24530
              if (i != 0) {
 
24531
                str += ', ';
 
24532
              }
 
24533
              str += formatArray(array[i], options);
 
24534
            }
 
24535
            str += ']';
 
24536
            return str;
 
24537
          }
 
24538
          else {
 
24539
            return exports.format(array, options);
 
24540
          }
 
24541
        }
 
24542
 
 
24543
 
 
24544
/***/ },
 
24545
/* 206 */
 
24546
/***/ function(module, exports, __webpack_require__) {
 
24547
 
 
24548
        module.exports = {
 
24549
          'name': 'abs',
 
24550
          'category': 'Arithmetic',
 
24551
          'syntax': [
 
24552
            'abs(x)'
 
24553
          ],
 
24554
          'description': 'Compute the absolute value.',
 
24555
          'examples': [
 
24556
            'abs(3.5)',
 
24557
            'abs(-4.2)'
 
24558
          ],
 
24559
          'seealso': ['sign']
 
24560
        };
 
24561
 
 
24562
 
 
24563
/***/ },
 
24564
/* 207 */
 
24565
/***/ function(module, exports, __webpack_require__) {
 
24566
 
 
24567
        module.exports = {
 
24568
          'name': 'add',
 
24569
          'category': 'Operators',
 
24570
          'syntax': [
 
24571
            'x + y',
 
24572
            'add(x, y)'
 
24573
          ],
 
24574
          'description': 'Add two values.',
 
24575
          'examples': [
 
24576
            'a = 2.1 + 3.6',
 
24577
            'a - 3.6',
 
24578
            '3 + 2i',
 
24579
            '"hello" + " world"',
 
24580
            '3 cm + 2 inch'
 
24581
          ],
 
24582
          'seealso': [
 
24583
            'subtract'
 
24584
          ]
 
24585
        };
 
24586
 
 
24587
 
 
24588
/***/ },
 
24589
/* 208 */
 
24590
/***/ function(module, exports, __webpack_require__) {
 
24591
 
 
24592
        module.exports = {
 
24593
          'name': 'ceil',
 
24594
          'category': 'Arithmetic',
 
24595
          'syntax': [
 
24596
            'ceil(x)'
 
24597
          ],
 
24598
          'description':
 
24599
              'Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.',
 
24600
          'examples': [
 
24601
            'ceil(3.2)',
 
24602
            'ceil(3.8)',
 
24603
            'ceil(-4.2)'
 
24604
          ],
 
24605
          'seealso': ['floor', 'fix', 'round']
 
24606
        };
 
24607
 
 
24608
 
 
24609
/***/ },
 
24610
/* 209 */
 
24611
/***/ function(module, exports, __webpack_require__) {
 
24612
 
 
24613
        module.exports = {
 
24614
          'name': 'cube',
 
24615
          'category': 'Arithmetic',
 
24616
          'syntax': [
 
24617
            'cube(x)'
 
24618
          ],
 
24619
          'description': 'Compute the cube of a value. The cube of x is x * x * x.',
 
24620
          'examples': [
 
24621
            'cube(2)',
 
24622
            '2^3',
 
24623
            '2 * 2 * 2'
 
24624
          ],
 
24625
          'seealso': [
 
24626
            'multiply',
 
24627
            'square',
 
24628
            'pow'
 
24629
          ]
 
24630
        };
 
24631
 
 
24632
 
 
24633
/***/ },
 
24634
/* 210 */
 
24635
/***/ function(module, exports, __webpack_require__) {
 
24636
 
 
24637
        module.exports = {
 
24638
          'name': 'divide',
 
24639
          'category': 'Operators',
 
24640
          'syntax': [
 
24641
            'x / y',
 
24642
            'divide(x, y)'
 
24643
          ],
 
24644
          'description': 'Divide two values.',
 
24645
          'examples': [
 
24646
            'a = 2 / 3',
 
24647
            'a * 3',
 
24648
            '4.5 / 2',
 
24649
            '3 + 4 / 2',
 
24650
            '(3 + 4) / 2',
 
24651
            '18 km / 4.5'
 
24652
          ],
 
24653
          'seealso': [
 
24654
            'multiply'
 
24655
          ]
 
24656
        };
 
24657
 
 
24658
 
 
24659
/***/ },
 
24660
/* 211 */
 
24661
/***/ function(module, exports, __webpack_require__) {
 
24662
 
 
24663
        module.exports = {
 
24664
          'name': 'dotDivide',
 
24665
          'category': 'Operators',
 
24666
          'syntax': [
 
24667
            'x ./ y',
 
24668
            'dotDivide(x, y)'
 
24669
          ],
 
24670
          'description': 'Divide two values element wise.',
 
24671
          'examples': [
 
24672
            'a = [1, 2, 3; 4, 5, 6]',
 
24673
            'b = [2, 1, 1; 3, 2, 5]',
 
24674
            'a ./ b'
 
24675
          ],
 
24676
          'seealso': [
 
24677
            'multiply',
 
24678
            'dotMultiply',
 
24679
            'divide'
 
24680
          ]
 
24681
        };
 
24682
 
 
24683
 
 
24684
/***/ },
 
24685
/* 212 */
 
24686
/***/ function(module, exports, __webpack_require__) {
 
24687
 
 
24688
        module.exports = {
 
24689
          'name': 'dotMultiply',
 
24690
          'category': 'Operators',
 
24691
          'syntax': [
 
24692
            'x .* y',
 
24693
            'dotMultiply(x, y)'
 
24694
          ],
 
24695
          'description': 'Multiply two values element wise.',
 
24696
          'examples': [
 
24697
            'a = [1, 2, 3; 4, 5, 6]',
 
24698
            'b = [2, 1, 1; 3, 2, 5]',
 
24699
            'a .* b'
 
24700
          ],
 
24701
          'seealso': [
 
24702
            'multiply',
 
24703
            'divide',
 
24704
            'dotDivide'
 
24705
          ]
 
24706
        };
 
24707
 
 
24708
 
 
24709
/***/ },
 
24710
/* 213 */
 
24711
/***/ function(module, exports, __webpack_require__) {
 
24712
 
 
24713
        module.exports = {
 
24714
          'name': 'dotpow',
 
24715
          'category': 'Operators',
 
24716
          'syntax': [
 
24717
            'x .^ y',
 
24718
            'dotpow(x, y)'
 
24719
          ],
 
24720
          'description':
 
24721
              'Calculates the power of x to y element wise.',
 
24722
          'examples': [
 
24723
            'a = [1, 2, 3; 4, 5, 6]',
 
24724
            'a .^ 2'
 
24725
          ],
 
24726
          'seealso': [
 
24727
            'pow'
 
24728
          ]
 
24729
        };
 
24730
 
 
24731
 
 
24732
/***/ },
 
24733
/* 214 */
 
24734
/***/ function(module, exports, __webpack_require__) {
 
24735
 
 
24736
        module.exports = {
 
24737
          'name': 'exp',
 
24738
          'category': 'Arithmetic',
 
24739
          'syntax': [
 
24740
            'exp(x)'
 
24741
          ],
 
24742
          'description': 'Calculate the exponent of a value.',
 
24743
          'examples': [
 
24744
            'exp(1.3)',
 
24745
            'e ^ 1.3',
 
24746
            'log(exp(1.3))',
 
24747
            'x = 2.4',
 
24748
            '(exp(i*x) == cos(x) + i*sin(x))   # Euler\'s formula'
 
24749
          ],
 
24750
          'seealso': [
 
24751
            'pow',
 
24752
            'log'
 
24753
          ]
 
24754
        };
 
24755
 
 
24756
 
 
24757
/***/ },
 
24758
/* 215 */
 
24759
/***/ function(module, exports, __webpack_require__) {
 
24760
 
 
24761
        module.exports = {
 
24762
          'name': 'fix',
 
24763
          'category': 'Arithmetic',
 
24764
          'syntax': [
 
24765
            'fix(x)'
 
24766
          ],
 
24767
          'description':
 
24768
              'Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.',
 
24769
          'examples': [
 
24770
            'fix(3.2)',
 
24771
            'fix(3.8)',
 
24772
            'fix(-4.2)',
 
24773
            'fix(-4.8)'
 
24774
          ],
 
24775
          'seealso': ['ceil', 'floor', 'round']
 
24776
        };
 
24777
 
 
24778
 
 
24779
/***/ },
 
24780
/* 216 */
 
24781
/***/ function(module, exports, __webpack_require__) {
 
24782
 
 
24783
        module.exports = {
 
24784
          'name': 'floor',
 
24785
          'category': 'Arithmetic',
 
24786
          'syntax': [
 
24787
            'floor(x)'
 
24788
          ],
 
24789
          'description':
 
24790
              'Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.',
 
24791
          'examples': [
 
24792
            'floor(3.2)',
 
24793
            'floor(3.8)',
 
24794
            'floor(-4.2)'
 
24795
          ],
 
24796
          'seealso': ['ceil', 'fix', 'round']
 
24797
        };
 
24798
 
 
24799
 
 
24800
/***/ },
 
24801
/* 217 */
 
24802
/***/ function(module, exports, __webpack_require__) {
 
24803
 
 
24804
        module.exports = {
 
24805
          'name': 'gcd',
 
24806
          'category': 'Arithmetic',
 
24807
          'syntax': [
 
24808
            'gcd(a, b)',
 
24809
            'gcd(a, b, c, ...)'
 
24810
          ],
 
24811
          'description': 'Compute the greatest common divisor.',
 
24812
          'examples': [
 
24813
            'gcd(8, 12)',
 
24814
            'gcd(-4, 6)',
 
24815
            'gcd(25, 15, -10)'
 
24816
          ],
 
24817
          'seealso': [ 'lcm', 'xgcd' ]
 
24818
        };
 
24819
 
 
24820
 
 
24821
/***/ },
 
24822
/* 218 */
 
24823
/***/ function(module, exports, __webpack_require__) {
 
24824
 
 
24825
        module.exports = {
 
24826
          'name': 'lcm',
 
24827
          'category': 'Arithmetic',
 
24828
          'syntax': [
 
24829
            'lcm(x, y)'
 
24830
          ],
 
24831
          'description': 'Compute the least common multiple.',
 
24832
          'examples': [
 
24833
            'lcm(4, 6)',
 
24834
            'lcm(6, 21)',
 
24835
            'lcm(6, 21, 5)'
 
24836
          ],
 
24837
          'seealso': [ 'gcd' ]
 
24838
        };
 
24839
 
 
24840
 
 
24841
/***/ },
 
24842
/* 219 */
 
24843
/***/ function(module, exports, __webpack_require__) {
 
24844
 
 
24845
        module.exports = {
 
24846
          'name': 'log',
 
24847
          'category': 'Arithmetic',
 
24848
          'syntax': [
 
24849
            'log(x)',
 
24850
            'log(x, base)'
 
24851
          ],
 
24852
          'description': 'Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).',
 
24853
          'examples': [
 
24854
            'log(3.5)',
 
24855
            'a = log(2.4)',
 
24856
            'exp(a)',
 
24857
            '10 ^ 4',
 
24858
            'log(10000, 10)',
 
24859
            'log(10000) / log(10)',
 
24860
            'b = log(1024, 2)',
 
24861
            '2 ^ b'
 
24862
          ],
 
24863
          'seealso': [
 
24864
            'exp',
 
24865
            'log10'
 
24866
          ]
 
24867
        };
 
24868
 
 
24869
/***/ },
 
24870
/* 220 */
 
24871
/***/ function(module, exports, __webpack_require__) {
 
24872
 
 
24873
        module.exports = {
 
24874
          'name': 'log10',
 
24875
          'category': 'Arithmetic',
 
24876
          'syntax': [
 
24877
            'log10(x)'
 
24878
          ],
 
24879
          'description': 'Compute the 10-base logarithm of a value.',
 
24880
          'examples': [
 
24881
            'log10(0.00001)',
 
24882
            'log10(10000)',
 
24883
            '10 ^ 4',
 
24884
            'log(10000) / log(10)',
 
24885
            'log(10000, 10)'
 
24886
          ],
 
24887
          'seealso': [
 
24888
            'exp',
 
24889
            'log'
 
24890
          ]
 
24891
        };
 
24892
 
 
24893
 
 
24894
/***/ },
 
24895
/* 221 */
 
24896
/***/ function(module, exports, __webpack_require__) {
 
24897
 
 
24898
        module.exports = {
 
24899
          'name': 'mod',
 
24900
          'category': 'Operators',
 
24901
          'syntax': [
 
24902
            'x % y',
 
24903
            'x mod y',
 
24904
            'mod(x, y)'
 
24905
          ],
 
24906
          'description':
 
24907
              'Calculates the modulus, the remainder of an integer division.',
 
24908
          'examples': [
 
24909
            '7 % 3',
 
24910
            '11 % 2',
 
24911
            '10 mod 4',
 
24912
            'function isOdd(x) = x % 2',
 
24913
            'isOdd(2)',
 
24914
            'isOdd(3)'
 
24915
          ],
 
24916
          'seealso': ['divide']
 
24917
        };
 
24918
 
 
24919
 
 
24920
/***/ },
 
24921
/* 222 */
 
24922
/***/ function(module, exports, __webpack_require__) {
 
24923
 
 
24924
        module.exports = {
 
24925
          'name': 'multiply',
 
24926
          'category': 'Operators',
 
24927
          'syntax': [
 
24928
            'x * y',
 
24929
            'multiply(x, y)'
 
24930
          ],
 
24931
          'description': 'multiply two values.',
 
24932
          'examples': [
 
24933
            'a = 2.1 * 3.4',
 
24934
            'a / 3.4',
 
24935
            '2 * 3 + 4',
 
24936
            '2 * (3 + 4)',
 
24937
            '3 * 2.1 km'
 
24938
          ],
 
24939
          'seealso': [
 
24940
            'divide'
 
24941
          ]
 
24942
        };
 
24943
 
 
24944
 
 
24945
/***/ },
 
24946
/* 223 */
 
24947
/***/ function(module, exports, __webpack_require__) {
 
24948
 
 
24949
        module.exports = {
 
24950
          'name': 'norm',
 
24951
          'category': 'Arithmetic',
 
24952
          'syntax': [
 
24953
            'norm(x)',
 
24954
            'norm(x, p)'
 
24955
          ],
 
24956
          'description': 'Calculate the norm of a number, vector or matrix.',
 
24957
          'examples': [
 
24958
            'abs(-3.5)',
 
24959
            'norm(-3.5)',
 
24960
            'norm(3 - 4i))',
 
24961
            'norm([1, 2, -3], Infinity)',
 
24962
            'norm([1, 2, -3], -Infinity)',
 
24963
            'norm([3, 4], 2)',
 
24964
            'norm([[1, 2], [3, 4]], 1)',
 
24965
            'norm([[1, 2], [3, 4]], \'inf\')',
 
24966
            'norm([[1, 2], [3, 4]], \'fro\')'
 
24967
          ]
 
24968
        };
 
24969
 
 
24970
 
 
24971
/***/ },
 
24972
/* 224 */
 
24973
/***/ function(module, exports, __webpack_require__) {
 
24974
 
 
24975
        module.exports = {
 
24976
          'name': 'nthRoot',
 
24977
          'category': 'Arithmetic',
 
24978
          'syntax': [
 
24979
            'nthRoot(a)',
 
24980
            'nthRoot(a, root)'
 
24981
          ],
 
24982
          'description': 'Calculate the nth root of a value. ' +
 
24983
              'The principal nth root of a positive real number A, ' +
 
24984
              'is the positive real solution of the equation "x^root = A".',
 
24985
          'examples': [
 
24986
            '4 ^ 3',
 
24987
            'nthRoot(64, 3)',
 
24988
            'nthRoot(9, 2)',
 
24989
            'sqrt(9)'
 
24990
          ],
 
24991
          'seealso': [
 
24992
            'sqrt',
 
24993
            'pow'
 
24994
          ]
 
24995
        };
 
24996
 
 
24997
/***/ },
 
24998
/* 225 */
 
24999
/***/ function(module, exports, __webpack_require__) {
 
25000
 
 
25001
        module.exports = {
 
25002
          'name': 'pow',
 
25003
          'category': 'Operators',
 
25004
          'syntax': [
 
25005
            'x ^ y',
 
25006
            'pow(x, y)'
 
25007
          ],
 
25008
          'description':
 
25009
              'Calculates the power of x to y, x^y.',
 
25010
          'examples': [
 
25011
            '2^3 = 8',
 
25012
            '2*2*2',
 
25013
            '1 + e ^ (pi * i)'
 
25014
          ],
 
25015
          'seealso': [ 'multiply' ]
 
25016
        };
 
25017
 
 
25018
 
 
25019
/***/ },
 
25020
/* 226 */
 
25021
/***/ function(module, exports, __webpack_require__) {
 
25022
 
 
25023
        module.exports = {
 
25024
          'name': 'round',
 
25025
          'category': 'Arithmetic',
 
25026
          'syntax': [
 
25027
            'round(x)',
 
25028
            'round(x, n)'
 
25029
          ],
 
25030
          'description':
 
25031
              'round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.',
 
25032
          'examples': [
 
25033
            'round(3.2)',
 
25034
            'round(3.8)',
 
25035
            'round(-4.2)',
 
25036
            'round(-4.8)',
 
25037
            'round(pi, 3)',
 
25038
            'round(123.45678, 2)'
 
25039
          ],
 
25040
          'seealso': ['ceil', 'floor', 'fix']
 
25041
        };
 
25042
 
 
25043
 
 
25044
/***/ },
 
25045
/* 227 */
 
25046
/***/ function(module, exports, __webpack_require__) {
 
25047
 
 
25048
        module.exports = {
 
25049
          'name': 'sign',
 
25050
          'category': 'Arithmetic',
 
25051
          'syntax': [
 
25052
            'sign(x)'
 
25053
          ],
 
25054
          'description':
 
25055
              'Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.',
 
25056
          'examples': [
 
25057
            'sign(3.5)',
 
25058
            'sign(-4.2)',
 
25059
            'sign(0)'
 
25060
          ],
 
25061
          'seealso': [
 
25062
            'abs'
 
25063
          ]
 
25064
        };
 
25065
 
 
25066
 
 
25067
/***/ },
 
25068
/* 228 */
 
25069
/***/ function(module, exports, __webpack_require__) {
 
25070
 
 
25071
        module.exports = {
 
25072
          'name': 'sqrt',
 
25073
          'category': 'Arithmetic',
 
25074
          'syntax': [
 
25075
            'sqrt(x)'
 
25076
          ],
 
25077
          'description':
 
25078
              'Compute the square root value. If x = y * y, then y is the square root of x.',
 
25079
          'examples': [
 
25080
            'sqrt(25)',
 
25081
            '5 * 5',
 
25082
            'sqrt(-1)'
 
25083
          ],
 
25084
          'seealso': [
 
25085
            'square',
 
25086
            'multiply'
 
25087
          ]
 
25088
        };
 
25089
 
 
25090
 
 
25091
/***/ },
 
25092
/* 229 */
 
25093
/***/ function(module, exports, __webpack_require__) {
 
25094
 
 
25095
        module.exports = {
 
25096
          'name': 'square',
 
25097
          'category': 'Arithmetic',
 
25098
          'syntax': [
 
25099
            'square(x)'
 
25100
          ],
 
25101
          'description':
 
25102
              'Compute the square of a value. The square of x is x * x.',
 
25103
          'examples': [
 
25104
            'square(3)',
 
25105
            'sqrt(9)',
 
25106
            '3^2',
 
25107
            '3 * 3'
 
25108
          ],
 
25109
          'seealso': [
 
25110
            'multiply',
 
25111
            'pow',
 
25112
            'sqrt',
 
25113
            'cube'
 
25114
          ]
 
25115
        };
 
25116
 
 
25117
 
 
25118
/***/ },
 
25119
/* 230 */
 
25120
/***/ function(module, exports, __webpack_require__) {
 
25121
 
 
25122
        module.exports = {
 
25123
          'name': 'subtract',
 
25124
          'category': 'Operators',
 
25125
          'syntax': [
 
25126
            'x - y',
 
25127
            'subtract(x, y)'
 
25128
          ],
 
25129
          'description': 'subtract two values.',
 
25130
          'examples': [
 
25131
            'a = 5.3 - 2',
 
25132
            'a + 2',
 
25133
            '2/3 - 1/6',
 
25134
            '2 * 3 - 3',
 
25135
            '2.1 km - 500m'
 
25136
          ],
 
25137
          'seealso': [
 
25138
            'add'
 
25139
          ]
 
25140
        };
 
25141
 
 
25142
 
 
25143
/***/ },
 
25144
/* 231 */
 
25145
/***/ function(module, exports, __webpack_require__) {
 
25146
 
 
25147
        module.exports = {
 
25148
          'name': 'unaryMinus',
 
25149
          'category': 'Operators',
 
25150
          'syntax': [
 
25151
            '-x',
 
25152
            'unaryMinus(x)'
 
25153
          ],
 
25154
          'description':
 
25155
              'Inverse the sign of a value. Converts booleans and strings to numbers.',
 
25156
          'examples': [
 
25157
            '-4.5',
 
25158
            '-(-5.6)',
 
25159
            '-"22"'
 
25160
          ],
 
25161
          'seealso': [
 
25162
            'add', 'subtract', 'unaryPlus'
 
25163
          ]
 
25164
        };
 
25165
 
 
25166
 
 
25167
/***/ },
 
25168
/* 232 */
 
25169
/***/ function(module, exports, __webpack_require__) {
 
25170
 
 
25171
        module.exports = {
 
25172
          'name': 'unaryPlus',
 
25173
          'category': 'Operators',
 
25174
          'syntax': [
 
25175
            '+x',
 
25176
            'unaryPlus(x)'
 
25177
          ],
 
25178
          'description':
 
25179
              'Converts booleans and strings to numbers.',
 
25180
          'examples': [
 
25181
            '+true',
 
25182
            '+"2"'
 
25183
          ],
 
25184
          'seealso': [
 
25185
            'add', 'subtract', 'unaryMinus'
 
25186
          ]
 
25187
        };
 
25188
 
 
25189
 
 
25190
/***/ },
 
25191
/* 233 */
 
25192
/***/ function(module, exports, __webpack_require__) {
 
25193
 
 
25194
        module.exports = {
 
25195
          'name': 'xgcd',
 
25196
          'category': 'Arithmetic',
 
25197
          'syntax': [
 
25198
            'xgcd(a, b)'
 
25199
          ],
 
25200
          'description': 'Calculate the extended greatest common divisor for two values',
 
25201
          'examples': [
 
25202
            'xgcd(8, 12)',
 
25203
            'gcd(8, 12)',
 
25204
            'xgcd(36163, 21199)'
 
25205
          ],
 
25206
          'seealso': [ 'gcd', 'lcm' ]
 
25207
        };
 
25208
 
 
25209
 
 
25210
/***/ },
 
25211
/* 234 */
 
25212
/***/ function(module, exports, __webpack_require__) {
 
25213
 
 
25214
        module.exports = {
 
25215
          'name': 'bitAnd',
 
25216
          'category': 'Bitwise',
 
25217
          'syntax': [
 
25218
            'x & y',
 
25219
            'bitAnd(x, y)'
 
25220
          ],
 
25221
          'description': 'Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0',
 
25222
          'examples': [
 
25223
            '5 & 3',
 
25224
            'bitAnd(53, 131)',
 
25225
            '[1, 12, 31] & 42'
 
25226
          ],
 
25227
          'seealso': [
 
25228
            'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'
 
25229
          ]
 
25230
        };
 
25231
 
 
25232
 
 
25233
/***/ },
 
25234
/* 235 */
 
25235
/***/ function(module, exports, __webpack_require__) {
 
25236
 
 
25237
        module.exports = {
 
25238
          'name': 'bitNot',
 
25239
          'category': 'Bitwise',
 
25240
          'syntax': [
 
25241
            '~x',
 
25242
            'bitNot(x)'
 
25243
          ],
 
25244
          'description': 'Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.',
 
25245
          'examples': [
 
25246
            '~1',
 
25247
            '~2',
 
25248
            'bitNot([2, -3, 4])'
 
25249
          ],
 
25250
          'seealso': [
 
25251
            'bitAnd', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'
 
25252
          ]
 
25253
        };
 
25254
 
 
25255
 
 
25256
/***/ },
 
25257
/* 236 */
 
25258
/***/ function(module, exports, __webpack_require__) {
 
25259
 
 
25260
        module.exports = {
 
25261
          'name': 'bitOr',
 
25262
          'category': 'Bitwise',
 
25263
          'syntax': [
 
25264
            'x | y',
 
25265
            'bitOr(x, y)'
 
25266
          ],
 
25267
          'description': 'Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.',
 
25268
          'examples': [
 
25269
            '5 | 3',
 
25270
            'bitOr([1, 2, 3], 4)'
 
25271
          ],
 
25272
          'seealso': [
 
25273
            'bitAnd', 'bitNot', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'
 
25274
          ]
 
25275
        };
 
25276
 
 
25277
 
 
25278
/***/ },
 
25279
/* 237 */
 
25280
/***/ function(module, exports, __webpack_require__) {
 
25281
 
 
25282
        module.exports = {
 
25283
          'name': 'bitXor',
 
25284
          'category': 'Bitwise',
 
25285
          'syntax': [
 
25286
            'bitXor(x, y)'
 
25287
          ],
 
25288
          'description': 'Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.',
 
25289
          'examples': [
 
25290
            'bitOr(1, 2)',
 
25291
            'bitXor([2, 3, 4], 4)'
 
25292
          ],
 
25293
          'seealso': [
 
25294
            'bitAnd', 'bitNot', 'bitOr', 'leftShift', 'rightArithShift', 'rightLogShift'
 
25295
          ]
 
25296
        };
 
25297
 
 
25298
 
 
25299
/***/ },
 
25300
/* 238 */
 
25301
/***/ function(module, exports, __webpack_require__) {
 
25302
 
 
25303
        module.exports = {
 
25304
          'name': 'leftShift',
 
25305
          'category': 'Bitwise',
 
25306
          'syntax': [
 
25307
            'x << y',
 
25308
            'leftShift(x, y)'
 
25309
          ],
 
25310
          'description': 'Bitwise left logical shift of a value x by y number of bits.',
 
25311
          'examples': [
 
25312
            '4 << 1',
 
25313
            '8 >> 1'
 
25314
          ],
 
25315
          'seealso': [
 
25316
            'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'rightArithShift', 'rightLogShift'
 
25317
          ]
 
25318
        };
 
25319
 
 
25320
 
 
25321
/***/ },
 
25322
/* 239 */
 
25323
/***/ function(module, exports, __webpack_require__) {
 
25324
 
 
25325
        module.exports = {
 
25326
          'name': 'rightArithShift',
 
25327
          'category': 'Bitwise',
 
25328
          'syntax': [
 
25329
            'x >> y',
 
25330
            'leftShift(x, y)'
 
25331
          ],
 
25332
          'description': 'Bitwise right arithmetic shift of a value x by y number of bits.',
 
25333
          'examples': [
 
25334
            '8 >> 1',
 
25335
            '4 << 1',
 
25336
            '-12 >> 2'
 
25337
          ],
 
25338
          'seealso': [
 
25339
            'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightLogShift'
 
25340
          ]
 
25341
        };
 
25342
 
 
25343
 
 
25344
/***/ },
 
25345
/* 240 */
 
25346
/***/ function(module, exports, __webpack_require__) {
 
25347
 
 
25348
        module.exports = {
 
25349
          'name': 'rightLogShift',
 
25350
          'category': 'Bitwise',
 
25351
          'syntax': [
 
25352
            'x >> y',
 
25353
            'leftShift(x, y)'
 
25354
          ],
 
25355
          'description': 'Bitwise right logical shift of a value x by y number of bits.',
 
25356
          'examples': [
 
25357
            '8 >>> 1',
 
25358
            '4 << 1',
 
25359
            '-12 >>> 2'
 
25360
          ],
 
25361
          'seealso': [
 
25362
            'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift'
 
25363
          ]
 
25364
        };
 
25365
 
 
25366
 
 
25367
/***/ },
 
25368
/* 241 */
 
25369
/***/ function(module, exports, __webpack_require__) {
 
25370
 
 
25371
        module.exports = {
 
25372
          'name': 'arg',
 
25373
          'category': 'Complex',
 
25374
          'syntax': [
 
25375
            'arg(x)'
 
25376
          ],
 
25377
          'description':
 
25378
              'Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).',
 
25379
          'examples': [
 
25380
            'arg(2 + 2i)',
 
25381
            'atan2(3, 2)',
 
25382
            'arg(2 + 3i)'
 
25383
          ],
 
25384
          'seealso': [
 
25385
            're',
 
25386
            'im',
 
25387
            'conj',
 
25388
            'abs'
 
25389
          ]
 
25390
        };
 
25391
 
 
25392
 
 
25393
/***/ },
 
25394
/* 242 */
 
25395
/***/ function(module, exports, __webpack_require__) {
 
25396
 
 
25397
        module.exports = {
 
25398
          'name': 'conj',
 
25399
          'category': 'Complex',
 
25400
          'syntax': [
 
25401
            'conj(x)'
 
25402
          ],
 
25403
          'description':
 
25404
              'Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.',
 
25405
          'examples': [
 
25406
            'conj(2 + 3i)',
 
25407
            'conj(2 - 3i)',
 
25408
            'conj(-5.2i)'
 
25409
          ],
 
25410
          'seealso': [
 
25411
            're',
 
25412
            'im',
 
25413
            'abs',
 
25414
            'arg'
 
25415
          ]
 
25416
        };
 
25417
 
 
25418
 
 
25419
/***/ },
 
25420
/* 243 */
 
25421
/***/ function(module, exports, __webpack_require__) {
 
25422
 
 
25423
        module.exports = {
 
25424
          'name': 're',
 
25425
          'category': 'Complex',
 
25426
          'syntax': [
 
25427
            're(x)'
 
25428
          ],
 
25429
          'description': 'Get the real part of a complex number.',
 
25430
          'examples': [
 
25431
            're(2 + 3i)',
 
25432
            'im(2 + 3i)',
 
25433
            're(-5.2i)',
 
25434
            're(2.4)'
 
25435
          ],
 
25436
          'seealso': [
 
25437
            'im',
 
25438
            'conj',
 
25439
            'abs',
 
25440
            'arg'
 
25441
          ]
 
25442
        };
 
25443
 
 
25444
 
 
25445
/***/ },
 
25446
/* 244 */
 
25447
/***/ function(module, exports, __webpack_require__) {
 
25448
 
 
25449
        module.exports = {
 
25450
          'name': 'im',
 
25451
          'category': 'Complex',
 
25452
          'syntax': [
 
25453
            'im(x)'
 
25454
          ],
 
25455
          'description': 'Get the imaginary part of a complex number.',
 
25456
          'examples': [
 
25457
            'im(2 + 3i)',
 
25458
            're(2 + 3i)',
 
25459
            'im(-5.2i)',
 
25460
            'im(2.4)'
 
25461
          ],
 
25462
          'seealso': [
 
25463
            're',
 
25464
            'conj',
 
25465
            'abs',
 
25466
            'arg'
 
25467
          ]
 
25468
        };
 
25469
 
 
25470
 
 
25471
/***/ },
 
25472
/* 245 */
 
25473
/***/ function(module, exports, __webpack_require__) {
 
25474
 
 
25475
        module.exports = {
 
25476
          'name': 'bignumber',
 
25477
          'category': 'Type',
 
25478
          'syntax': [
 
25479
            'bignumber(x)'
 
25480
          ],
 
25481
          'description':
 
25482
              'Create a big number from a number or string.',
 
25483
          'examples': [
 
25484
            '0.1 + 0.2',
 
25485
            'bignumber(0.1) + bignumber(0.2)',
 
25486
            'bignumber("7.2")',
 
25487
            'bignumber("7.2e500")',
 
25488
            'bignumber([0.1, 0.2, 0.3])'
 
25489
          ],
 
25490
          'seealso': [
 
25491
            'boolean', 'complex', 'index', 'matrix', 'string', 'unit'
 
25492
          ]
 
25493
        };
 
25494
 
 
25495
 
 
25496
/***/ },
 
25497
/* 246 */
 
25498
/***/ function(module, exports, __webpack_require__) {
 
25499
 
 
25500
        module.exports = {
 
25501
          'name': 'boolean',
 
25502
          'category': 'Type',
 
25503
          'syntax': [
 
25504
            'x',
 
25505
            'boolean(x)'
 
25506
          ],
 
25507
          'description':
 
25508
              'Convert a string or number into a boolean.',
 
25509
          'examples': [
 
25510
            'boolean(0)',
 
25511
            'boolean(1)',
 
25512
            'boolean(3)',
 
25513
            'boolean("true")',
 
25514
            'boolean("false")',
 
25515
            'boolean([1, 0, 1, 1])'
 
25516
          ],
 
25517
          'seealso': [
 
25518
            'bignumber', 'complex', 'index', 'matrix', 'number', 'string', 'unit'
 
25519
          ]
 
25520
        };
 
25521
 
 
25522
 
 
25523
/***/ },
 
25524
/* 247 */
 
25525
/***/ function(module, exports, __webpack_require__) {
 
25526
 
 
25527
        module.exports = {
 
25528
          'name': 'complex',
 
25529
          'category': 'Type',
 
25530
          'syntax': [
 
25531
            'complex()',
 
25532
            'complex(re, im)',
 
25533
            'complex(string)'
 
25534
          ],
 
25535
          'description':
 
25536
              'Create a complex number.',
 
25537
          'examples': [
 
25538
            'complex()',
 
25539
            'complex(2, 3)',
 
25540
            'complex("7 - 2i")'
 
25541
          ],
 
25542
          'seealso': [
 
25543
            'bignumber', 'boolean', 'index', 'matrix', 'number', 'string', 'unit'
 
25544
          ]
 
25545
        };
 
25546
 
 
25547
 
 
25548
/***/ },
 
25549
/* 248 */
 
25550
/***/ function(module, exports, __webpack_require__) {
 
25551
 
 
25552
        module.exports = {
 
25553
          'name': 'index',
 
25554
          'category': 'Type',
 
25555
          'syntax': [
 
25556
            '[start]',
 
25557
            '[start:end]',
 
25558
            '[start:step:end]',
 
25559
            '[start1, start 2, ...]',
 
25560
            '[start1:end1, start2:end2, ...]',
 
25561
            '[start1:step1:end1, start2:step2:end2, ...]'
 
25562
          ],
 
25563
          'description':
 
25564
              'Create an index to get or replace a subset of a matrix',
 
25565
          'examples': [
 
25566
            '[]',
 
25567
            '[1, 2, 3]',
 
25568
            'A = [1, 2, 3; 4, 5, 6]',
 
25569
            'A[1, :]',
 
25570
            'A[1, 2] = 50',
 
25571
            'A[0:2, 0:2] = ones(2, 2)'
 
25572
          ],
 
25573
          'seealso': [
 
25574
            'bignumber', 'boolean', 'complex', 'matrix,', 'number', 'range', 'string', 'unit'
 
25575
          ]
 
25576
        };
 
25577
 
 
25578
 
 
25579
/***/ },
 
25580
/* 249 */
 
25581
/***/ function(module, exports, __webpack_require__) {
 
25582
 
 
25583
        module.exports = {
 
25584
          'name': 'matrix',
 
25585
          'category': 'Type',
 
25586
          'syntax': [
 
25587
            '[]',
 
25588
            '[a1, b1, ...; a2, b2, ...]',
 
25589
            'matrix()',
 
25590
            'matrix([...])'
 
25591
          ],
 
25592
          'description':
 
25593
              'Create a matrix.',
 
25594
          'examples': [
 
25595
            '[]',
 
25596
            '[1, 2, 3]',
 
25597
            '[1, 2, 3; 4, 5, 6]',
 
25598
            'matrix()',
 
25599
            'matrix([3, 4])'
 
25600
          ],
 
25601
          'seealso': [
 
25602
            'bignumber', 'boolean', 'complex', 'index', 'number', 'string', 'unit'
 
25603
          ]
 
25604
        };
 
25605
 
 
25606
 
 
25607
/***/ },
 
25608
/* 250 */
 
25609
/***/ function(module, exports, __webpack_require__) {
 
25610
 
 
25611
        module.exports = {
 
25612
          'name': 'number',
 
25613
          'category': 'Type',
 
25614
          'syntax': [
 
25615
            'x',
 
25616
            'number(x)'
 
25617
          ],
 
25618
          'description':
 
25619
              'Create a number or convert a string or boolean into a number.',
 
25620
          'examples': [
 
25621
            '2',
 
25622
            '2e3',
 
25623
            '4.05',
 
25624
            'number(2)',
 
25625
            'number("7.2")',
 
25626
            'number(true)',
 
25627
            'number([true, false, true, true])',
 
25628
            'number("52cm", "m")'
 
25629
          ],
 
25630
          'seealso': [
 
25631
            'bignumber', 'boolean', 'complex', 'index', 'matrix', 'string', 'unit'
 
25632
          ]
 
25633
        };
 
25634
 
 
25635
 
 
25636
/***/ },
 
25637
/* 251 */
 
25638
/***/ function(module, exports, __webpack_require__) {
 
25639
 
 
25640
        module.exports = {
 
25641
          'name': 'string',
 
25642
          'category': 'Type',
 
25643
          'syntax': [
 
25644
            '"text"',
 
25645
            'string(x)'
 
25646
          ],
 
25647
          'description':
 
25648
              'Create a string or convert a value to a string',
 
25649
          'examples': [
 
25650
            '"Hello World!"',
 
25651
            'string(4.2)',
 
25652
            'string(3 + 2i)'
 
25653
          ],
 
25654
          'seealso': [
 
25655
            'bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'unit'
 
25656
          ]
 
25657
        };
 
25658
 
 
25659
 
 
25660
/***/ },
 
25661
/* 252 */
 
25662
/***/ function(module, exports, __webpack_require__) {
 
25663
 
 
25664
        module.exports = {
 
25665
          'name': 'unit',
 
25666
          'category': 'Type',
 
25667
          'syntax': [
 
25668
            'value unit',
 
25669
            'unit(value, unit)',
 
25670
            'unit(string)'
 
25671
          ],
 
25672
          'description':
 
25673
              'Create a unit.',
 
25674
          'examples': [
 
25675
            '5.5 mm',
 
25676
            '3 inch',
 
25677
            'unit(7.1, "kilogram")',
 
25678
            'unit("23 deg")'
 
25679
          ],
 
25680
          'seealso': [
 
25681
            'bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'string'
 
25682
          ]
 
25683
        };
 
25684
 
 
25685
 
 
25686
/***/ },
 
25687
/* 253 */
 
25688
/***/ function(module, exports, __webpack_require__) {
 
25689
 
 
25690
        module.exports = {
 
25691
          'name': 'eval',
 
25692
          'category': 'Expression',
 
25693
          'syntax': [
 
25694
            'eval(expression)',
 
25695
            'eval([expr1, expr2, expr3, ...])'
 
25696
          ],
 
25697
          'description': 'Evaluate an expression or an array with expressions.',
 
25698
          'examples': [
 
25699
            'eval("2 + 3")',
 
25700
            'eval("sqrt(" + 4 + ")")'
 
25701
          ],
 
25702
          'seealso': []
 
25703
        };
 
25704
 
 
25705
 
 
25706
/***/ },
 
25707
/* 254 */
 
25708
/***/ function(module, exports, __webpack_require__) {
 
25709
 
 
25710
        module.exports = {
 
25711
          'name': 'help',
 
25712
          'category': 'Expression',
 
25713
          'syntax': [
 
25714
            'help(object)',
 
25715
            'help(string)'
 
25716
          ],
 
25717
          'description': 'Display documentation on a function or data type.',
 
25718
          'examples': [
 
25719
            'help(sqrt)',
 
25720
            'help("complex")'
 
25721
          ],
 
25722
          'seealso': []
 
25723
        };
 
25724
 
 
25725
 
 
25726
/***/ },
 
25727
/* 255 */
 
25728
/***/ function(module, exports, __webpack_require__) {
 
25729
 
 
25730
        module.exports = {
 
25731
          'name': 'and',
 
25732
          'category': 'Logical',
 
25733
          'syntax': [
 
25734
            'x and y',
 
25735
            'and(x, y)'
 
25736
          ],
 
25737
          'description': 'Logical and. Test whether two values are both defined with a nonzero/nonempty value.',
 
25738
          'examples': [
 
25739
            'true and false',
 
25740
            'true and true',
 
25741
            '2 and 4'
 
25742
          ],
 
25743
          'seealso': [
 
25744
            'not', 'or', 'xor'
 
25745
          ]
 
25746
        };
 
25747
 
 
25748
 
 
25749
/***/ },
 
25750
/* 256 */
 
25751
/***/ function(module, exports, __webpack_require__) {
 
25752
 
 
25753
        module.exports = {
 
25754
          'name': 'not',
 
25755
          'category': 'Logical',
 
25756
          'syntax': [
 
25757
            '!x',
 
25758
            'not x',
 
25759
            'not(x)'
 
25760
          ],
 
25761
          'description': 'Logical not. Flips the boolean value of given argument.',
 
25762
          'examples': [
 
25763
            '!true',
 
25764
            'not false',
 
25765
            '!2',
 
25766
            '!0'
 
25767
          ],
 
25768
          'seealso': [
 
25769
            'and', 'or', 'xor'
 
25770
          ]
 
25771
        };
 
25772
 
 
25773
 
 
25774
/***/ },
 
25775
/* 257 */
 
25776
/***/ function(module, exports, __webpack_require__) {
 
25777
 
 
25778
        module.exports = {
 
25779
          'name': 'or',
 
25780
          'category': 'Logical',
 
25781
          'syntax': [
 
25782
            'x or y',
 
25783
            'or(x, y)'
 
25784
          ],
 
25785
          'description': 'Logical or. Test if at least one value is defined with a nonzero/nonempty value.',
 
25786
          'examples': [
 
25787
            'true or false',
 
25788
            'false or false',
 
25789
            '0 or 4'
 
25790
          ],
 
25791
          'seealso': [
 
25792
            'not', 'and', 'xor'
 
25793
          ]
 
25794
        };
 
25795
 
 
25796
 
 
25797
/***/ },
 
25798
/* 258 */
 
25799
/***/ function(module, exports, __webpack_require__) {
 
25800
 
 
25801
        module.exports = {
 
25802
          'name': 'xor',
 
25803
          'category': 'Logical',
 
25804
          'syntax': [
 
25805
            'x or y',
 
25806
            'or(x, y)'
 
25807
          ],
 
25808
          'description': 'Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.',
 
25809
          'examples': [
 
25810
            'true xor false',
 
25811
            'false xor false',
 
25812
            'true xor true',
 
25813
            '0 or 4'
 
25814
          ],
 
25815
          'seealso': [
 
25816
            'not', 'and', 'or'
 
25817
          ]
 
25818
        };
 
25819
 
 
25820
 
 
25821
/***/ },
 
25822
/* 259 */
 
25823
/***/ function(module, exports, __webpack_require__) {
 
25824
 
 
25825
        module.exports = {
 
25826
          'name': 'concat',
 
25827
          'category': 'Matrix',
 
25828
          'syntax': [
 
25829
            'concat(A, B, C, ...)',
 
25830
            'concat(A, B, C, ..., dim)'
 
25831
          ],
 
25832
          'description': 'Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.',
 
25833
          'examples': [
 
25834
            'A = [1, 2; 5, 6]',
 
25835
            'B = [3, 4; 7, 8]',
 
25836
            'concat(A, B)',
 
25837
            'concat(A, B, 1)',
 
25838
            'concat(A, B, 2)'
 
25839
          ],
 
25840
          'seealso': [
 
25841
            'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'
 
25842
          ]
 
25843
        };
 
25844
 
 
25845
 
 
25846
/***/ },
 
25847
/* 260 */
 
25848
/***/ function(module, exports, __webpack_require__) {
 
25849
 
 
25850
        module.exports = {
 
25851
          'name': 'cross',
 
25852
          'category': 'Matrix',
 
25853
          'syntax': [
 
25854
            'cross(A, B)'
 
25855
          ],
 
25856
          'description': 'Calculate the cross product for two vectors in three dimensional space.',
 
25857
          'examples': [
 
25858
            'cross([1, 1, 0],  [0, 1, 1])',
 
25859
            'cross([3, -3, 1], [4, 9, 2])',
 
25860
            'cross([2, 3, 4],  [5, 6, 7])'
 
25861
          ],
 
25862
          'seealso': [
 
25863
            'multiply',
 
25864
            'dot'
 
25865
          ]
 
25866
        };
 
25867
 
 
25868
 
 
25869
/***/ },
 
25870
/* 261 */
 
25871
/***/ function(module, exports, __webpack_require__) {
 
25872
 
 
25873
        module.exports = {
 
25874
          'name': 'det',
 
25875
          'category': 'Matrix',
 
25876
          'syntax': [
 
25877
            'det(x)'
 
25878
          ],
 
25879
          'description': 'Calculate the determinant of a matrix',
 
25880
          'examples': [
 
25881
            'det([1, 2; 3, 4])',
 
25882
            'det([-2, 2, 3; -1, 1, 3; 2, 0, -1])'
 
25883
          ],
 
25884
          'seealso': [
 
25885
            'concat', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'
 
25886
          ]
 
25887
        };
 
25888
 
 
25889
 
 
25890
/***/ },
 
25891
/* 262 */
 
25892
/***/ function(module, exports, __webpack_require__) {
 
25893
 
 
25894
        module.exports = {
 
25895
          'name': 'diag',
 
25896
          'category': 'Matrix',
 
25897
          'syntax': [
 
25898
            'diag(x)',
 
25899
            'diag(x, k)'
 
25900
          ],
 
25901
          'description': 'Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.',
 
25902
          'examples': [
 
25903
            'diag(1:3)',
 
25904
            'diag(1:3, 1)',
 
25905
            'a = [1, 2, 3; 4, 5, 6; 7, 8, 9]',
 
25906
            'diag(a)'
 
25907
          ],
 
25908
          'seealso': [
 
25909
            'concat', 'det', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'
 
25910
          ]
 
25911
        };
 
25912
 
 
25913
 
 
25914
/***/ },
 
25915
/* 263 */
 
25916
/***/ function(module, exports, __webpack_require__) {
 
25917
 
 
25918
        module.exports = {
 
25919
          'name': 'dot',
 
25920
          'category': 'Matrix',
 
25921
          'syntax': [
 
25922
            'dot(A, B)'
 
25923
          ],
 
25924
          'description': 'Calculate the dot product of two vectors. ' +
 
25925
              'The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] ' +
 
25926
              'is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn',
 
25927
          'examples': [
 
25928
            'dot([2, 4, 1], [2, 2, 3])',
 
25929
            '[2, 4, 1] * [2, 2, 3]'
 
25930
          ],
 
25931
          'seealso': [
 
25932
            'multiply',
 
25933
            'cross'
 
25934
          ]
 
25935
        };
 
25936
 
 
25937
 
 
25938
/***/ },
 
25939
/* 264 */
 
25940
/***/ function(module, exports, __webpack_require__) {
 
25941
 
 
25942
        module.exports = {
 
25943
          'name': 'eye',
 
25944
          'category': 'Matrix',
 
25945
          'syntax': [
 
25946
            'eye(n)',
 
25947
            'eye(m, n)',
 
25948
            'eye([m, n])',
 
25949
            'eye'
 
25950
          ],
 
25951
          'description': 'Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.',
 
25952
          'examples': [
 
25953
            'eye(3)',
 
25954
            'eye(3, 5)',
 
25955
            'a = [1, 2, 3; 4, 5, 6]',
 
25956
            'eye(size(a))'
 
25957
          ],
 
25958
          'seealso': [
 
25959
            'concat', 'det', 'diag', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'
 
25960
          ]
 
25961
        };
 
25962
 
 
25963
 
 
25964
/***/ },
 
25965
/* 265 */
 
25966
/***/ function(module, exports, __webpack_require__) {
 
25967
 
 
25968
        module.exports = {
 
25969
          'name': 'flatten',
 
25970
          'category': 'Matrix',
 
25971
          'syntax': [
 
25972
            'flatten(x)'
 
25973
          ],
 
25974
          'description': 'Flatten a multi dimensional matrix into a single dimensional matrix.',
 
25975
          'examples': [
 
25976
            'a = [1, 2, 3; 4, 5, 6]',
 
25977
            'size(a)',
 
25978
            'b = flatten(a)',
 
25979
            'size(b)'
 
25980
          ],
 
25981
          'seealso': [
 
25982
            'concat', 'resize', 'size', 'squeeze'
 
25983
          ]
 
25984
        };
 
25985
 
 
25986
 
 
25987
/***/ },
 
25988
/* 266 */
 
25989
/***/ function(module, exports, __webpack_require__) {
 
25990
 
 
25991
        module.exports = {
 
25992
          'name': 'inv',
 
25993
          'category': 'Matrix',
 
25994
          'syntax': [
 
25995
            'inv(x)'
 
25996
          ],
 
25997
          'description': 'Calculate the inverse of a matrix',
 
25998
          'examples': [
 
25999
            'inv([1, 2; 3, 4])',
 
26000
            'inv(4)',
 
26001
            '1 / 4'
 
26002
          ],
 
26003
          'seealso': [
 
26004
            'concat', 'det', 'diag', 'eye', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'
 
26005
          ]
 
26006
        };
 
26007
 
 
26008
 
 
26009
/***/ },
 
26010
/* 267 */
 
26011
/***/ function(module, exports, __webpack_require__) {
 
26012
 
 
26013
        module.exports = {
 
26014
          'name': 'ones',
 
26015
          'category': 'Matrix',
 
26016
          'syntax': [
 
26017
            'ones(m)',
 
26018
            'ones(m, n)',
 
26019
            'ones(m, n, p, ...)',
 
26020
            'ones([m])',
 
26021
            'ones([m, n])',
 
26022
            'ones([m, n, p, ...])',
 
26023
            'ones'
 
26024
          ],
 
26025
          'description': 'Create a matrix containing ones.',
 
26026
          'examples': [
 
26027
            'ones(3)',
 
26028
            'ones(3, 5)',
 
26029
            'ones([2,3]) * 4.5',
 
26030
            'a = [1, 2, 3; 4, 5, 6]',
 
26031
            'ones(size(a))'
 
26032
          ],
 
26033
          'seealso': [
 
26034
            'concat', 'det', 'diag', 'eye', 'inv', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'
 
26035
          ]
 
26036
        };
 
26037
 
 
26038
 
 
26039
/***/ },
 
26040
/* 268 */
 
26041
/***/ function(module, exports, __webpack_require__) {
 
26042
 
 
26043
        module.exports = {
 
26044
          'name': 'range',
 
26045
          'category': 'Type',
 
26046
          'syntax': [
 
26047
            'start:end',
 
26048
            'start:step:end',
 
26049
            'range(start, end)',
 
26050
            'range(start, end, step)',
 
26051
            'range(string)'
 
26052
          ],
 
26053
          'description':
 
26054
              'Create a range. Lower bound of the range is included, upper bound is excluded.',
 
26055
          'examples': [
 
26056
            '1:5',
 
26057
            '3:-1:-3',
 
26058
            'range(3, 7)',
 
26059
            'range(0, 12, 2)',
 
26060
            'range("4:10")',
 
26061
            'a = [1, 2, 3, 4; 5, 6, 7, 8]',
 
26062
            'a[1:2, 1:2]'
 
26063
          ],
 
26064
          'seealso': [
 
26065
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'
 
26066
          ]
 
26067
        };
 
26068
 
 
26069
 
 
26070
/***/ },
 
26071
/* 269 */
 
26072
/***/ function(module, exports, __webpack_require__) {
 
26073
 
 
26074
        module.exports = {
 
26075
          'name': 'resize',
 
26076
          'category': 'Matrix',
 
26077
          'syntax': [
 
26078
            'resize(x, size)',
 
26079
            'resize(x, size, defaultValue)'
 
26080
          ],
 
26081
          'description': 'Resize a matrix.',
 
26082
          'examples': [
 
26083
            'resize([1,2,3,4,5], [3])',
 
26084
            'resize([1,2,3], [5])',
 
26085
            'resize([1,2,3], [5], -1)',
 
26086
            'resize(2, [2, 3])',
 
26087
            'resize("hello", [8], "!")'
 
26088
          ],
 
26089
          'seealso': [
 
26090
            'size', 'subset', 'squeeze'
 
26091
          ]
 
26092
        };
 
26093
 
 
26094
 
 
26095
/***/ },
 
26096
/* 270 */
 
26097
/***/ function(module, exports, __webpack_require__) {
 
26098
 
 
26099
        module.exports = {
 
26100
          'name': 'size',
 
26101
          'category': 'Matrix',
 
26102
          'syntax': [
 
26103
            'size(x)'
 
26104
          ],
 
26105
          'description': 'Calculate the size of a matrix.',
 
26106
          'examples': [
 
26107
            'size(2.3)',
 
26108
            'size("hello world")',
 
26109
            'a = [1, 2; 3, 4; 5, 6]',
 
26110
            'size(a)',
 
26111
            'size(1:6)'
 
26112
          ],
 
26113
          'seealso': [
 
26114
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'
 
26115
          ]
 
26116
        };
 
26117
 
 
26118
 
 
26119
/***/ },
 
26120
/* 271 */
 
26121
/***/ function(module, exports, __webpack_require__) {
 
26122
 
 
26123
        module.exports = {
 
26124
          'name': 'squeeze',
 
26125
          'category': 'Matrix',
 
26126
          'syntax': [
 
26127
            'squeeze(x)'
 
26128
          ],
 
26129
          'description': 'Remove inner and outer singleton dimensions from a matrix.',
 
26130
          'examples': [
 
26131
            'a = zeros(3,2,1)',
 
26132
            'size(squeeze(a))',
 
26133
            'b = zeros(1,1,3)',
 
26134
            'size(squeeze(b))'
 
26135
          ],
 
26136
          'seealso': [
 
26137
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'subset', 'trace', 'transpose', 'zeros'
 
26138
          ]
 
26139
        };
 
26140
 
 
26141
 
 
26142
/***/ },
 
26143
/* 272 */
 
26144
/***/ function(module, exports, __webpack_require__) {
 
26145
 
 
26146
        module.exports = {
 
26147
          'name': 'subset',
 
26148
          'category': 'Matrix',
 
26149
          'syntax': [
 
26150
            'value(index)',
 
26151
            'value(index) = replacement',
 
26152
            'subset(value, [index])',
 
26153
            'subset(value, [index], replacement)'
 
26154
          ],
 
26155
          'description': 'Get or set a subset of a matrix or string. ' +
 
26156
              'Indexes are one-based. ' +
 
26157
              'Both the ranges lower-bound and upper-bound are included.',
 
26158
          'examples': [
 
26159
            'd = [1, 2; 3, 4]',
 
26160
            'e = []',
 
26161
            'e[1, 1:2] = [5, 6]',
 
26162
            'e[2, :] = [7, 8]',
 
26163
            'f = d * e',
 
26164
            'f[2, 1]',
 
26165
            'f[:, 1]'
 
26166
          ],
 
26167
          'seealso': [
 
26168
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'trace', 'transpose', 'zeros'
 
26169
          ]
 
26170
        };
 
26171
 
 
26172
 
 
26173
/***/ },
 
26174
/* 273 */
 
26175
/***/ function(module, exports, __webpack_require__) {
 
26176
 
 
26177
        module.exports = {
 
26178
          'name': 'trace',
 
26179
          'category': 'Matrix',
 
26180
          'syntax': [
 
26181
            'trace(A)'
 
26182
          ],
 
26183
          'description': 'Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.',
 
26184
          'examples': [
 
26185
            'A = [1, 2, 3; -1, 2, 3; 2, 0, 3]',
 
26186
            'trace(A)'
 
26187
          ],
 
26188
          'seealso': [
 
26189
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'transpose', 'zeros'
 
26190
          ]
 
26191
        };
 
26192
 
 
26193
 
 
26194
/***/ },
 
26195
/* 274 */
 
26196
/***/ function(module, exports, __webpack_require__) {
 
26197
 
 
26198
        module.exports = {
 
26199
          'name': 'transpose',
 
26200
          'category': 'Matrix',
 
26201
          'syntax': [
 
26202
            'x\'',
 
26203
            'transpose(x)'
 
26204
          ],
 
26205
          'description': 'Transpose a matrix',
 
26206
          'examples': [
 
26207
            'a = [1, 2, 3; 4, 5, 6]',
 
26208
            'a\'',
 
26209
            'transpose(a)'
 
26210
          ],
 
26211
          'seealso': [
 
26212
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'zeros'
 
26213
          ]
 
26214
        };
 
26215
 
 
26216
 
 
26217
/***/ },
 
26218
/* 275 */
 
26219
/***/ function(module, exports, __webpack_require__) {
 
26220
 
 
26221
        module.exports = {
 
26222
          'name': 'zeros',
 
26223
          'category': 'Matrix',
 
26224
          'syntax': [
 
26225
            'zeros(m)',
 
26226
            'zeros(m, n)',
 
26227
            'zeros(m, n, p, ...)',
 
26228
            'zeros([m])',
 
26229
            'zeros([m, n])',
 
26230
            'zeros([m, n, p, ...])',
 
26231
            'zeros'
 
26232
          ],
 
26233
          'description': 'Create a matrix containing zeros.',
 
26234
          'examples': [
 
26235
            'zeros(3)',
 
26236
            'zeros(3, 5)',
 
26237
            'a = [1, 2, 3; 4, 5, 6]',
 
26238
            'zeros(size(a))'
 
26239
          ],
 
26240
          'seealso': [
 
26241
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose'
 
26242
          ]
 
26243
        };
 
26244
 
 
26245
 
 
26246
/***/ },
 
26247
/* 276 */
 
26248
/***/ function(module, exports, __webpack_require__) {
 
26249
 
 
26250
        module.exports = {
 
26251
          'name': 'combinations',
 
26252
          'category': 'Probability',
 
26253
          'syntax': [
 
26254
            'combinations(n, k)'
 
26255
          ],
 
26256
          'description': 'Compute the number of combinations of n items taken k at a time',
 
26257
          'examples': [
 
26258
            'combinations(7, 5)'
 
26259
          ],
 
26260
          'seealso': ['permutations', 'factorial']
 
26261
        };
 
26262
 
 
26263
 
 
26264
/***/ },
 
26265
/* 277 */
 
26266
/***/ function(module, exports, __webpack_require__) {
 
26267
 
 
26268
        module.exports = {
 
26269
          'name': 'factorial',
 
26270
          'category': 'Probability',
 
26271
          'syntax': [
 
26272
            'n!',
 
26273
            'factorial(n)'
 
26274
          ],
 
26275
          'description': 'Compute the factorial of a value',
 
26276
          'examples': [
 
26277
            '5!',
 
26278
            '5 * 4 * 3 * 2 * 1',
 
26279
            '3!'
 
26280
          ],
 
26281
          'seealso': ['combinations', 'permutations', 'gamma']
 
26282
        };
 
26283
 
 
26284
 
 
26285
/***/ },
 
26286
/* 278 */
 
26287
/***/ function(module, exports, __webpack_require__) {
 
26288
 
 
26289
        module.exports = {
 
26290
          'name': 'gamma',
 
26291
          'category': 'Probability',
 
26292
          'syntax': [
 
26293
            'gamma(n)'
 
26294
          ],
 
26295
          'description': 'Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.',
 
26296
          'examples': [
 
26297
            'gamma(4)',
 
26298
            '3!',
 
26299
            'gamma(1/2)',
 
26300
            'sqrt(pi)'
 
26301
          ],
 
26302
          'seealso': ['factorial']
 
26303
        };
 
26304
 
 
26305
 
 
26306
/***/ },
 
26307
/* 279 */
 
26308
/***/ function(module, exports, __webpack_require__) {
 
26309
 
 
26310
        module.exports = {
 
26311
          'name': 'permutations',
 
26312
          'category': 'Probability',
 
26313
          'syntax': [
 
26314
            'permutations(n)',
 
26315
            'permutations(n, k)'
 
26316
          ],
 
26317
          'description': 'Compute the number of permutations of n items taken k at a time',
 
26318
          'examples': [
 
26319
            'permutations(5)',
 
26320
            'permutations(5, 3)'
 
26321
          ],
 
26322
          'seealso': ['combinations', 'factorial']
 
26323
        };
 
26324
 
 
26325
 
 
26326
/***/ },
 
26327
/* 280 */
 
26328
/***/ function(module, exports, __webpack_require__) {
 
26329
 
 
26330
        module.exports = {
 
26331
          'name': 'pickRandom',
 
26332
          'category': 'Probability',
 
26333
          'syntax': [
 
26334
            'pickRandom(array)'
 
26335
          ],
 
26336
          'description':
 
26337
              'Pick a random entry from a given array.',
 
26338
          'examples': [
 
26339
            'pickRandom(0:10)',
 
26340
            'pickRandom([1, 3, 1, 6])'
 
26341
          ],
 
26342
          'seealso': ['random', 'randomInt']
 
26343
        };
 
26344
 
 
26345
 
 
26346
/***/ },
 
26347
/* 281 */
 
26348
/***/ function(module, exports, __webpack_require__) {
 
26349
 
 
26350
        module.exports = {
 
26351
          'name': 'random',
 
26352
          'category': 'Probability',
 
26353
          'syntax': [
 
26354
            'random()',
 
26355
            'random(max)',
 
26356
            'random(min, max)',
 
26357
            'random(size)',
 
26358
            'random(size, max)',
 
26359
            'random(size, min, max)'
 
26360
          ],
 
26361
          'description':
 
26362
              'Return a random number.',
 
26363
          'examples': [
 
26364
            'random()',
 
26365
            'random(10, 20)',
 
26366
            'random([2, 3])'
 
26367
          ],
 
26368
          'seealso': ['pickRandom', 'randomInt']
 
26369
        };
 
26370
 
 
26371
 
 
26372
/***/ },
 
26373
/* 282 */
 
26374
/***/ function(module, exports, __webpack_require__) {
 
26375
 
 
26376
        module.exports = {
 
26377
          'name': 'randInt',
 
26378
          'category': 'Probability',
 
26379
          'syntax': [
 
26380
            'randInt()',
 
26381
            'randInt(max)',
 
26382
            'randInt(min, max)',
 
26383
            'randInt(size)',
 
26384
            'randInt(size, max)',
 
26385
            'randInt(size, min, max)'
 
26386
          ],
 
26387
          'description':
 
26388
              'Return a random integer number',
 
26389
          'examples': [
 
26390
            'randInt()',
 
26391
            'randInt(10, 20)',
 
26392
            'randInt([2, 3], 10)'
 
26393
          ],
 
26394
          'seealso': ['pickRandom', 'random']
 
26395
        };
 
26396
 
 
26397
/***/ },
 
26398
/* 283 */
 
26399
/***/ function(module, exports, __webpack_require__) {
 
26400
 
 
26401
        module.exports = {
 
26402
          'name': 'compare',
 
26403
          'category': 'Relational',
 
26404
          'syntax': [
 
26405
            'compare(x, y)'
 
26406
          ],
 
26407
          'description':
 
26408
              'Compare two values. Returns 1 if x is larger than y, -1 if x is smaller than y, and 0 if x and y are equal.',
 
26409
          'examples': [
 
26410
            'compare(2, 3)',
 
26411
            'compare(3, 2)',
 
26412
            'compare(2, 2)',
 
26413
            'compare(5cm, 40mm)',
 
26414
            'compare(2, [1, 2, 3])'
 
26415
          ],
 
26416
          'seealso': [
 
26417
            'equal', 'unequal', 'smaller', 'smallerEq', 'largerEq'
 
26418
          ]
 
26419
        };
 
26420
 
 
26421
 
 
26422
/***/ },
 
26423
/* 284 */
 
26424
/***/ function(module, exports, __webpack_require__) {
 
26425
 
 
26426
        module.exports = {
 
26427
          'name': 'deepEqual',
 
26428
          'category': 'Relational',
 
26429
          'syntax': [
 
26430
            'deepEqual(x, y)'
 
26431
          ],
 
26432
          'description':
 
26433
              'Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.',
 
26434
          'examples': [
 
26435
            '[1,3,4] == [1,3,4]',
 
26436
            '[1,3,4] == [1,3]'
 
26437
          ],
 
26438
          'seealso': [
 
26439
            'equal', 'unequal', 'smaller', 'larger', 'smallerEq', 'largerEq', 'compare'
 
26440
          ]
 
26441
        };
 
26442
 
 
26443
 
 
26444
/***/ },
 
26445
/* 285 */
 
26446
/***/ function(module, exports, __webpack_require__) {
 
26447
 
 
26448
        module.exports = {
 
26449
          'name': 'equal',
 
26450
          'category': 'Relational',
 
26451
          'syntax': [
 
26452
            'x == y',
 
26453
            'equal(x, y)'
 
26454
          ],
 
26455
          'description':
 
26456
              'Check equality of two values. Returns true if the values are equal, and false if not.',
 
26457
          'examples': [
 
26458
            '2+2 == 3',
 
26459
            '2+2 == 4',
 
26460
            'a = 3.2',
 
26461
            'b = 6-2.8',
 
26462
            'a == b',
 
26463
            '50cm == 0.5m'
 
26464
          ],
 
26465
          'seealso': [
 
26466
            'unequal', 'smaller', 'larger', 'smallerEq', 'largerEq', 'compare', 'deepEqual'
 
26467
          ]
 
26468
        };
 
26469
 
 
26470
 
 
26471
/***/ },
 
26472
/* 286 */
 
26473
/***/ function(module, exports, __webpack_require__) {
 
26474
 
 
26475
        module.exports = {
 
26476
          'name': 'larger',
 
26477
          'category': 'Relational',
 
26478
          'syntax': [
 
26479
            'x > y',
 
26480
            'larger(x, y)'
 
26481
          ],
 
26482
          'description':
 
26483
              'Check if value x is larger than y. Returns true if x is larger than y, and false if not.',
 
26484
          'examples': [
 
26485
            '2 > 3',
 
26486
            '5 > 2*2',
 
26487
            'a = 3.3',
 
26488
            'b = 6-2.8',
 
26489
            '(a > b)',
 
26490
            '(b < a)',
 
26491
            '5 cm > 2 inch'
 
26492
          ],
 
26493
          'seealso': [
 
26494
            'equal', 'unequal', 'smaller', 'smallerEq', 'largerEq', 'compare'
 
26495
          ]
 
26496
        };
 
26497
 
 
26498
 
 
26499
/***/ },
 
26500
/* 287 */
 
26501
/***/ function(module, exports, __webpack_require__) {
 
26502
 
 
26503
        module.exports = {
 
26504
          'name': 'largerEq',
 
26505
          'category': 'Relational',
 
26506
          'syntax': [
 
26507
            'x >= y',
 
26508
            'largerEq(x, y)'
 
26509
          ],
 
26510
          'description':
 
26511
              'Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.',
 
26512
          'examples': [
 
26513
            '2 > 1+1',
 
26514
            '2 >= 1+1',
 
26515
            'a = 3.2',
 
26516
            'b = 6-2.8',
 
26517
            '(a > b)'
 
26518
          ],
 
26519
          'seealso': [
 
26520
            'equal', 'unequal', 'smallerEq', 'smaller', 'largerEq', 'compare'
 
26521
          ]
 
26522
        };
 
26523
 
 
26524
 
 
26525
/***/ },
 
26526
/* 288 */
 
26527
/***/ function(module, exports, __webpack_require__) {
 
26528
 
 
26529
        module.exports = {
 
26530
          'name': 'smaller',
 
26531
          'category': 'Relational',
 
26532
          'syntax': [
 
26533
            'x < y',
 
26534
            'smaller(x, y)'
 
26535
          ],
 
26536
          'description':
 
26537
              'Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.',
 
26538
          'examples': [
 
26539
            '2 < 3',
 
26540
            '5 < 2*2',
 
26541
            'a = 3.3',
 
26542
            'b = 6-2.8',
 
26543
            '(a < b)',
 
26544
            '5 cm < 2 inch'
 
26545
          ],
 
26546
          'seealso': [
 
26547
            'equal', 'unequal', 'larger', 'smallerEq', 'largerEq', 'compare'
 
26548
          ]
 
26549
        };
 
26550
 
 
26551
 
 
26552
/***/ },
 
26553
/* 289 */
 
26554
/***/ function(module, exports, __webpack_require__) {
 
26555
 
 
26556
        module.exports = {
 
26557
          'name': 'smallerEq',
 
26558
          'category': 'Relational',
 
26559
          'syntax': [
 
26560
            'x <= y',
 
26561
            'smallerEq(x, y)'
 
26562
          ],
 
26563
          'description':
 
26564
              'Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.',
 
26565
          'examples': [
 
26566
            '2 < 1+1',
 
26567
            '2 <= 1+1',
 
26568
            'a = 3.2',
 
26569
            'b = 6-2.8',
 
26570
            '(a < b)'
 
26571
          ],
 
26572
          'seealso': [
 
26573
            'equal', 'unequal', 'larger', 'smaller', 'largerEq', 'compare'
 
26574
          ]
 
26575
        };
 
26576
 
 
26577
 
 
26578
/***/ },
 
26579
/* 290 */
 
26580
/***/ function(module, exports, __webpack_require__) {
 
26581
 
 
26582
        module.exports = {
 
26583
          'name': 'unequal',
 
26584
          'category': 'Relational',
 
26585
          'syntax': [
 
26586
            'x != y',
 
26587
            'unequal(x, y)'
 
26588
          ],
 
26589
          'description':
 
26590
              'Check unequality of two values. Returns true if the values are unequal, and false if they are equal.',
 
26591
          'examples': [
 
26592
            '2+2 != 3',
 
26593
            '2+2 != 4',
 
26594
            'a = 3.2',
 
26595
            'b = 6-2.8',
 
26596
            'a != b',
 
26597
            '50cm != 0.5m',
 
26598
            '5 cm != 2 inch'
 
26599
          ],
 
26600
          'seealso': [
 
26601
            'equal', 'smaller', 'larger', 'smallerEq', 'largerEq', 'compare', 'deepEqual'
 
26602
          ]
 
26603
        };
 
26604
 
 
26605
 
 
26606
/***/ },
 
26607
/* 291 */
 
26608
/***/ function(module, exports, __webpack_require__) {
 
26609
 
 
26610
        module.exports = {
 
26611
          'name': 'max',
 
26612
          'category': 'Statistics',
 
26613
          'syntax': [
 
26614
            'max(a, b, c, ...)',
 
26615
            'max(A)',
 
26616
            'max(A, dim)'
 
26617
          ],
 
26618
          'description': 'Compute the maximum value of a list of values.',
 
26619
          'examples': [
 
26620
            'max(2, 3, 4, 1)',
 
26621
            'max([2, 3, 4, 1])',
 
26622
            'max([2, 5; 4, 3])',
 
26623
            'max([2, 5; 4, 3], 1)',
 
26624
            'max([2, 5; 4, 3], 2)',
 
26625
            'max(2.7, 7.1, -4.5, 2.0, 4.1)',
 
26626
            'min(2.7, 7.1, -4.5, 2.0, 4.1)'
 
26627
          ],
 
26628
          'seealso': [
 
26629
            'mean',
 
26630
            'median',
 
26631
            'min',
 
26632
            'prod',
 
26633
            'std',
 
26634
            'sum',
 
26635
            'var'
 
26636
          ]
 
26637
        };
 
26638
 
 
26639
 
 
26640
/***/ },
 
26641
/* 292 */
 
26642
/***/ function(module, exports, __webpack_require__) {
 
26643
 
 
26644
        module.exports = {
 
26645
          'name': 'mean',
 
26646
          'category': 'Statistics',
 
26647
          'syntax': [
 
26648
            'mean(a, b, c, ...)',
 
26649
            'mean(A)',
 
26650
            'mean(A, dim)'
 
26651
          ],
 
26652
          'description': 'Compute the arithmetic mean of a list of values.',
 
26653
          'examples': [
 
26654
            'mean(2, 3, 4, 1)',
 
26655
            'mean([2, 3, 4, 1])',
 
26656
            'mean([2, 5; 4, 3])',
 
26657
            'mean([2, 5; 4, 3], 1)',
 
26658
            'mean([2, 5; 4, 3], 2)',
 
26659
            'mean([1.0, 2.7, 3.2, 4.0])'
 
26660
          ],
 
26661
          'seealso': [
 
26662
            'max',
 
26663
            'median',
 
26664
            'min',
 
26665
            'prod',
 
26666
            'std',
 
26667
            'sum',
 
26668
            'var'
 
26669
          ]
 
26670
        };
 
26671
 
 
26672
 
 
26673
/***/ },
 
26674
/* 293 */
 
26675
/***/ function(module, exports, __webpack_require__) {
 
26676
 
 
26677
        module.exports = {
 
26678
          'name': 'median',
 
26679
          'category': 'Statistics',
 
26680
          'syntax': [
 
26681
            'median(a, b, c, ...)',
 
26682
            'median(A)'
 
26683
          ],
 
26684
          'description': 'Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.',
 
26685
          'examples': [
 
26686
            'median(5, 2, 7)',
 
26687
            'median([3, -1, 5, 7])'
 
26688
          ],
 
26689
          'seealso': [
 
26690
            'max',
 
26691
            'mean',
 
26692
            'min',
 
26693
            'prod',
 
26694
            'std',
 
26695
            'sum',
 
26696
            'var'
 
26697
          ]
 
26698
        };
 
26699
 
 
26700
 
 
26701
/***/ },
 
26702
/* 294 */
 
26703
/***/ function(module, exports, __webpack_require__) {
 
26704
 
 
26705
        module.exports = {
 
26706
          'name': 'min',
 
26707
          'category': 'Statistics',
 
26708
          'syntax': [
 
26709
            'min(a, b, c, ...)',
 
26710
            'min(A)',
 
26711
            'min(A, dim)'
 
26712
          ],
 
26713
          'description': 'Compute the minimum value of a list of values.',
 
26714
          'examples': [
 
26715
            'min(2, 3, 4, 1)',
 
26716
            'min([2, 3, 4, 1])',
 
26717
            'min([2, 5; 4, 3])',
 
26718
            'min([2, 5; 4, 3], 1)',
 
26719
            'min([2, 5; 4, 3], 2)',
 
26720
            'min(2.7, 7.1, -4.5, 2.0, 4.1)',
 
26721
            'max(2.7, 7.1, -4.5, 2.0, 4.1)'
 
26722
          ],
 
26723
          'seealso': [
 
26724
            'max',
 
26725
            'mean',
 
26726
            'median',
 
26727
            'prod',
 
26728
            'std',
 
26729
            'sum',
 
26730
            'var'
 
26731
          ]
 
26732
        };
 
26733
 
 
26734
 
 
26735
/***/ },
 
26736
/* 295 */
 
26737
/***/ function(module, exports, __webpack_require__) {
 
26738
 
 
26739
        module.exports = {
 
26740
          'name': 'prod',
 
26741
          'category': 'Statistics',
 
26742
          'syntax': [
 
26743
            'prod(a, b, c, ...)',
 
26744
            'prod(A)'
 
26745
          ],
 
26746
          'description': 'Compute the product of all values.',
 
26747
          'examples': [
 
26748
            'prod(2, 3, 4)',
 
26749
            'prod([2, 3, 4])',
 
26750
            'prod([2, 5; 4, 3])'
 
26751
          ],
 
26752
          'seealso': [
 
26753
            'max',
 
26754
            'mean',
 
26755
            'min',
 
26756
            'median',
 
26757
            'min',
 
26758
            'std',
 
26759
            'sum',
 
26760
            'var'
 
26761
          ]
 
26762
        };
 
26763
 
 
26764
 
 
26765
/***/ },
 
26766
/* 296 */
 
26767
/***/ function(module, exports, __webpack_require__) {
 
26768
 
 
26769
        module.exports = {
 
26770
          'name': 'std',
 
26771
          'category': 'Statistics',
 
26772
          'syntax': [
 
26773
            'std(a, b, c, ...)',
 
26774
            'std(A)',
 
26775
            'std(A, normalization)'
 
26776
          ],
 
26777
          'description': 'Compute the standard deviation of all values, defined as std(A) = sqrt(var(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',
 
26778
          'examples': [
 
26779
            'std(2, 4, 6)',
 
26780
            'std([2, 4, 6, 8])',
 
26781
            'std([2, 4, 6, 8], "uncorrected")',
 
26782
            'std([2, 4, 6, 8], "biased")',
 
26783
            'std([1, 2, 3; 4, 5, 6])'
 
26784
          ],
 
26785
          'seealso': [
 
26786
            'max',
 
26787
            'mean',
 
26788
            'min',
 
26789
            'median',
 
26790
            'min',
 
26791
            'prod',
 
26792
            'sum',
 
26793
            'var'
 
26794
          ]
 
26795
        };
 
26796
 
 
26797
 
 
26798
/***/ },
 
26799
/* 297 */
 
26800
/***/ function(module, exports, __webpack_require__) {
 
26801
 
 
26802
        module.exports = {
 
26803
          'name': 'sum',
 
26804
          'category': 'Statistics',
 
26805
          'syntax': [
 
26806
            'sum(a, b, c, ...)',
 
26807
            'sum(A)'
 
26808
          ],
 
26809
          'description': 'Compute the sum of all values.',
 
26810
          'examples': [
 
26811
            'sum(2, 3, 4, 1)',
 
26812
            'sum([2, 3, 4, 1])',
 
26813
            'sum([2, 5; 4, 3])'
 
26814
          ],
 
26815
          'seealso': [
 
26816
            'max',
 
26817
            'mean',
 
26818
            'median',
 
26819
            'min',
 
26820
            'prod',
 
26821
            'std',
 
26822
            'sum',
 
26823
            'var'
 
26824
          ]
 
26825
        };
 
26826
 
 
26827
 
 
26828
/***/ },
 
26829
/* 298 */
 
26830
/***/ function(module, exports, __webpack_require__) {
 
26831
 
 
26832
        module.exports = {
 
26833
          'name': 'var',
 
26834
          'category': 'Statistics',
 
26835
          'syntax': [
 
26836
            'var(a, b, c, ...)',
 
26837
            'var(A)',
 
26838
            'var(A, normalization)'
 
26839
          ],
 
26840
          'description': 'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',
 
26841
          'examples': [
 
26842
            'var(2, 4, 6)',
 
26843
            'var([2, 4, 6, 8])',
 
26844
            'var([2, 4, 6, 8], "uncorrected")',
 
26845
            'var([2, 4, 6, 8], "biased")',
 
26846
            'var([1, 2, 3; 4, 5, 6])'
 
26847
          ],
 
26848
          'seealso': [
 
26849
            'max',
 
26850
            'mean',
 
26851
            'min',
 
26852
            'median',
 
26853
            'min',
 
26854
            'prod',
 
26855
            'std',
 
26856
            'sum'
 
26857
          ]
 
26858
        };
 
26859
 
 
26860
 
 
26861
/***/ },
 
26862
/* 299 */
 
26863
/***/ function(module, exports, __webpack_require__) {
 
26864
 
 
26865
        module.exports = {
 
26866
          'name': 'acos',
 
26867
          'category': 'Trigonometry',
 
26868
          'syntax': [
 
26869
            'acos(x)'
 
26870
          ],
 
26871
          'description': 'Compute the inverse cosine of a value in radians.',
 
26872
          'examples': [
 
26873
            'acos(0.5)',
 
26874
            'acos(cos(2.3))'
 
26875
          ],
 
26876
          'seealso': [
 
26877
            'cos',
 
26878
            'atan',
 
26879
            'asin'
 
26880
          ]
 
26881
        };
 
26882
 
 
26883
 
 
26884
/***/ },
 
26885
/* 300 */
 
26886
/***/ function(module, exports, __webpack_require__) {
 
26887
 
 
26888
        module.exports = {
 
26889
          'name': 'acosh',
 
26890
          'category': 'Trigonometry',
 
26891
          'syntax': [
 
26892
            'acosh(x)'
 
26893
          ],
 
26894
          'description': 'Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.',
 
26895
          'examples': [
 
26896
            'acosh(1.5)'
 
26897
          ],
 
26898
          'seealso': [
 
26899
            'cosh',
 
26900
            'asinh',
 
26901
            'atanh'
 
26902
          ]
 
26903
        };
 
26904
 
 
26905
/***/ },
 
26906
/* 301 */
 
26907
/***/ function(module, exports, __webpack_require__) {
 
26908
 
 
26909
        module.exports = {
 
26910
          'name': 'acot',
 
26911
          'category': 'Trigonometry',
 
26912
          'syntax': [
 
26913
            'acot(x)'
 
26914
          ],
 
26915
          'description': 'Calculate the inverse cotangent of a value.',
 
26916
          'examples': [
 
26917
            'acot(0.5)',
 
26918
            'acot(cot(0.5))',
 
26919
            'acot(2)'
 
26920
          ],
 
26921
          'seealso': [
 
26922
            'cot',
 
26923
            'atan'
 
26924
          ]
 
26925
        };
 
26926
 
 
26927
 
 
26928
/***/ },
 
26929
/* 302 */
 
26930
/***/ function(module, exports, __webpack_require__) {
 
26931
 
 
26932
        module.exports = {
 
26933
          'name': 'acoth',
 
26934
          'category': 'Trigonometry',
 
26935
          'syntax': [
 
26936
            'acoth(x)'
 
26937
          ],
 
26938
          'description': 'Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.',
 
26939
          'examples': [
 
26940
            'acoth(0.5)'
 
26941
          ],
 
26942
          'seealso': [
 
26943
            'acsch',
 
26944
            'asech'
 
26945
          ]
 
26946
        };
 
26947
 
 
26948
/***/ },
 
26949
/* 303 */
 
26950
/***/ function(module, exports, __webpack_require__) {
 
26951
 
 
26952
        module.exports = {
 
26953
          'name': 'acsc',
 
26954
          'category': 'Trigonometry',
 
26955
          'syntax': [
 
26956
            'acsc(x)'
 
26957
          ],
 
26958
          'description': 'Calculate the inverse cotangent of a value.',
 
26959
          'examples': [
 
26960
            'acsc(0.5)',
 
26961
            'acsc(csc(0.5))',
 
26962
            'acsc(2)'
 
26963
          ],
 
26964
          'seealso': [
 
26965
            'csc',
 
26966
            'asin',
 
26967
            'asec'
 
26968
          ]
 
26969
        };
 
26970
 
 
26971
 
 
26972
/***/ },
 
26973
/* 304 */
 
26974
/***/ function(module, exports, __webpack_require__) {
 
26975
 
 
26976
        module.exports = {
 
26977
          'name': 'acsch',
 
26978
          'category': 'Trigonometry',
 
26979
          'syntax': [
 
26980
            'acsch(x)'
 
26981
          ],
 
26982
          'description': 'Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.',
 
26983
          'examples': [
 
26984
            'acsch(0.5)'
 
26985
          ],
 
26986
          'seealso': [
 
26987
            'asech',
 
26988
            'acoth'
 
26989
          ]
 
26990
        };
 
26991
 
 
26992
 
 
26993
/***/ },
 
26994
/* 305 */
 
26995
/***/ function(module, exports, __webpack_require__) {
 
26996
 
 
26997
        module.exports = {
 
26998
          'name': 'asec',
 
26999
          'category': 'Trigonometry',
 
27000
          'syntax': [
 
27001
            'asec(x)'
 
27002
          ],
 
27003
          'description': 'Calculate the inverse secant of a value.',
 
27004
          'examples': [
 
27005
            'asec(0.5)',
 
27006
            'asec(sec(0.5))',
 
27007
            'asec(2)'
 
27008
          ],
 
27009
          'seealso': [
 
27010
            'acos',
 
27011
            'acot',
 
27012
            'acsc'
 
27013
          ]
 
27014
        };
 
27015
 
 
27016
 
 
27017
/***/ },
 
27018
/* 306 */
 
27019
/***/ function(module, exports, __webpack_require__) {
 
27020
 
 
27021
        module.exports = {
 
27022
          'name': 'asech',
 
27023
          'category': 'Trigonometry',
 
27024
          'syntax': [
 
27025
            'asech(x)'
 
27026
          ],
 
27027
          'description': 'Calculate the inverse secant of a value.',
 
27028
          'examples': [
 
27029
            'asech(0.5)'
 
27030
          ],
 
27031
          'seealso': [
 
27032
            'acsch',
 
27033
            'acoth'
 
27034
          ]
 
27035
        };
 
27036
 
 
27037
 
 
27038
/***/ },
 
27039
/* 307 */
 
27040
/***/ function(module, exports, __webpack_require__) {
 
27041
 
 
27042
        module.exports = {
 
27043
          'name': 'asin',
 
27044
          'category': 'Trigonometry',
 
27045
          'syntax': [
 
27046
            'asin(x)'
 
27047
          ],
 
27048
          'description': 'Compute the inverse sine of a value in radians.',
 
27049
          'examples': [
 
27050
            'asin(0.5)',
 
27051
            'asin(sin(2.3))'
 
27052
          ],
 
27053
          'seealso': [
 
27054
            'sin',
 
27055
            'acos',
 
27056
            'atan'
 
27057
          ]
 
27058
        };
 
27059
 
 
27060
 
 
27061
/***/ },
 
27062
/* 308 */
 
27063
/***/ function(module, exports, __webpack_require__) {
 
27064
 
 
27065
        module.exports = {
 
27066
          'name': 'asinh',
 
27067
          'category': 'Trigonometry',
 
27068
          'syntax': [
 
27069
            'asinh(x)'
 
27070
          ],
 
27071
          'description': 'Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.',
 
27072
          'examples': [
 
27073
            'asinh(0.5)'
 
27074
          ],
 
27075
          'seealso': [
 
27076
            'acosh',
 
27077
            'atanh'
 
27078
          ]
 
27079
        };
 
27080
 
 
27081
 
 
27082
/***/ },
 
27083
/* 309 */
 
27084
/***/ function(module, exports, __webpack_require__) {
 
27085
 
 
27086
        module.exports = {
 
27087
          'name': 'atan',
 
27088
          'category': 'Trigonometry',
 
27089
          'syntax': [
 
27090
            'atan(x)'
 
27091
          ],
 
27092
          'description': 'Compute the inverse tangent of a value in radians.',
 
27093
          'examples': [
 
27094
            'atan(0.5)',
 
27095
            'atan(tan(2.3))'
 
27096
          ],
 
27097
          'seealso': [
 
27098
            'tan',
 
27099
            'acos',
 
27100
            'asin'
 
27101
          ]
 
27102
        };
 
27103
 
 
27104
 
 
27105
/***/ },
 
27106
/* 310 */
 
27107
/***/ function(module, exports, __webpack_require__) {
 
27108
 
 
27109
        module.exports = {
 
27110
          'name': 'atanh',
 
27111
          'category': 'Trigonometry',
 
27112
          'syntax': [
 
27113
            'atanh(x)'
 
27114
          ],
 
27115
          'description': 'Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.',
 
27116
          'examples': [
 
27117
            'atanh(0.5)'
 
27118
          ],
 
27119
          'seealso': [
 
27120
            'acosh',
 
27121
            'asinh'
 
27122
          ]
 
27123
        };
 
27124
 
 
27125
 
 
27126
/***/ },
 
27127
/* 311 */
 
27128
/***/ function(module, exports, __webpack_require__) {
 
27129
 
 
27130
        module.exports = {
 
27131
          'name': 'atan2',
 
27132
          'category': 'Trigonometry',
 
27133
          'syntax': [
 
27134
            'atan2(y, x)'
 
27135
          ],
 
27136
          'description':
 
27137
              'Computes the principal value of the arc tangent of y/x in radians.',
 
27138
          'examples': [
 
27139
            'atan2(2, 2) / pi',
 
27140
            'angle = 60 deg in rad',
 
27141
            'x = cos(angle)',
 
27142
            'y = sin(angle)',
 
27143
            'atan2(y, x)'
 
27144
          ],
 
27145
          'seealso': [
 
27146
            'sin',
 
27147
            'cos',
 
27148
            'tan'
 
27149
          ]
 
27150
        };
 
27151
 
 
27152
 
 
27153
/***/ },
 
27154
/* 312 */
 
27155
/***/ function(module, exports, __webpack_require__) {
 
27156
 
 
27157
        module.exports = {
 
27158
          'name': 'cos',
 
27159
          'category': 'Trigonometry',
 
27160
          'syntax': [
 
27161
            'cos(x)'
 
27162
          ],
 
27163
          'description': 'Compute the cosine of x in radians.',
 
27164
          'examples': [
 
27165
            'cos(2)',
 
27166
            'cos(pi / 4) ^ 2',
 
27167
            'cos(180 deg)',
 
27168
            'cos(60 deg)',
 
27169
            'sin(0.2)^2 + cos(0.2)^2'
 
27170
          ],
 
27171
          'seealso': [
 
27172
            'acos',
 
27173
            'sin',
 
27174
            'tan'
 
27175
          ]
 
27176
        };
 
27177
 
 
27178
 
 
27179
/***/ },
 
27180
/* 313 */
 
27181
/***/ function(module, exports, __webpack_require__) {
 
27182
 
 
27183
        module.exports = {
 
27184
          'name': 'cosh',
 
27185
          'category': 'Trigonometry',
 
27186
          'syntax': [
 
27187
            'cosh(x)'
 
27188
          ],
 
27189
          'description': 'Compute the hyperbolic cosine of x in radians.',
 
27190
          'examples': [
 
27191
            'cosh(0.5)'
 
27192
          ],
 
27193
          'seealso': [
 
27194
            'sinh',
 
27195
            'tanh',
 
27196
            'coth'
 
27197
          ]
 
27198
        };
 
27199
 
 
27200
 
 
27201
/***/ },
 
27202
/* 314 */
 
27203
/***/ function(module, exports, __webpack_require__) {
 
27204
 
 
27205
        module.exports = {
 
27206
          'name': 'cot',
 
27207
          'category': 'Trigonometry',
 
27208
          'syntax': [
 
27209
            'cot(x)'
 
27210
          ],
 
27211
          'description': 'Compute the cotangent of x in radians. Defined as 1/tan(x)',
 
27212
          'examples': [
 
27213
            'cot(2)',
 
27214
            '1 / tan(2)'
 
27215
          ],
 
27216
          'seealso': [
 
27217
            'sec',
 
27218
            'csc',
 
27219
            'tan'
 
27220
          ]
 
27221
        };
 
27222
 
 
27223
 
 
27224
/***/ },
 
27225
/* 315 */
 
27226
/***/ function(module, exports, __webpack_require__) {
 
27227
 
 
27228
        module.exports = {
 
27229
          'name': 'coth',
 
27230
          'category': 'Trigonometry',
 
27231
          'syntax': [
 
27232
            'coth(x)'
 
27233
          ],
 
27234
          'description': 'Compute the hyperbolic cotangent of x in radians.',
 
27235
          'examples': [
 
27236
            'coth(2)',
 
27237
            '1 / tanh(2)'
 
27238
          ],
 
27239
          'seealso': [
 
27240
            'sech',
 
27241
            'csch',
 
27242
            'tanh'
 
27243
          ]
 
27244
        };
 
27245
 
 
27246
 
 
27247
/***/ },
 
27248
/* 316 */
 
27249
/***/ function(module, exports, __webpack_require__) {
 
27250
 
 
27251
        module.exports = {
 
27252
          'name': 'csc',
 
27253
          'category': 'Trigonometry',
 
27254
          'syntax': [
 
27255
            'csc(x)'
 
27256
          ],
 
27257
          'description': 'Compute the cosecant of x in radians. Defined as 1/sin(x)',
 
27258
          'examples': [
 
27259
            'csc(2)',
 
27260
            '1 / sin(2)'
 
27261
          ],
 
27262
          'seealso': [
 
27263
            'sec',
 
27264
            'cot',
 
27265
            'sin'
 
27266
          ]
 
27267
        };
 
27268
 
 
27269
 
 
27270
/***/ },
 
27271
/* 317 */
 
27272
/***/ function(module, exports, __webpack_require__) {
 
27273
 
 
27274
        module.exports = {
 
27275
          'name': 'csch',
 
27276
          'category': 'Trigonometry',
 
27277
          'syntax': [
 
27278
            'csch(x)'
 
27279
          ],
 
27280
          'description': 'Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)',
 
27281
          'examples': [
 
27282
            'csch(2)',
 
27283
            '1 / sinh(2)'
 
27284
          ],
 
27285
          'seealso': [
 
27286
            'sech',
 
27287
            'coth',
 
27288
            'sinh'
 
27289
          ]
 
27290
        };
 
27291
 
 
27292
 
 
27293
/***/ },
 
27294
/* 318 */
 
27295
/***/ function(module, exports, __webpack_require__) {
 
27296
 
 
27297
        module.exports = {
 
27298
          'name': 'sec',
 
27299
          'category': 'Trigonometry',
 
27300
          'syntax': [
 
27301
            'sec(x)'
 
27302
          ],
 
27303
          'description': 'Compute the secant of x in radians. Defined as 1/cos(x)',
 
27304
          'examples': [
 
27305
            'sec(2)',
 
27306
            '1 / cos(2)'
 
27307
          ],
 
27308
          'seealso': [
 
27309
            'cot',
 
27310
            'csc',
 
27311
            'cos'
 
27312
          ]
 
27313
        };
 
27314
 
 
27315
 
 
27316
/***/ },
 
27317
/* 319 */
 
27318
/***/ function(module, exports, __webpack_require__) {
 
27319
 
 
27320
        module.exports = {
 
27321
          'name': 'sech',
 
27322
          'category': 'Trigonometry',
 
27323
          'syntax': [
 
27324
            'sech(x)'
 
27325
          ],
 
27326
          'description': 'Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)',
 
27327
          'examples': [
 
27328
            'sech(2)',
 
27329
            '1 / cosh(2)'
 
27330
          ],
 
27331
          'seealso': [
 
27332
            'coth',
 
27333
            'csch',
 
27334
            'cosh'
 
27335
          ]
 
27336
        };
 
27337
 
 
27338
 
 
27339
/***/ },
 
27340
/* 320 */
 
27341
/***/ function(module, exports, __webpack_require__) {
 
27342
 
 
27343
        module.exports = {
 
27344
          'name': 'sin',
 
27345
          'category': 'Trigonometry',
 
27346
          'syntax': [
 
27347
            'sin(x)'
 
27348
          ],
 
27349
          'description': 'Compute the sine of x in radians.',
 
27350
          'examples': [
 
27351
            'sin(2)',
 
27352
            'sin(pi / 4) ^ 2',
 
27353
            'sin(90 deg)',
 
27354
            'sin(30 deg)',
 
27355
            'sin(0.2)^2 + cos(0.2)^2'
 
27356
          ],
 
27357
          'seealso': [
 
27358
            'asin',
 
27359
            'cos',
 
27360
            'tan'
 
27361
          ]
 
27362
        };
 
27363
 
 
27364
 
 
27365
/***/ },
 
27366
/* 321 */
 
27367
/***/ function(module, exports, __webpack_require__) {
 
27368
 
 
27369
        module.exports = {
 
27370
          'name': 'sinh',
 
27371
          'category': 'Trigonometry',
 
27372
          'syntax': [
 
27373
            'sinh(x)'
 
27374
          ],
 
27375
          'description': 'Compute the hyperbolic sine of x in radians.',
 
27376
          'examples': [
 
27377
            'sinh(0.5)'
 
27378
          ],
 
27379
          'seealso': [
 
27380
            'cosh',
 
27381
            'tanh'
 
27382
          ]
 
27383
        };
 
27384
 
 
27385
 
 
27386
/***/ },
 
27387
/* 322 */
 
27388
/***/ function(module, exports, __webpack_require__) {
 
27389
 
 
27390
        module.exports = {
 
27391
          'name': 'tan',
 
27392
          'category': 'Trigonometry',
 
27393
          'syntax': [
 
27394
            'tan(x)'
 
27395
          ],
 
27396
          'description': 'Compute the tangent of x in radians.',
 
27397
          'examples': [
 
27398
            'tan(0.5)',
 
27399
            'sin(0.5) / cos(0.5)',
 
27400
            'tan(pi / 4)',
 
27401
            'tan(45 deg)'
 
27402
          ],
 
27403
          'seealso': [
 
27404
            'atan',
 
27405
            'sin',
 
27406
            'cos'
 
27407
          ]
 
27408
        };
 
27409
 
 
27410
 
 
27411
/***/ },
 
27412
/* 323 */
 
27413
/***/ function(module, exports, __webpack_require__) {
 
27414
 
 
27415
        module.exports = {
 
27416
          'name': 'tanh',
 
27417
          'category': 'Trigonometry',
 
27418
          'syntax': [
 
27419
            'tanh(x)'
 
27420
          ],
 
27421
          'description': 'Compute the hyperbolic tangent of x in radians.',
 
27422
          'examples': [
 
27423
            'tanh(0.5)',
 
27424
            'sinh(0.5) / cosh(0.5)'
 
27425
          ],
 
27426
          'seealso': [
 
27427
            'sinh',
 
27428
            'cosh'
 
27429
          ]
 
27430
        };
 
27431
 
 
27432
 
 
27433
/***/ },
 
27434
/* 324 */
 
27435
/***/ function(module, exports, __webpack_require__) {
 
27436
 
 
27437
        module.exports = {
 
27438
          'name': 'to',
 
27439
          'category': 'Units',
 
27440
          'syntax': [
 
27441
            'x to unit',
 
27442
            'to(x, unit)'
 
27443
          ],
 
27444
          'description': 'Change the unit of a value.',
 
27445
          'examples': [
 
27446
            '5 inch to cm',
 
27447
            '3.2kg to g',
 
27448
            '16 bytes in bits'
 
27449
          ],
 
27450
          'seealso': []
 
27451
        };
 
27452
 
 
27453
 
 
27454
/***/ },
 
27455
/* 325 */
 
27456
/***/ function(module, exports, __webpack_require__) {
 
27457
 
 
27458
        module.exports = {
 
27459
          'name': 'clone',
 
27460
          'category': 'Utils',
 
27461
          'syntax': [
 
27462
            'clone(x)'
 
27463
          ],
 
27464
          'description': 'Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices',
 
27465
          'examples': [
 
27466
            'clone(3.5)',
 
27467
            'clone(2 - 4i)',
 
27468
            'clone(45 deg)',
 
27469
            'clone([1, 2; 3, 4])',
 
27470
            'clone("hello world")'
 
27471
          ],
 
27472
          'seealso': []
 
27473
        };
 
27474
 
 
27475
 
 
27476
/***/ },
 
27477
/* 326 */
 
27478
/***/ function(module, exports, __webpack_require__) {
 
27479
 
 
27480
        module.exports = {
 
27481
          'name': 'map',
 
27482
          'category': 'Utils',
 
27483
          'syntax': [
 
27484
            'map(x, callback)'
 
27485
          ],
 
27486
          'description': 'Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.',
 
27487
          'examples': [
 
27488
            'map([1, 2, 3], function(val) { return value * value })'
 
27489
          ],
 
27490
          'seealso': ['filter', 'forEach']
 
27491
        };
 
27492
 
 
27493
 
 
27494
/***/ },
 
27495
/* 327 */
 
27496
/***/ function(module, exports, __webpack_require__) {
 
27497
 
 
27498
        module.exports = {
 
27499
          'name': 'filter',
 
27500
          'category': 'Utils',
 
27501
          'syntax': [
 
27502
            'filter(x, test)'
 
27503
          ],
 
27504
          'description': 'Filter items in a matrix.',
 
27505
          'examples': [
 
27506
            'isPositive(x) = x > 0',
 
27507
            'filter([6, -2, -1, 4, 3], isPositive)',
 
27508
            'filter([6, -2, 0, 1, 0], x != 0)'
 
27509
          ],
 
27510
          'seealso': ['sort', 'map', 'forEach']
 
27511
        };
 
27512
 
 
27513
 
 
27514
/***/ },
 
27515
/* 328 */
 
27516
/***/ function(module, exports, __webpack_require__) {
 
27517
 
 
27518
        module.exports = {
 
27519
          'name': 'forEach',
 
27520
          'category': 'Utils',
 
27521
          'syntax': [
 
27522
            'forEach(x, callback)'
 
27523
          ],
 
27524
          'description': 'Iterates over all elements of a matrix/array, and executes the given callback function.',
 
27525
          'examples': [
 
27526
            'forEach([1, 2, 3], function(val) { console.log(val) })'
 
27527
          ],
 
27528
          'seealso': ['map', 'sort', 'filter']
 
27529
        };
 
27530
 
 
27531
 
 
27532
/***/ },
 
27533
/* 329 */
 
27534
/***/ function(module, exports, __webpack_require__) {
 
27535
 
 
27536
        module.exports = {
 
27537
          'name': 'format',
 
27538
          'category': 'Utils',
 
27539
          'syntax': [
 
27540
            'format(value)',
 
27541
            'format(value, precision)'
 
27542
          ],
 
27543
          'description': 'Format a value of any type as string.',
 
27544
          'examples': [
 
27545
            'format(2.3)',
 
27546
            'format(3 - 4i)',
 
27547
            'format([])',
 
27548
            'format(pi, 3)'
 
27549
          ],
 
27550
          'seealso': ['print']
 
27551
        };
 
27552
 
 
27553
 
 
27554
/***/ },
 
27555
/* 330 */
 
27556
/***/ function(module, exports, __webpack_require__) {
 
27557
 
 
27558
        module.exports = {
 
27559
          'name': 'import',
 
27560
          'category': 'Utils',
 
27561
          'syntax': [
 
27562
            'import(string)'
 
27563
          ],
 
27564
          'description': 'Import functions from a file.',
 
27565
          'examples': [
 
27566
            'import("numbers")',
 
27567
            'import("./mylib.js")'
 
27568
          ],
 
27569
          'seealso': []
 
27570
        };
 
27571
 
 
27572
 
 
27573
/***/ },
 
27574
/* 331 */
 
27575
/***/ function(module, exports, __webpack_require__) {
 
27576
 
 
27577
        module.exports = {
 
27578
          'name': 'sort',
 
27579
          'category': 'Utils',
 
27580
          'syntax': [
 
27581
            'sort(x)',
 
27582
            'sort(x, compare)'
 
27583
          ],
 
27584
          'description': 'Sort the items in a matrix. Compare can be a string "asc" or "desc", or a custom sort function.',
 
27585
          'examples': [
 
27586
            'sort([5, 10, 1])',
 
27587
            'sort(["C", "B", "A", "D"])',
 
27588
            'sortByLength(a, b) = size(a)[1] - size(b)[1]',
 
27589
            'sort(["Langdon", "Tom", "Sara"], sortByLength)'
 
27590
          ],
 
27591
          'seealso': ['map', 'filter', 'forEach']
 
27592
        };
 
27593
 
 
27594
 
 
27595
/***/ },
 
27596
/* 332 */
 
27597
/***/ function(module, exports, __webpack_require__) {
 
27598
 
 
27599
        module.exports = {
 
27600
          'name': 'typeof',
 
27601
          'category': 'Utils',
 
27602
          'syntax': [
 
27603
            'typeof(x)'
 
27604
          ],
 
27605
          'description': 'Get the type of a variable.',
 
27606
          'examples': [
 
27607
            'typeof(3.5)',
 
27608
            'typeof(2 - 4i)',
 
27609
            'typeof(45 deg)',
 
27610
            'typeof("hello world")'
 
27611
          ],
 
27612
          'seealso': []
 
27613
        };
 
27614
 
 
27615
 
 
27616
/***/ },
 
27617
/* 333 */
 
27618
/***/ function(module, exports, __webpack_require__) {
 
27619
 
 
27620
        'use strict';
 
27621
 
 
27622
        // NOTE: distribution is NOT added to math.distribution but returned by the factory function
 
27623
        // TODO: rethink math.distribution
 
27624
 
 
27625
        module.exports = function (math) {
 
27626
          var Matrix = __webpack_require__(10);
 
27627
          var array = __webpack_require__(165);
 
27628
          var collection = __webpack_require__(14);
 
27629
          var isCollection = collection.isCollection;
 
27630
 
 
27631
          /**
 
27632
           * Create a distribution object with a set of random functions for given
 
27633
           * random distribution.
 
27634
           *
 
27635
           * Syntax:
 
27636
           *
 
27637
           *     math.distribution(name)
 
27638
           *
 
27639
           * Examples:
 
27640
           *
 
27641
           *     var normalDist = math.distribution('normal'); // create a normal distribution
 
27642
           *     normalDist.random(0, 10);                      // get a random value between 0 and 10
 
27643
           *
 
27644
           * See also:
 
27645
           *
 
27646
           *     random, randomInt, pickRandom
 
27647
           *
 
27648
           * @param {String} name   Name of a distribution. Choose from 'uniform', 'normal'.
 
27649
           * @return {Object}       Returns a distribution object containing functions:
 
27650
           *                        `random([size] [, min] [, max])`,
 
27651
           *                        `randomInt([min] [, max])`,
 
27652
           *                        `pickRandom(array)`
 
27653
           */
 
27654
          function distribution(name) {
 
27655
            if (!distributions.hasOwnProperty(name))
 
27656
              throw new Error('Unknown distribution ' + name);
 
27657
 
 
27658
            var args = Array.prototype.slice.call(arguments, 1),
 
27659
                distribution = distributions[name].apply(this, args);
 
27660
 
 
27661
            return (function(distribution) {
 
27662
 
 
27663
              // This is the public API for all distributions
 
27664
              var randFunctions = {
 
27665
 
 
27666
                random: function(arg1, arg2, arg3) {
 
27667
                  var size, min, max;
 
27668
                  if (arguments.length > 3) {
 
27669
                    throw new math.error.ArgumentsError('random', arguments.length, 0, 3);
 
27670
 
 
27671
                  // `random(max)` or `random(size)`
 
27672
                  } else if (arguments.length === 1) {
 
27673
                    if (isCollection(arg1)) {
 
27674
                      size = arg1;
 
27675
                    }
 
27676
                    else {
 
27677
                      max = arg1;
 
27678
                    }
 
27679
                  // `random(min, max)` or `random(size, max)`
 
27680
                  } else if (arguments.length === 2) {
 
27681
                    if (isCollection(arg1)) {
 
27682
                      size = arg1;
 
27683
                      max = arg2;
 
27684
                    }
 
27685
                    else {
 
27686
                      min = arg1;
 
27687
                      max = arg2;
 
27688
                    }
 
27689
                  // `random(size, min, max)`
 
27690
                  } else {
 
27691
                    size = arg1;
 
27692
                    min = arg2;
 
27693
                    max = arg3;
 
27694
                  }
 
27695
 
 
27696
                  // TODO: validate type of min, max, and size
 
27697
 
 
27698
                  if (max === undefined) max = 1;
 
27699
                  if (min === undefined) min = 0;
 
27700
                  if (size !== undefined) {
 
27701
                    var res = _randomDataForMatrix(size.valueOf(), min, max, _random);
 
27702
                    return (size instanceof Matrix) ? new Matrix(res) : res;
 
27703
                  }
 
27704
                  else return _random(min, max);
 
27705
                },
 
27706
 
 
27707
                randomInt: function(arg1, arg2, arg3) {
 
27708
                  var size, min, max;
 
27709
                  if (arguments.length > 3 || arguments.length < 1)
 
27710
                    throw new math.error.ArgumentsError('randomInt', arguments.length, 1, 3);
 
27711
 
 
27712
                  // `random(max)` or `random(size)`
 
27713
                  else if (arguments.length === 1)
 
27714
                    if (isCollection(arg1)) {
 
27715
                      size = arg1;
 
27716
                    }
 
27717
                    else {
 
27718
                      max = arg1;
 
27719
                    }
 
27720
                  // `randomInt(min, max)` or `randomInt(size, max)`
 
27721
                  else if (arguments.length === 2) {
 
27722
                    if (isCollection(arg1)) {
 
27723
                      size = arg1;
 
27724
                      max = arg2;
 
27725
                    }
 
27726
                    else {
 
27727
                      min = arg1;
 
27728
                      max = arg2;
 
27729
                    }
 
27730
                  // `randomInt(size, min, max)`
 
27731
                  } else {
 
27732
                    size = arg1;
 
27733
                    min = arg2;
 
27734
                    max = arg3;
 
27735
                  }
 
27736
 
 
27737
                  // TODO: validate type of min, max, and size
 
27738
 
 
27739
                  if (min === undefined) min = 0;
 
27740
                  if (size !== undefined) {
 
27741
                    var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);
 
27742
                    return (size instanceof Matrix) ? new Matrix(res) : res;
 
27743
                  }
 
27744
                  else return _randomInt(min, max);
 
27745
                },
 
27746
 
 
27747
                pickRandom: function(possibles) {
 
27748
                  if (arguments.length !== 1) {
 
27749
                    throw new math.error.ArgumentsError('pickRandom', arguments.length, 1);
 
27750
                  }
 
27751
                  if (possibles instanceof Matrix) {
 
27752
                    possibles = possibles.valueOf(); // get Array
 
27753
                  }
 
27754
                  else if (!Array.isArray(possibles)) {
 
27755
                    throw new math.error.UnsupportedTypeError('pickRandom', math['typeof'](possibles));
 
27756
                  }
 
27757
 
 
27758
                  if (array.size(possibles).length > 1) {
 
27759
                    throw new Error('Only one dimensional vectors supported');
 
27760
                  }
 
27761
 
 
27762
                  // TODO: add support for multi dimensional matrices
 
27763
                  return possibles[Math.floor(Math.random() * possibles.length)];
 
27764
                }
 
27765
 
 
27766
              };
 
27767
 
 
27768
              var _random = function(min, max) {
 
27769
                return min + distribution() * (max - min);
 
27770
              };
 
27771
 
 
27772
              var _randomInt = function(min, max) {
 
27773
                return Math.floor(min + distribution() * (max - min));
 
27774
              };
 
27775
 
 
27776
              // This is a function for generating a random matrix recursively.
 
27777
              var _randomDataForMatrix = function(size, min, max, randFunc) {
 
27778
                var data = [], length, i;
 
27779
                size = size.slice(0);
 
27780
 
 
27781
                if (size.length > 1) {
 
27782
                  for (i = 0, length = size.shift(); i < length; i++)
 
27783
                    data.push(_randomDataForMatrix(size, min, max, randFunc));
 
27784
                } else {
 
27785
                  for (i = 0, length = size.shift(); i < length; i++)
 
27786
                    data.push(randFunc(min, max));
 
27787
                }
 
27788
 
 
27789
                return data;
 
27790
              };
 
27791
 
 
27792
              return randFunctions;
 
27793
 
 
27794
            })(distribution);
 
27795
          };
 
27796
 
 
27797
          // Each distribution is a function that takes no argument and when called returns
 
27798
          // a number between 0 and 1.
 
27799
          var distributions = {
 
27800
 
 
27801
            uniform: function() {
 
27802
              return Math.random;
 
27803
            },
 
27804
 
 
27805
            // Implementation of normal distribution using Box-Muller transform
 
27806
            // ref : http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform
 
27807
            // We take : mean = 0.5, standard deviation = 1/6
 
27808
            // so that 99.7% values are in [0, 1].
 
27809
            normal: function() {
 
27810
              return function() {
 
27811
                var u1, u2,
 
27812
                    picked = -1;
 
27813
                // We reject values outside of the interval [0, 1]
 
27814
                // TODO: check if it is ok to do that?
 
27815
                while (picked < 0 || picked > 1) {
 
27816
                  u1 = Math.random();
 
27817
                  u2 = Math.random();
 
27818
                  picked = 1/6 * Math.pow(-2 * Math.log(u1), 0.5) * Math.cos(2 * Math.PI * u2) + 0.5;
 
27819
                }
 
27820
                return picked;
 
27821
              }
 
27822
            }
 
27823
          };
 
27824
 
 
27825
          return distribution;
 
27826
        };
 
27827
 
 
27828
 
 
27829
/***/ },
 
27830
/* 334 */
 
27831
/***/ function(module, exports, __webpack_require__) {
 
27832
 
 
27833
        'use strict';
 
27834
 
 
27835
        /**
 
27836
         * Determine the type of a variable
 
27837
         *
 
27838
         *     type(x)
 
27839
         *
 
27840
         * @param {*} x
 
27841
         * @return {String} type  Lower case type, for example 'number', 'string',
 
27842
         *                        'array', 'date'.
 
27843
         */
 
27844
        exports.type = function(x) {
 
27845
          var type = typeof x;
 
27846
 
 
27847
          if (type === 'object') {
 
27848
            if (x === null)           return 'null';
 
27849
            if (x instanceof Boolean) return 'boolean';
 
27850
            if (x instanceof Number)  return 'number';
 
27851
            if (x instanceof String)  return 'string';
 
27852
            if (Array.isArray(x))     return 'array';
 
27853
            if (x instanceof Date)    return 'date';
 
27854
            if (x instanceof Function)return 'function';
 
27855
            if (x instanceof RegExp)  return 'regexp';
 
27856
          }
 
27857
 
 
27858
          return type;
 
27859
        };
 
27860
 
 
27861
 
 
27862
/***/ },
 
27863
/* 335 */
 
27864
/***/ function(module, exports, __webpack_require__) {
 
27865
 
 
27866
        // function utils
 
27867
 
 
27868
        /*
 
27869
         * Memoize a given function by caching the computed result.
 
27870
         * The cache of a memoized function can be cleared by deleting the `cache`
 
27871
         * property of the function.
 
27872
         *
 
27873
         * @param {function} fn   The function to be memoized. Must be a pure function.
 
27874
         * @return {function}     Returns the memoized function
 
27875
         */
 
27876
        exports.memoize = function(fn) {
 
27877
          return function memoize() {
 
27878
            if (typeof memoize.cache !== 'object') {
 
27879
              memoize.cache = {};
 
27880
            }
 
27881
 
 
27882
            var hash = JSON.stringify(arguments);
 
27883
            if (!(hash in memoize.cache)) {
 
27884
              return memoize.cache[hash] = fn.apply(fn, arguments);
 
27885
            }
 
27886
            return memoize.cache[hash];
 
27887
          };
 
27888
        };
 
27889
 
 
27890
 
 
27891
/***/ },
 
27892
/* 336 */
 
27893
/***/ function(module, exports, __webpack_require__) {
 
27894
 
 
27895
        var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v4.0.2 https://github.com/MikeMcl/decimal.js/LICENCE */
19937
27896
        ;(function (global) {
19938
27897
            'use strict';
19939
27898
 
19940
27899
 
19941
27900
            /*
19942
 
             *  decimal.js v4.0.1
 
27901
             *  decimal.js v4.0.2
19943
27902
             *  An arbitrary-precision Decimal type for JavaScript.
19944
27903
             *  https://github.com/MikeMcl/decimal.js
19945
27904
             *  Copyright (c) 2014 Michael Mclaughlin <M8ch88l@gmail.com>
20826
28785
            /*
20827
28786
             * Return the number of significant digits of this Decimal.
20828
28787
             *
20829
 
             * z {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
 
28788
             * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
20830
28789
             *
20831
28790
             */
20832
28791
            P['precision'] = P['sd'] = function (z) {
20833
28792
                var n = null,
20834
28793
                    x = this;
20835
28794
 
20836
 
                if ( z != n ) {
20837
 
 
20838
 
                    if ( z !== !!z && z !== 1 && z !== 0 ) {
20839
 
 
20840
 
                        // 'precision() argument not a boolean or binary digit: {z}'
20841
 
                        ifExceptionsThrow( x['constructor'], 'argument', z, 'precision', 1 );
20842
 
                    }
 
28795
                if ( z != n && z !== !!z && z !== 1 && z !== 0 ) {
 
28796
 
 
28797
                    // 'precision() argument not a boolean or binary digit: {z}'
 
28798
                    ifExceptionsThrow( x['constructor'], 'argument', z, 'precision', 1 );
20843
28799
                }
20844
28800
 
20845
28801
                if ( x['c'] ) {
21441
29397
             * ECMAScript compliant.
21442
29398
             *
21443
29399
             *   x is any value, including NaN.
21444
 
             *   n is any number, including �Infinity unless stated.
 
29400
             *   n is any number, including ï¿½Infinity unless stated.
21445
29401
             *
21446
29402
             *   pow( x, NaN )                           = NaN
21447
 
             *   pow( x, �0 )                            = 1
 
29403
             *   pow( x, ï¿½0 )                            = 1
21448
29404
 
21449
29405
             *   pow( NaN, nonzero )                     = NaN
21450
29406
             *   pow( abs(n) > 1, +Infinity )            = +Infinity
21451
29407
             *   pow( abs(n) > 1, -Infinity )            = +0
21452
 
             *   pow( abs(n) == 1, �Infinity )           = NaN
 
29408
             *   pow( abs(n) == 1, ï¿½Infinity )           = NaN
21453
29409
             *   pow( abs(n) < 1, +Infinity )            = +0
21454
29410
             *   pow( abs(n) < 1, -Infinity )            = +Infinity
21455
29411
             *   pow( +Infinity, n > 0 )                 = +Infinity
23617
31573
                            for ( ; i < n; ) {
23618
31574
                                v = a[i];
23619
31575
 
23620
 
                                // 0 >= v < 4294967296
 
31576
                                // 0 <= v < 4294967296
23621
31577
                                // Probability that v >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
23622
31578
                                if ( v >= 4.29e9 ) {
23623
31579
 
23647
31603
                                    crypto['randomBytes'](4).copy( a, i );
23648
31604
                                } else {
23649
31605
 
23650
 
                                    // 0 <= v <= 4289999999
 
31606
                                    // 0 <= v <= 2139999999
23651
31607
                                    // 0 <= ( v % 1e7 ) <= 9999999
23652
31608
                                    r.push( v % 1e7 );
23653
31609
                                    i += 4;
23999
31955
 
24000
31956
 
24001
31957
/***/ },
24002
 
/* 160 */
24003
 
/***/ function(module, exports, __webpack_require__) {
24004
 
 
24005
 
        'use strict';
24006
 
 
24007
 
        exports.array = __webpack_require__(153);
24008
 
        exports['boolean'] = __webpack_require__(175);
24009
 
        exports.number = __webpack_require__(4);
24010
 
        exports.bignumber = __webpack_require__(152);
24011
 
        exports.object = __webpack_require__(3);
24012
 
        exports.string = __webpack_require__(176);
24013
 
        exports.types = __webpack_require__(196);
24014
 
 
24015
 
 
24016
 
/***/ },
24017
 
/* 161 */
24018
 
/***/ function(module, exports, __webpack_require__) {
24019
 
 
24020
 
        'use strict';
24021
 
 
24022
 
        var Node = __webpack_require__(173),
24023
 
            object = __webpack_require__(3),
24024
 
            string = __webpack_require__(176),
24025
 
            collection = __webpack_require__(13),
24026
 
            util = __webpack_require__(160),
24027
 
 
24028
 
            isArray = Array.isArray,
24029
 
            isNode = Node.isNode;
24030
 
 
24031
 
        /**
24032
 
         * @constructor ArrayNode
24033
 
         * @extends {Node}
24034
 
         * Holds an 1-dimensional array with nodes
24035
 
         * @param {Node[]} [nodes]   1 dimensional array with nodes
24036
 
         */
24037
 
        function ArrayNode(nodes) {
24038
 
          if (!(this instanceof ArrayNode)) {
24039
 
            throw new SyntaxError('Constructor must be called with the new operator');
24040
 
          }
24041
 
 
24042
 
          this.nodes = nodes || [];
24043
 
 
24044
 
          // validate input
24045
 
          if (!isArray(this.nodes) || !this.nodes.every(isNode)) {
24046
 
            throw new TypeError('Array containing Nodes expected')
24047
 
          }
24048
 
        }
24049
 
 
24050
 
        ArrayNode.prototype = new Node();
24051
 
 
24052
 
        ArrayNode.prototype.type = 'ArrayNode';
24053
 
 
24054
 
        /**
24055
 
         * Compile the node to javascript code
24056
 
         * @param {Object} defs     Object which can be used to define functions
24057
 
         *                          or constants globally available for the compiled
24058
 
         *                          expression
24059
 
         * @private
24060
 
         */
24061
 
        ArrayNode.prototype._compile = function (defs) {
24062
 
          var asMatrix = (defs.math.config().matrix !== 'array');
24063
 
 
24064
 
          var nodes = this.nodes.map(function (node) {
24065
 
            return node._compile(defs);
24066
 
          });
24067
 
 
24068
 
          return (asMatrix ? 'math.matrix([' : '[') +
24069
 
              nodes.join(',') +
24070
 
              (asMatrix ? '])' : ']');
24071
 
        };
24072
 
 
24073
 
        /**
24074
 
         * Execute a callback for each of the child nodes of this node
24075
 
         * @param {function(child: Node, path: string, parent: Node)} callback
24076
 
         */
24077
 
        ArrayNode.prototype.forEach = function (callback) {
24078
 
          for (var i = 0; i < this.nodes.length; i++) {
24079
 
            var node = this.nodes[i];
24080
 
            callback(node, 'nodes[' + i + ']', this);
24081
 
          }
24082
 
        };
24083
 
 
24084
 
        /**
24085
 
         * Create a new ArrayNode having it's childs be the results of calling
24086
 
         * the provided callback function for each of the childs of the original node.
24087
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
24088
 
         * @returns {ArrayNode} Returns a transformed copy of the node
24089
 
         */
24090
 
        ArrayNode.prototype.map = function (callback) {
24091
 
          var nodes = [];
24092
 
          for (var i = 0; i < this.nodes.length; i++) {
24093
 
            nodes[i] = this._ifNode(callback(this.nodes[i], 'nodes[' + i + ']', this));
24094
 
          }
24095
 
          return new ArrayNode(nodes);
24096
 
        };
24097
 
 
24098
 
        /**
24099
 
         * Create a clone of this node, a shallow copy
24100
 
         * @return {ArrayNode}
24101
 
         */
24102
 
        ArrayNode.prototype.clone = function() {
24103
 
          return new ArrayNode(this.nodes.slice(0))
24104
 
        };
24105
 
 
24106
 
        /**
24107
 
         * Get string representation
24108
 
         * @return {String} str
24109
 
         * @override
24110
 
         */
24111
 
        ArrayNode.prototype.toString = function() {
24112
 
          return string.format(this.nodes);
24113
 
        };
24114
 
 
24115
 
        /**
24116
 
         * Get LaTeX representation
24117
 
         * @return {String} str
24118
 
         */
24119
 
        ArrayNode.prototype.toTex = function(type) {
24120
 
          type = type || 'bmatrix';
24121
 
          var s = '\\begin{' + type + '}';
24122
 
 
24123
 
          this.nodes.forEach(function(node) {
24124
 
            if (node.nodes) {
24125
 
              s += node.nodes.map(function(childNode) {
24126
 
                return childNode.toTex();
24127
 
              }).join('&');
24128
 
            }
24129
 
            else {
24130
 
              s += node.toTex();
24131
 
            }
24132
 
 
24133
 
            // new line
24134
 
            s += '\\\\';
24135
 
          });
24136
 
          s += '\\end{' + type + '}';
24137
 
          return s;
24138
 
        };
24139
 
 
24140
 
        module.exports = ArrayNode;
24141
 
 
24142
 
 
24143
 
/***/ },
24144
 
/* 162 */
24145
 
/***/ function(module, exports, __webpack_require__) {
24146
 
 
24147
 
        'use strict';
24148
 
 
24149
 
        var Node = __webpack_require__(173),
24150
 
            ArrayNode = __webpack_require__(161),
24151
 
 
24152
 
            keywords = __webpack_require__(314),
24153
 
 
24154
 
            latex = __webpack_require__(315),
24155
 
            isString = __webpack_require__(176).isString;
24156
 
 
24157
 
        /**
24158
 
         * @constructor AssignmentNode
24159
 
         * @extends {Node}
24160
 
         * Define a symbol, like "a = 3.2"
24161
 
         *
24162
 
         * @param {String} name       Symbol name
24163
 
         * @param {Node} expr         The expression defining the symbol
24164
 
         */
24165
 
        function AssignmentNode(name, expr) {
24166
 
          if (!(this instanceof AssignmentNode)) {
24167
 
            throw new SyntaxError('Constructor must be called with the new operator');
24168
 
          }
24169
 
 
24170
 
          // validate input
24171
 
          if (!isString(name))          throw new TypeError('String expected for parameter "name"');
24172
 
          if (!(expr instanceof Node))  throw new TypeError('Node expected for parameter "expr"');
24173
 
          if (name in keywords)         throw new Error('Illegal symbol name, "'  + name +  '" is a reserved keyword');
24174
 
 
24175
 
          this.name = name;
24176
 
          this.expr = expr;
24177
 
        }
24178
 
 
24179
 
        AssignmentNode.prototype = new Node();
24180
 
 
24181
 
        AssignmentNode.prototype.type = 'AssignmentNode';
24182
 
 
24183
 
        /**
24184
 
         * Compile the node to javascript code
24185
 
         * @param {Object} defs     Object which can be used to define functions
24186
 
         *                          or constants globally available for the compiled
24187
 
         *                          expression
24188
 
         * @private
24189
 
         */
24190
 
        AssignmentNode.prototype._compile = function (defs) {
24191
 
          return 'scope["' + this.name + '"] = ' + this.expr._compile(defs) + '';
24192
 
        };
24193
 
 
24194
 
 
24195
 
        /**
24196
 
         * Execute a callback for each of the child nodes of this node
24197
 
         * @param {function(child: Node, path: string, parent: Node)} callback
24198
 
         */
24199
 
        AssignmentNode.prototype.forEach = function (callback) {
24200
 
          callback(this.expr, 'expr', this);
24201
 
        };
24202
 
 
24203
 
        /**
24204
 
         * Create a new AssignmentNode having it's childs be the results of calling
24205
 
         * the provided callback function for each of the childs of the original node.
24206
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
24207
 
         * @returns {AssignmentNode} Returns a transformed copy of the node
24208
 
         */
24209
 
        AssignmentNode.prototype.map = function (callback) {
24210
 
          return new AssignmentNode(this.name, this._ifNode(callback(this.expr, 'expr', this)));
24211
 
        };
24212
 
 
24213
 
        /**
24214
 
         * Create a clone of this node, a shallow copy
24215
 
         * @return {AssignmentNode}
24216
 
         */
24217
 
        AssignmentNode.prototype.clone = function() {
24218
 
          return new AssignmentNode(this.name, this.expr);
24219
 
        };
24220
 
 
24221
 
        /**
24222
 
         * Get string representation
24223
 
         * @return {String}
24224
 
         */
24225
 
        AssignmentNode.prototype.toString = function() {
24226
 
          return this.name + ' = ' + this.expr.toString();
24227
 
        };
24228
 
 
24229
 
        /**
24230
 
         * Get LaTeX representation
24231
 
         * @return {String}
24232
 
         */
24233
 
        AssignmentNode.prototype.toTex = function() {
24234
 
          var brace;
24235
 
          if (this.expr instanceof ArrayNode) {
24236
 
            brace = ['\\mathbf{', '}'];
24237
 
          }
24238
 
          return latex.addBraces(latex.toSymbol(this.name), brace) + '=' +
24239
 
              latex.addBraces(this.expr.toTex());
24240
 
        };
24241
 
 
24242
 
        module.exports = AssignmentNode;
24243
 
 
24244
 
/***/ },
24245
 
/* 163 */
24246
 
/***/ function(module, exports, __webpack_require__) {
24247
 
 
24248
 
        'use strict';
24249
 
 
24250
 
        var Node = __webpack_require__(173);
24251
 
        var ResultSet = __webpack_require__(12);
24252
 
        var isBoolean = __webpack_require__(175).isBoolean;
24253
 
 
24254
 
        /**
24255
 
         * @constructor BlockNode
24256
 
         * @extends {Node}
24257
 
         * Holds a set with blocks
24258
 
         * @param {Array.<{node: Node} | {node: Node, visible: boolean}>} blocks
24259
 
         *            An array with blocks, where a block is constructed as an Object
24260
 
         *            with properties block, which is a Node, and visible, which is
24261
 
         *            a boolean. The property visible is optional and is true by default
24262
 
         */
24263
 
        function BlockNode(blocks) {
24264
 
          if (!(this instanceof BlockNode)) {
24265
 
            throw new SyntaxError('Constructor must be called with the new operator');
24266
 
          }
24267
 
 
24268
 
          // validate input, copy blocks
24269
 
          if (!Array.isArray(blocks)) throw new Error('Array expected');
24270
 
          this.blocks = blocks.map(function (block) {
24271
 
            var node    = block && block.node;
24272
 
            var visible = block && block.visible !== undefined ? block.visible : true;
24273
 
 
24274
 
            if (!(node instanceof Node))  throw new TypeError('Property "node" must be a Node');
24275
 
            if (!isBoolean(visible))      throw new TypeError('Property "visible" must be a boolean');
24276
 
 
24277
 
            return {
24278
 
              node: node,
24279
 
              visible: visible
24280
 
            }
24281
 
          });
24282
 
        }
24283
 
 
24284
 
        BlockNode.prototype = new Node();
24285
 
 
24286
 
        BlockNode.prototype.type = 'BlockNode';
24287
 
 
24288
 
        /**
24289
 
         * Compile the node to javascript code
24290
 
         * @param {Object} defs     Object which can be used to define functions
24291
 
         *                          or constants globally available for the compiled
24292
 
         *                          expression
24293
 
         * @return {String} js
24294
 
         * @private
24295
 
         */
24296
 
        BlockNode.prototype._compile = function (defs) {
24297
 
          defs.ResultSet = ResultSet;
24298
 
          var blocks = this.blocks.map(function (param) {
24299
 
            var js = param.node._compile(defs);
24300
 
            if (param.visible) {
24301
 
              return 'results.push(' + js + ');';
24302
 
            }
24303
 
            else {
24304
 
              return js + ';';
24305
 
            }
24306
 
          });
24307
 
 
24308
 
          return '(function () {' +
24309
 
              'var results = [];' +
24310
 
              blocks.join('') +
24311
 
              'return new ResultSet(results);' +
24312
 
              '})()';
24313
 
        };
24314
 
 
24315
 
        /**
24316
 
         * Execute a callback for each of the child blocks of this node
24317
 
         * @param {function(child: Node, path: string, parent: Node)} callback
24318
 
         */
24319
 
        BlockNode.prototype.forEach = function (callback) {
24320
 
          for (var i = 0; i < this.blocks.length; i++) {
24321
 
            callback(this.blocks[i].node, 'blocks[' + i + '].node', this);
24322
 
          }
24323
 
        };
24324
 
 
24325
 
        /**
24326
 
         * Create a new BlockNode having it's childs be the results of calling
24327
 
         * the provided callback function for each of the childs of the original node.
24328
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
24329
 
         * @returns {BlockNode} Returns a transformed copy of the node
24330
 
         */
24331
 
        BlockNode.prototype.map = function (callback) {
24332
 
          var blocks = [];
24333
 
          for (var i = 0; i < this.blocks.length; i++) {
24334
 
            var block = this.blocks[i];
24335
 
            var node = this._ifNode(callback(block.node, 'blocks[' + i + '].node', this));
24336
 
            blocks[i] = {
24337
 
              node: node,
24338
 
              visible: block.visible
24339
 
            };
24340
 
          }
24341
 
          return new BlockNode(blocks);
24342
 
        };
24343
 
 
24344
 
        /**
24345
 
         * Create a clone of this node, a shallow copy
24346
 
         * @return {BlockNode}
24347
 
         */
24348
 
        BlockNode.prototype.clone = function() {
24349
 
          var blocks = this.blocks.map(function(block) {
24350
 
            return {
24351
 
              node: block.node,
24352
 
              visible: block.visible
24353
 
            };
24354
 
          });
24355
 
 
24356
 
          return new BlockNode(blocks);
24357
 
        };
24358
 
 
24359
 
        /**
24360
 
         * Get string representation
24361
 
         * @return {String} str
24362
 
         * @override
24363
 
         */
24364
 
        BlockNode.prototype.toString = function() {
24365
 
          return this.blocks.map(function (param) {
24366
 
            return param.node.toString() + (param.visible ? '' : ';');
24367
 
          }).join('\n');
24368
 
        };
24369
 
 
24370
 
        /**
24371
 
         * Get LaTeX representation
24372
 
         * @return {String} str
24373
 
         */
24374
 
        BlockNode.prototype.toTex = function() {
24375
 
          return this.blocks.map(function (param) {
24376
 
            return param.node.toTex() + (param.visible ? '' : ';');
24377
 
          }).join('\n');
24378
 
        };
24379
 
 
24380
 
        module.exports = BlockNode;
24381
 
 
24382
 
 
24383
 
/***/ },
24384
 
/* 164 */
24385
 
/***/ function(module, exports, __webpack_require__) {
24386
 
 
24387
 
        'use strict';
24388
 
 
24389
 
        var Node = __webpack_require__(173);
24390
 
        var latex = __webpack_require__(315);
24391
 
        var BigNumber = __webpack_require__(159);
24392
 
        var Complex = __webpack_require__(6);
24393
 
        var Unit = __webpack_require__(10);
24394
 
        var util = __webpack_require__(160);
24395
 
        var isString = util.string.isString;
24396
 
        var isNumber = util.number.isNumber;
24397
 
        var isBoolean = util['boolean'].isBoolean;
24398
 
 
24399
 
        /**
24400
 
         * A lazy evaluating conditional operator: 'condition ? trueExpr : falseExpr'
24401
 
         *
24402
 
         * @param {Node} condition   Condition, must result in a boolean
24403
 
         * @param {Node} trueExpr    Expression evaluated when condition is true
24404
 
         * @param {Node} falseExpr   Expression evaluated when condition is true
24405
 
         *
24406
 
         * @constructor ConditionalNode
24407
 
         * @extends {Node}
24408
 
         */
24409
 
        function ConditionalNode (condition, trueExpr, falseExpr) {
24410
 
          if (!(this instanceof ConditionalNode)) {
24411
 
            throw new SyntaxError('Constructor must be called with the new operator');
24412
 
          }
24413
 
          if (!(condition instanceof Node)) throw new TypeError('Parameter condition must be a Node');
24414
 
          if (!(trueExpr instanceof Node))  throw new TypeError('Parameter trueExpr must be a Node');
24415
 
          if (!(falseExpr instanceof Node)) throw new TypeError('Parameter falseExpr must be a Node');
24416
 
 
24417
 
          this.condition = condition;
24418
 
          this.trueExpr = trueExpr;
24419
 
          this.falseExpr = falseExpr;
24420
 
        }
24421
 
 
24422
 
        ConditionalNode.prototype = new Node();
24423
 
 
24424
 
        ConditionalNode.prototype.type = 'ConditionalNode';
24425
 
 
24426
 
        /**
24427
 
         * Compile the node to javascript code
24428
 
         * @param {Object} defs     Object which can be used to define functions
24429
 
         *                          or constants globally available for the compiled
24430
 
         *                          expression
24431
 
         * @return {String} js
24432
 
         * @private
24433
 
         */
24434
 
        ConditionalNode.prototype._compile = function(defs) {
24435
 
          /**
24436
 
           * Test whether a condition is met
24437
 
           * @param {*} condition
24438
 
           * @returns {boolean} true if condition is true or non-zero, else false
24439
 
           */
24440
 
          defs.testCondition = function (condition) {
24441
 
            if (isNumber(condition) || isBoolean(condition) || isString(condition)) {
24442
 
              return condition ? true : false;
24443
 
            }
24444
 
 
24445
 
            if (condition instanceof BigNumber) {
24446
 
              return condition.isZero() ? false : true;
24447
 
            }
24448
 
 
24449
 
            if (condition instanceof Complex) {
24450
 
              return (condition.re || condition.im) ? true : false;
24451
 
            }
24452
 
 
24453
 
            if (condition instanceof Unit) {
24454
 
              return condition.value ? true : false;
24455
 
            }
24456
 
 
24457
 
            if (condition === null || condition === undefined) {
24458
 
              return false;
24459
 
            }
24460
 
 
24461
 
            throw new TypeError('Unsupported type of condition "' + defs.math['typeof'](condition) + '"');
24462
 
          };
24463
 
 
24464
 
          return (
24465
 
              'testCondition(' + this.condition._compile(defs) + ') ? ' +
24466
 
              '( ' + this.trueExpr._compile(defs) + ') : ' +
24467
 
              '( ' + this.falseExpr._compile(defs) + ')'
24468
 
              );
24469
 
        };
24470
 
 
24471
 
        /**
24472
 
         * Execute a callback for each of the child nodes of this node
24473
 
         * @param {function(child: Node, path: string, parent: Node)} callback
24474
 
         */
24475
 
        ConditionalNode.prototype.forEach = function (callback) {
24476
 
          callback(this.condition, 'condition', this);
24477
 
          callback(this.trueExpr, 'trueExpr', this);
24478
 
          callback(this.falseExpr, 'falseExpr', this);
24479
 
        };
24480
 
 
24481
 
        /**
24482
 
         * Create a new ConditionalNode having it's childs be the results of calling
24483
 
         * the provided callback function for each of the childs of the original node.
24484
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
24485
 
         * @returns {ConditionalNode} Returns a transformed copy of the node
24486
 
         */
24487
 
        ConditionalNode.prototype.map = function (callback) {
24488
 
          return new ConditionalNode(
24489
 
              this._ifNode(callback(this.condition, 'condition', this)),
24490
 
              this._ifNode(callback(this.trueExpr, 'trueExpr', this)),
24491
 
              this._ifNode(callback(this.falseExpr, 'falseExpr', this))
24492
 
          );
24493
 
        };
24494
 
 
24495
 
        /**
24496
 
         * Create a clone of this node, a shallow copy
24497
 
         * @return {ConditionalNode}
24498
 
         */
24499
 
        ConditionalNode.prototype.clone = function() {
24500
 
          return new ConditionalNode(this.condition, this.trueExpr, this.falseExpr);
24501
 
        };
24502
 
 
24503
 
        /**
24504
 
         * Get string representation
24505
 
         * @return {String} str
24506
 
         */
24507
 
        ConditionalNode.prototype.toString = function() {
24508
 
          // TODO: not nice adding parenthesis al the time
24509
 
          return '(' + this.condition.toString() + ') ? (' +
24510
 
              this.trueExpr.toString() + ') : (' +
24511
 
              this.falseExpr.toString() + ')';
24512
 
        };
24513
 
 
24514
 
        /**
24515
 
         * Get LaTeX representation
24516
 
         * @return {String} str
24517
 
         */
24518
 
        ConditionalNode.prototype.toTex = function() {
24519
 
          var s = (
24520
 
              latex.addBraces(this.trueExpr.toTex()) +
24521
 
              ', &\\quad' +
24522
 
              latex.addBraces('\\text{if}\\;' + this.condition.toTex())
24523
 
              ) + '\\\\' + (
24524
 
              latex.addBraces(this.falseExpr.toTex()) +
24525
 
              ', &\\quad' +
24526
 
              latex.addBraces('\\text{otherwise}')
24527
 
              );
24528
 
 
24529
 
          return latex.addBraces(s, [
24530
 
            '\\left\\{\\begin{array}{l l}',
24531
 
            '\\end{array}\\right.'
24532
 
          ]);
24533
 
        };
24534
 
 
24535
 
        module.exports = ConditionalNode;
24536
 
 
24537
 
 
24538
 
/***/ },
24539
 
/* 165 */
24540
 
/***/ function(module, exports, __webpack_require__) {
24541
 
 
24542
 
        'use strict';
24543
 
 
24544
 
        var Node = __webpack_require__(173),
24545
 
            BigNumber = __webpack_require__(159),
24546
 
            type = __webpack_require__(196).type,
24547
 
            isString = __webpack_require__(176).isString;
24548
 
 
24549
 
        /**
24550
 
         * A ConstantNode holds a constant value like a number or string. A ConstantNode
24551
 
         * stores a stringified version of the value and uses this to compile to
24552
 
         * JavaScript.
24553
 
         *
24554
 
         * In case of a stringified number as input, this may be compiled to a BigNumber
24555
 
         * when the math instance is configured for BigNumbers.
24556
 
         *
24557
 
         * Usage:
24558
 
         *
24559
 
         *     // stringified values with type
24560
 
         *     new ConstantNode('2.3', 'number');
24561
 
         *     new ConstantNode('true', 'boolean');
24562
 
         *     new ConstantNode('hello', 'string');
24563
 
         *
24564
 
         *     // non-stringified values, type will be automatically detected
24565
 
         *     new ConstantNode(2.3);
24566
 
         *     new ConstantNode('hello');
24567
 
         *
24568
 
         * @param {String | Number | Boolean | null | undefined} value
24569
 
         *                            When valueType is provided, value must contain
24570
 
         *                            an uninterpreted string representing the value.
24571
 
         *                            When valueType is undefined, value can be a
24572
 
         *                            number, string, boolean, null, or undefined, and
24573
 
         *                            the type will be determined automatically.
24574
 
         * @param {String} [valueType]  The type of value. Choose from 'number', 'string',
24575
 
         *                              'boolean', 'undefined', 'null'
24576
 
         * @constructor ConstantNode
24577
 
         * @extends {Node}
24578
 
         */
24579
 
        function ConstantNode(value, valueType) {
24580
 
          if (!(this instanceof ConstantNode)) {
24581
 
            throw new SyntaxError('Constructor must be called with the new operator');
24582
 
          }
24583
 
 
24584
 
          if (valueType) {
24585
 
            if (!isString(valueType)) {
24586
 
              throw new TypeError('String expected for parameter "valueType"');
24587
 
            }
24588
 
            if (!isString(value)){
24589
 
              throw new TypeError('String expected for parameter "value"');
24590
 
            }
24591
 
 
24592
 
            this.value = value;
24593
 
            this.valueType = valueType;
24594
 
          }
24595
 
          else {
24596
 
            // stringify the value and determine the type
24597
 
            this.value = value + '';
24598
 
            this.valueType = type(value);
24599
 
          }
24600
 
 
24601
 
          if (!SUPPORTED_TYPES[this.valueType]) {
24602
 
            throw new TypeError('Unsupported type of value "' + this.valueType + '"');
24603
 
          }
24604
 
        }
24605
 
 
24606
 
        var SUPPORTED_TYPES = {
24607
 
          'number': true,
24608
 
          'string': true,
24609
 
          'boolean': true,
24610
 
          'undefined': true,
24611
 
          'null': true
24612
 
        };
24613
 
 
24614
 
        ConstantNode.prototype = new Node();
24615
 
 
24616
 
        ConstantNode.prototype.type = 'ConstantNode';
24617
 
 
24618
 
        /**
24619
 
         * Compile the node to javascript code
24620
 
         * @param {Object} defs     Object which can be used to define functions
24621
 
         *                          or constants globally available for the compiled
24622
 
         *                          expression
24623
 
         * @return {String} js
24624
 
         * @private
24625
 
         */
24626
 
        ConstantNode.prototype._compile = function (defs) {
24627
 
          switch (this.valueType) {
24628
 
            case 'number':
24629
 
              if (defs.math.config().number === 'bignumber') {
24630
 
                return 'math.bignumber("' + this.value + '")';
24631
 
              }
24632
 
              else {
24633
 
                // remove leading zeros like '003.2' which are not allowed by JavaScript
24634
 
                return this.value.replace(/^(0*)[0-9]/, function (match, zeros) {
24635
 
                  return match.substring(zeros.length);
24636
 
                });
24637
 
              }
24638
 
 
24639
 
            case 'string':
24640
 
              return '"' + this.value + '"';
24641
 
 
24642
 
            case 'boolean':
24643
 
              return this.value;
24644
 
 
24645
 
            case 'undefined':
24646
 
              return this.value;
24647
 
 
24648
 
            case 'null':
24649
 
              return this.value;
24650
 
 
24651
 
            default:
24652
 
                // TODO: move this error to the constructor?
24653
 
              throw new TypeError('Unsupported type of constant "' + this.valueType + '"');
24654
 
          }
24655
 
        };
24656
 
 
24657
 
        /**
24658
 
         * Execute a callback for each of the child nodes of this node
24659
 
         * @param {function(child: Node, path: string, parent: Node)} callback
24660
 
         */
24661
 
        ConstantNode.prototype.forEach = function (callback) {
24662
 
          // nothing to do, we don't have childs
24663
 
        };
24664
 
 
24665
 
 
24666
 
        /**
24667
 
         * Create a new ConstantNode having it's childs be the results of calling
24668
 
         * the provided callback function for each of the childs of the original node.
24669
 
         * @param {function(child: Node, path: string, parent: Node) : Node} callback
24670
 
         * @returns {ConstantNode} Returns a clone of the node
24671
 
         */
24672
 
        ConstantNode.prototype.map = function (callback) {
24673
 
          return this.clone();
24674
 
        };
24675
 
 
24676
 
        /**
24677
 
         * Create a clone of this node, a shallow copy
24678
 
         * @return {ConstantNode}
24679
 
         */
24680
 
        ConstantNode.prototype.clone = function() {
24681
 
          return new ConstantNode(this.value, this.valueType);
24682
 
        };
24683
 
 
24684
 
        /**
24685
 
         * Get string representation
24686
 
         * @return {String} str
24687
 
         */
24688
 
        ConstantNode.prototype.toString = function() {
24689
 
          switch (this.valueType) {
24690
 
            case 'string':
24691
 
              return '"' + this.value + '"';
24692
 
 
24693
 
            default:
24694
 
              return this.value;
24695
 
          }
24696
 
        };
24697
 
 
24698
 
        /**
24699
 
         * Get LaTeX representation
24700
 
         * @return {String} str
24701
 
         */
24702
 
        ConstantNode.prototype.toTex = function() {
24703
 
          var value = this.value,
24704
 
              index;
24705
 
          switch (this.valueType) {
24706
 
            case 'string':
24707
 
              return '\\text{' + value + '}';
24708
 
 
24709
 
            case 'number':
24710
 
              index = value.toLowerCase().indexOf('e');
24711
 
              if (index !== -1) {
24712
 
                return value.substring(0, index) + ' \\cdot 10^{' +
24713
 
                    value.substring(index + 1) + '}';
24714
 
              }
24715
 
              return value;
24716
 
 
24717
 
            default:
24718
 
              return value;
24719
 
          }
24720
 
        };
24721
 
 
24722
 
        module.exports = ConstantNode;
24723
 
 
24724
 
 
24725
 
/***/ },
24726
 
/* 166 */
24727
 
/***/ function(module, exports, __webpack_require__) {
24728
 
 
24729
 
        'use strict';
24730
 
 
24731
 
        var Node = __webpack_require__(173);
24732
 
        var keywords = __webpack_require__(314);
24733
 
        var latex = __webpack_require__(315);
24734
 
        var isString = __webpack_require__(176).isString;
24735
 
        var isArray = Array.isArray;
24736
 
 
24737
 
        /**
24738
 
         * @constructor FunctionAssignmentNode
24739
 
         * @extends {Node}
24740
 
         * Function assignment
24741
 
         *
24742
 
         * @param {String} name           Function name
24743
 
         * @param {String[]} params         Function parameter names
24744
 
         * @param {Node} expr             The function expression
24745
 
         */
24746
 
        function FunctionAssignmentNode(name, params, expr) {
24747
 
          if (!(this instanceof FunctionAssignmentNode)) {
24748
 
            throw new SyntaxError('Constructor must be called with the new operator');
24749
 
          }
24750
 
 
24751
 
          // validate input
24752
 
          if (!isString(name)) throw new TypeError('String expected for parameter "name"');
24753
 
          if (!isArray(params) || !params.every(isString))  throw new TypeError('Array containing strings expected for parameter "params"');
24754
 
          if (!(expr instanceof Node)) throw new TypeError('Node expected for parameter "expr"');
24755
 
          if (name in keywords) throw new Error('Illegal function name, "'  + name +  '" is a reserved keyword');
24756
 
 
24757
 
          this.name = name;
24758
 
          this.params = params;
24759
 
          this.expr = expr;
24760
 
        }
24761
 
 
24762
 
        FunctionAssignmentNode.prototype = new Node();
24763
 
 
24764
 
        FunctionAssignmentNode.prototype.type = 'FunctionAssignmentNode';
24765
 
 
24766
 
        /**
24767
 
         * Compile the node to javascript code
24768
 
         * @param {Object} defs     Object which can be used to define functions
24769
 
         *                          or constants globally available for the compiled
24770
 
         *                          expression
24771
 
         * @return {String} js
24772
 
         * @private
24773
 
         */
24774
 
        FunctionAssignmentNode.prototype._compile = function (defs) {
24775
 
          return 'scope["' + this.name + '"] = ' +
24776
 
              '  (function (scope) {' +
24777
 
              '    scope = Object.create(scope); ' +
24778
 
              '    var fn = function ' + this.name + '(' + this.params.join(',') + ') {' +
24779
 
              '      if (arguments.length != ' + this.params.length + ') {' +
24780
 
              // TODO: use util.error.ArgumentsError here
24781
 
              // TODO: test arguments error
24782
 
              '        throw new SyntaxError("Wrong number of arguments in function ' + this.name + ' (" + arguments.length + " provided, ' + this.params.length + ' expected)");' +
24783
 
              '      }' +
24784
 
              this.params.map(function (variable, index) {
24785
 
                return 'scope["' + variable + '"] = arguments[' + index + '];';
24786
 
              }).join('') +
24787
 
              '      return ' + this.expr._compile(defs) + '' +
24788
 
              '    };' +
24789
 
              '    fn.syntax = "' + this.name + '(' + this.params.join(', ') + ')";' +
24790
 
              '    return fn;' +
24791
 
              '  })(scope);';
24792
 
        };
24793
 
 
24794
 
        /**
24795
 
         * Execute a callback for each of the child nodes of this node
24796
 
         * @param {function(child: Node, path: string, parent: Node)} callback
24797
 
         */
24798
 
        FunctionAssignmentNode.prototype.forEach = function (callback) {
24799
 
          callback(this.expr, 'expr', this);
24800
 
        };
24801
 
 
24802
 
        /**
24803
 
         * Create a new FunctionAssignmentNode having it's childs be the results of calling
24804
 
         * the provided callback function for each of the childs of the original node.
24805
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
24806
 
         * @returns {FunctionAssignmentNode} Returns a transformed copy of the node
24807
 
         */
24808
 
        FunctionAssignmentNode.prototype.map = function (callback) {
24809
 
          var expr = this._ifNode(callback(this.expr, 'expr', this));
24810
 
 
24811
 
          return new FunctionAssignmentNode(this.name, this.params.slice(0), expr);
24812
 
        };
24813
 
 
24814
 
        /**
24815
 
         * Create a clone of this node, a shallow copy
24816
 
         * @return {FunctionAssignmentNode}
24817
 
         */
24818
 
        FunctionAssignmentNode.prototype.clone = function() {
24819
 
          return new FunctionAssignmentNode(this.name, this.params.slice(0), this.expr);
24820
 
        };
24821
 
 
24822
 
        /**
24823
 
         * get string representation
24824
 
         * @return {String} str
24825
 
         */
24826
 
        FunctionAssignmentNode.prototype.toString = function() {
24827
 
          return 'function ' + this.name +
24828
 
              '(' + this.params.join(', ') + ') = ' +
24829
 
              this.expr.toString();
24830
 
        };
24831
 
 
24832
 
        /**
24833
 
         * get LaTeX representation
24834
 
         * @return {String} str
24835
 
         */
24836
 
        FunctionAssignmentNode.prototype.toTex = function() {
24837
 
          return this.name +
24838
 
              latex.addBraces(this.params.map(latex.toSymbol).join(', '), true) + '=' +
24839
 
              latex.addBraces(this.expr.toTex());
24840
 
        };
24841
 
 
24842
 
        module.exports = FunctionAssignmentNode;
24843
 
 
24844
 
 
24845
 
/***/ },
24846
 
/* 167 */
24847
 
/***/ function(module, exports, __webpack_require__) {
24848
 
 
24849
 
        'use strict';
24850
 
 
24851
 
        var Node = __webpack_require__(173);
24852
 
        var RangeNode = __webpack_require__(170);
24853
 
        var SymbolNode = __webpack_require__(171);
24854
 
 
24855
 
        var BigNumber = __webpack_require__(159);
24856
 
        var Range = __webpack_require__(7);
24857
 
 
24858
 
        var isNode = Node.isNode;
24859
 
        var isArray = Array.isArray;
24860
 
 
24861
 
        /**
24862
 
         * @constructor IndexNode
24863
 
         * @extends Node
24864
 
         *
24865
 
         * get a subset of a matrix
24866
 
         *
24867
 
         * @param {Node} object
24868
 
         * @param {Node[]} ranges
24869
 
         */
24870
 
        function IndexNode (object, ranges) {
24871
 
          if (!(this instanceof IndexNode)) {
24872
 
            throw new SyntaxError('Constructor must be called with the new operator');
24873
 
          }
24874
 
 
24875
 
          // validate input
24876
 
          if (!(object instanceof Node)) throw new TypeError('Node expected for parameter "object"');
24877
 
          if (!isArray(ranges) || !ranges.every(isNode)) {
24878
 
            throw new TypeError('Array containing Nodes expected for parameter "ranges"');
24879
 
          }
24880
 
 
24881
 
          this.object = object;
24882
 
          this.ranges = ranges;
24883
 
        }
24884
 
 
24885
 
        IndexNode.prototype = new Node();
24886
 
 
24887
 
        IndexNode.prototype.type = 'IndexNode';
24888
 
 
24889
 
        /**
24890
 
         * Compile the node to javascript code
24891
 
         * @param {Object} defs     Object which can be used to define functions
24892
 
         *                          or constants globally available for the compiled
24893
 
         *                          expression
24894
 
         * @return {String} js
24895
 
         * @private
24896
 
         */
24897
 
        IndexNode.prototype._compile = function (defs) {
24898
 
          return this.compileSubset(defs);
24899
 
        };
24900
 
 
24901
 
        /**
24902
 
         * Compile the node to javascript code
24903
 
         * @param {Object} defs           Object which can be used to define functions
24904
 
         *                                or constants globally available for the
24905
 
         *                                compiled expression
24906
 
         * @param {String} [replacement]  If provided, the function returns
24907
 
         *                                  "math.subset(obj, math.index(...), replacement)"
24908
 
         *                                Else, the function returns
24909
 
         *                                  "math.subset(obj, math.index(...))"
24910
 
         * @return {String} js
24911
 
         * @returns {string}
24912
 
         */
24913
 
        IndexNode.prototype.compileSubset = function(defs, replacement) {
24914
 
          // check whether any of the ranges expressions uses the context symbol 'end'
24915
 
          function test(node) {
24916
 
            return (node instanceof SymbolNode) && (node.name == 'end');
24917
 
          }
24918
 
 
24919
 
          var someUseEnd = false;
24920
 
          var rangesUseEnd = this.ranges.map(function (range) {
24921
 
            var useEnd = range.filter(test).length > 0;
24922
 
            someUseEnd = useEnd ? useEnd : someUseEnd;
24923
 
            return useEnd;
24924
 
          });
24925
 
 
24926
 
          // create a Range from start, step and end
24927
 
          defs.range = function (start, end, step) {
24928
 
            return new Range(
24929
 
                    start instanceof BigNumber ? start.toNumber() : start,
24930
 
                    end instanceof BigNumber ? end.toNumber() : end,
24931
 
                    step instanceof BigNumber ? step.toNumber() : step
24932
 
            );
24933
 
          };
24934
 
 
24935
 
          // TODO: implement support for bignumber (currently bignumbers are silently
24936
 
          //       reduced to numbers when changing the value to zero-based)
24937
 
 
24938
 
          // TODO: Optimization: when the range values are ConstantNodes,
24939
 
          //       we can beforehand resolve the zero-based value
24940
 
 
24941
 
          var ranges = this.ranges.map(function(range, i) {
24942
 
            var useEnd = rangesUseEnd[i];
24943
 
            if (range instanceof RangeNode) {
24944
 
              if (useEnd) {
24945
 
                // resolve end and create range
24946
 
                return '(function (scope) {' +
24947
 
                    '  scope = Object.create(scope); ' +
24948
 
                    '  scope["end"] = size[' + i + '];' +
24949
 
                    '  return range(' +
24950
 
                    '    ' + range.start._compile(defs) + ', ' +
24951
 
                    '    ' + range.end._compile(defs) + ', ' +
24952
 
                    '    ' + (range.step ? range.step._compile(defs) : '1') +
24953
 
                    '  );' +
24954
 
                    '})(scope)';
24955
 
              }
24956
 
              else {
24957
 
                // create range
24958
 
                return 'range(' +
24959
 
                    range.start._compile(defs) + ', ' +
24960
 
                    range.end._compile(defs) + ', ' +
24961
 
                    (range.step ? range.step._compile(defs) : '1') +
24962
 
                    ')';
24963
 
              }
24964
 
            }
24965
 
            else {
24966
 
              if (useEnd) {
24967
 
                // resolve the parameter 'end'
24968
 
                return '(function (scope) {' +
24969
 
                    '  scope = Object.create(scope); ' +
24970
 
                    '  scope["end"] = size[' + i + '];' +
24971
 
                    '  return ' + range._compile(defs) + ';' +
24972
 
                    '})(scope)'
24973
 
              }
24974
 
              else {
24975
 
                // just evaluate the expression
24976
 
                return range._compile(defs);
24977
 
              }
24978
 
            }
24979
 
          });
24980
 
 
24981
 
          // if some parameters use the 'end' parameter, we need to calculate the size
24982
 
          if (someUseEnd) {
24983
 
            return '(function () {' +
24984
 
                '  var obj = ' + this.object._compile(defs) + ';' +
24985
 
                '  var size = math.size(obj).valueOf();' +
24986
 
                '  return math.subset(' +
24987
 
                '    obj, ' +
24988
 
                '    math.index(' + ranges.join(', ') + ')' +
24989
 
                '    ' + (replacement ? (', ' + replacement) : '') +
24990
 
                '  );' +
24991
 
                '})()';
24992
 
          }
24993
 
          else {
24994
 
            return 'math.subset(' +
24995
 
                this.object._compile(defs) + ',' +
24996
 
                'math.index(' + ranges.join(', ') + ')' +
24997
 
                (replacement ? (', ' + replacement) : '') +
24998
 
                ')';
24999
 
          }
25000
 
        };
25001
 
 
25002
 
        /**
25003
 
         * Execute a callback for each of the child nodes of this node
25004
 
         * @param {function(child: Node, path: string, parent: Node)} callback
25005
 
         */
25006
 
        IndexNode.prototype.forEach = function (callback) {
25007
 
          // object
25008
 
          callback(this.object, 'object', this);
25009
 
 
25010
 
          // ranges
25011
 
          for (var i = 0; i < this.ranges.length; i++) {
25012
 
            callback(this.ranges[i], 'ranges[' + i + ']', this);
25013
 
          }
25014
 
        };
25015
 
 
25016
 
        /**
25017
 
         * Create a new IndexNode having it's childs be the results of calling
25018
 
         * the provided callback function for each of the childs of the original node.
25019
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
25020
 
         * @returns {IndexNode} Returns a transformed copy of the node
25021
 
         */
25022
 
        IndexNode.prototype.map = function (callback) {
25023
 
          var object = this._ifNode(callback(this.object, 'object', this));
25024
 
 
25025
 
          var ranges = [];
25026
 
          for (var i = 0; i < this.ranges.length; i++) {
25027
 
            ranges[i] = this._ifNode(callback(this.ranges[i], 'ranges[' + i + ']', this));
25028
 
          }
25029
 
 
25030
 
          return new IndexNode(object, ranges);
25031
 
        };
25032
 
 
25033
 
        /**
25034
 
         * Get the name of the object linked to this IndexNode
25035
 
         * @return {string} name
25036
 
         */
25037
 
        IndexNode.prototype.objectName = function() {
25038
 
          return this.object.name;
25039
 
        };
25040
 
 
25041
 
        /**
25042
 
         * Create a clone of this node, a shallow copy
25043
 
         * @return {IndexNode}
25044
 
         */
25045
 
        IndexNode.prototype.clone = function() {
25046
 
          return new IndexNode(this.object, this.ranges.slice(0));
25047
 
        };
25048
 
 
25049
 
        /**
25050
 
         * Get string representation
25051
 
         * @return {String} str
25052
 
         */
25053
 
        IndexNode.prototype.toString = function() {
25054
 
          // format the parameters like "[1, 0:5]"
25055
 
          return this.object.toString() + '[' + this.ranges.join(', ') + ']';
25056
 
        };
25057
 
 
25058
 
        /**
25059
 
         * Get LaTeX representation
25060
 
         * @return {String} str
25061
 
         */
25062
 
        IndexNode.prototype.toTex = function() {
25063
 
          return this.object.toTex() + '[' + this.ranges.join(', ') + ']';
25064
 
        };
25065
 
 
25066
 
        module.exports = IndexNode;
25067
 
 
25068
 
/***/ },
25069
 
/* 168 */
25070
 
/***/ function(module, exports, __webpack_require__) {
25071
 
 
25072
 
        'use strict';
25073
 
 
25074
 
        var Node = __webpack_require__(173),
25075
 
            ConstantNode = __webpack_require__(165),
25076
 
            SymbolNode = __webpack_require__(171),
25077
 
            FunctionNode = __webpack_require__(169),
25078
 
            latex = __webpack_require__(315);
25079
 
 
25080
 
        /**
25081
 
         * @constructor OperatorNode
25082
 
         * @extends {Node}
25083
 
         * An operator with two arguments, like 2+3
25084
 
         *
25085
 
         * @param {String} op       Operator name, for example '+'
25086
 
         * @param {String} fn       Function name, for example 'add'
25087
 
         * @param {Node[]} args     Operator arguments
25088
 
         */
25089
 
        function OperatorNode (op, fn, args) {
25090
 
          if (!(this instanceof OperatorNode)) {
25091
 
            throw new SyntaxError('Constructor must be called with the new operator');
25092
 
          }
25093
 
 
25094
 
          // TODO: validate input
25095
 
          this.op = op;
25096
 
          this.fn = fn;
25097
 
          this.args = args || [];
25098
 
        }
25099
 
 
25100
 
        OperatorNode.prototype = new Node();
25101
 
 
25102
 
        OperatorNode.prototype.type = 'OperatorNode';
25103
 
 
25104
 
        /**
25105
 
         * Compile the node to javascript code
25106
 
         * @param {Object} defs     Object which can be used to define functions
25107
 
         *                          or constants globally available for the compiled
25108
 
         *                          expression
25109
 
         * @return {String} js
25110
 
         * @private
25111
 
         */
25112
 
        OperatorNode.prototype._compile = function (defs) {
25113
 
          if (!(this.fn in defs.math)) {
25114
 
            throw new Error('Function ' + this.fn + ' missing in provided namespace "math"');
25115
 
          }
25116
 
 
25117
 
          var args = this.args.map(function (arg) {
25118
 
            return arg._compile(defs);
25119
 
          });
25120
 
          return 'math.' + this.fn + '(' + args.join(', ') + ')';
25121
 
        };
25122
 
 
25123
 
        /**
25124
 
         * Execute a callback for each of the child nodes of this node
25125
 
         * @param {function(child: Node, path: string, parent: Node)} callback
25126
 
         */
25127
 
        OperatorNode.prototype.forEach = function (callback) {
25128
 
          for (var i = 0; i < this.args.length; i++) {
25129
 
            callback(this.args[i], 'args[' + i + ']', this);
25130
 
          }
25131
 
        };
25132
 
 
25133
 
        /**
25134
 
         * Create a new OperatorNode having it's childs be the results of calling
25135
 
         * the provided callback function for each of the childs of the original node.
25136
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
25137
 
         * @returns {OperatorNode} Returns a transformed copy of the node
25138
 
         */
25139
 
        OperatorNode.prototype.map = function (callback) {
25140
 
          var args = [];
25141
 
          for (var i = 0; i < this.args.length; i++) {
25142
 
            args[i] = this._ifNode(callback(this.args[i], 'args[' + i + ']', this));
25143
 
          }
25144
 
          return new OperatorNode(this.op, this.fn, args);
25145
 
        };
25146
 
 
25147
 
        /**
25148
 
         * Create a clone of this node, a shallow copy
25149
 
         * @return {OperatorNode}
25150
 
         */
25151
 
        OperatorNode.prototype.clone = function() {
25152
 
          return new OperatorNode(this.op, this.fn, this.args.slice(0));
25153
 
        };
25154
 
 
25155
 
        /**
25156
 
         * Get string representation
25157
 
         * @return {String} str
25158
 
         */
25159
 
        OperatorNode.prototype.toString = function() {
25160
 
          var args = this.args;
25161
 
 
25162
 
          switch (args.length) {
25163
 
            case 1:
25164
 
              if (this.op == '-') {
25165
 
                // special case: unary minus
25166
 
                return '-' + args[0].toString();
25167
 
              }
25168
 
              else {
25169
 
                // for example '5!'
25170
 
                return args[0].toString() + this.op;
25171
 
              }
25172
 
 
25173
 
            case 2: // for example '2+3'
25174
 
              var lhs = args[0].toString();
25175
 
              if (args[0] instanceof OperatorNode) {
25176
 
                lhs = '(' + lhs + ')';
25177
 
              }
25178
 
              var rhs = args[1].toString();
25179
 
              if (args[1] instanceof OperatorNode) {
25180
 
                rhs = '(' + rhs + ')';
25181
 
              }
25182
 
              return lhs + ' ' + this.op + ' ' + rhs;
25183
 
 
25184
 
            default: // this should not occur. format as a function call
25185
 
              return this.op + '(' + this.args.join(', ') + ')';
25186
 
          }
25187
 
        };
25188
 
 
25189
 
        /**
25190
 
         * Get LaTeX representation
25191
 
         * @return {String} str
25192
 
         */
25193
 
        OperatorNode.prototype.toTex = function() {
25194
 
          var args = this.args,
25195
 
              mop = latex.toOperator(this.op),
25196
 
              lp = args[0],
25197
 
              rp = args[1];
25198
 
 
25199
 
          switch (args.length) {
25200
 
            case 1:
25201
 
              if (this.op === '-' || this.op === '+') {
25202
 
                // special case: unary minus
25203
 
                return this.op + lp.toTex();
25204
 
              }
25205
 
              // for example '5!'
25206
 
              return lp.toTex() + this.op;
25207
 
 
25208
 
            case 2: // for example '2+3'
25209
 
              var lhs = lp.toTex(),
25210
 
                  lhb = false,
25211
 
                  rhs = rp.toTex(),
25212
 
                  rhb = false,
25213
 
                  lop = '',
25214
 
                  rop = '';
25215
 
 
25216
 
              switch (this.op) {
25217
 
                case '/':
25218
 
                  lop = mop;
25219
 
                  mop = '';
25220
 
 
25221
 
                  break;
25222
 
 
25223
 
                case '*':
25224
 
                  if (lp instanceof OperatorNode) {
25225
 
                    if (lp.op === '+' || lp.op === '-') {
25226
 
                      lhb = true;
25227
 
                    }
25228
 
                  }
25229
 
 
25230
 
                  if (rp instanceof OperatorNode) {
25231
 
                    if (rp.op === '+' || rp.op === '-') {
25232
 
                      rhb = true;
25233
 
                    }
25234
 
                    else if (rp.op === '*') {
25235
 
                      rhb = true;
25236
 
                    }
25237
 
                  }
25238
 
 
25239
 
                  if ((lp instanceof ConstantNode || lp instanceof OperatorNode) &&
25240
 
                      (rp instanceof ConstantNode || rp instanceof OperatorNode)) {
25241
 
                    mop = ' \\cdot ';
25242
 
                  }
25243
 
                  else {
25244
 
                    mop = ' \\, ';
25245
 
                  }
25246
 
 
25247
 
                  break;
25248
 
 
25249
 
                case '^':
25250
 
                  if (lp instanceof OperatorNode || lp instanceof FunctionNode) {
25251
 
                    lhb = true;
25252
 
                  }
25253
 
                  else if (lp instanceof SymbolNode) {
25254
 
                    lhb = null;
25255
 
                  }
25256
 
 
25257
 
                  break;
25258
 
 
25259
 
                case 'to':
25260
 
                  rhs = latex.toUnit(rhs, true);
25261
 
                  break;
25262
 
              }
25263
 
 
25264
 
              lhs = latex.addBraces(lhs, lhb);
25265
 
              rhs = latex.addBraces(rhs, rhb);
25266
 
 
25267
 
              return lop + lhs + mop + rhs + rop;
25268
 
 
25269
 
            default: // this should not occur. format as a function call
25270
 
              return mop + '(' + this.args.map(latex.toSymbol).join(', ') + ')';
25271
 
          }
25272
 
        };
25273
 
 
25274
 
        module.exports = OperatorNode;
25275
 
 
25276
 
 
25277
 
/***/ },
25278
 
/* 169 */
25279
 
/***/ function(module, exports, __webpack_require__) {
25280
 
 
25281
 
        'use strict';
25282
 
 
25283
 
        var Node = __webpack_require__(173);
25284
 
        var SymbolNode = __webpack_require__(171);
25285
 
 
25286
 
        var latex = __webpack_require__(315);
25287
 
        var isNode = Node.isNode;
25288
 
        var isArray = Array.isArray;
25289
 
 
25290
 
        /**
25291
 
         * @constructor FunctionNode
25292
 
         * @extends {Node}
25293
 
         * invoke a list with arguments on a node
25294
 
         * @param {string} name
25295
 
         * @param {Node[]} args
25296
 
         */
25297
 
        function FunctionNode (name, args) {
25298
 
          if (!(this instanceof FunctionNode)) {
25299
 
            throw new SyntaxError('Constructor must be called with the new operator');
25300
 
          }
25301
 
 
25302
 
          // validate input
25303
 
          if (typeof name !== 'string') throw new TypeError('string expected for parameter "name"');
25304
 
          if (!isArray(args) || !args.every(isNode)) {
25305
 
            throw new TypeError('Array containing Nodes expected for parameter "args"');
25306
 
          }
25307
 
 
25308
 
          this.name = name;
25309
 
          this.args = args || [];
25310
 
        }
25311
 
 
25312
 
        FunctionNode.prototype = new Node();
25313
 
 
25314
 
        FunctionNode.prototype.type = 'FunctionNode';
25315
 
 
25316
 
        /**
25317
 
         * Compile the node to javascript code
25318
 
         * @param {Object} defs     Object which can be used to define functions
25319
 
         *                          or constants globally available for the compiled
25320
 
         *                          expression
25321
 
         * @return {String} js
25322
 
         * @private
25323
 
         */
25324
 
        FunctionNode.prototype._compile = function (defs) {
25325
 
          var fn = defs.math[this.name];
25326
 
          var isRaw = (typeof fn === 'function') && (fn.rawArgs == true);
25327
 
 
25328
 
          // compile the parameters
25329
 
          var args = this.args.map(function (arg) {
25330
 
            return arg._compile(defs);
25331
 
          });
25332
 
 
25333
 
          if (isRaw) {
25334
 
            // pass unevaluated parameters (nodes) to the function
25335
 
            var paramsName;
25336
 
            do {
25337
 
              paramsName = 'p' + Math.round(Math.random() * 10000);
25338
 
            }
25339
 
            while (paramsName in defs);
25340
 
            defs[paramsName] = this.args;
25341
 
 
25342
 
            return '("' + this.name + '" in scope ? ' +
25343
 
                'scope["' + this.name + '"](' + args.join(', ') + ') : ' +
25344
 
                'math["' + this.name + '"]' + '(' + paramsName + ', math, scope))';
25345
 
          }
25346
 
          else {
25347
 
            // "regular" evaluation
25348
 
            var symbol = new SymbolNode(this.name);
25349
 
            return symbol._compile(defs) + '(' + args.join(', ') + ')';
25350
 
          }
25351
 
        };
25352
 
 
25353
 
        /**
25354
 
         * Execute a callback for each of the child nodes of this node
25355
 
         * @param {function(child: Node, path: string, parent: Node)} callback
25356
 
         */
25357
 
        FunctionNode.prototype.forEach = function (callback) {
25358
 
          for (var i = 0; i < this.args.length; i++) {
25359
 
            callback(this.args[i], 'args[' + i + ']', this);
25360
 
          }
25361
 
        };
25362
 
 
25363
 
        /**
25364
 
         * Create a new FunctionNode having it's childs be the results of calling
25365
 
         * the provided callback function for each of the childs of the original node.
25366
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
25367
 
         * @returns {FunctionNode} Returns a transformed copy of the node
25368
 
         */
25369
 
        FunctionNode.prototype.map = function (callback) {
25370
 
          var args = [];
25371
 
          for (var i = 0; i < this.args.length; i++) {
25372
 
            args[i] = this._ifNode(callback(this.args[i], 'args[' + i + ']', this));
25373
 
          }
25374
 
          return new FunctionNode(this.name, args);
25375
 
        };
25376
 
 
25377
 
        /**
25378
 
         * Create a clone of this node, a shallow copy
25379
 
         * @return {FunctionNode}
25380
 
         */
25381
 
        FunctionNode.prototype.clone = function() {
25382
 
          return new FunctionNode(this.name, this.args.slice(0));
25383
 
        };
25384
 
 
25385
 
        /**
25386
 
         * Get string representation
25387
 
         * @return {String} str
25388
 
         */
25389
 
        FunctionNode.prototype.toString = function() {
25390
 
          // format the parameters like "add(2, 4.2)"
25391
 
          return this.name + '(' + this.args.join(', ') + ')';
25392
 
        };
25393
 
 
25394
 
        /**
25395
 
         * Get LaTeX representation
25396
 
         * @return {String} str
25397
 
         */
25398
 
        FunctionNode.prototype.toTex = function() {
25399
 
          return latex.toArgs(this);
25400
 
        };
25401
 
 
25402
 
        module.exports = FunctionNode;
25403
 
 
25404
 
 
25405
 
/***/ },
25406
 
/* 170 */
25407
 
/***/ function(module, exports, __webpack_require__) {
25408
 
 
25409
 
        'use strict';
25410
 
 
25411
 
        var Node = __webpack_require__(173);
25412
 
 
25413
 
        var isNode = Node.isNode;
25414
 
 
25415
 
        /**
25416
 
         * @constructor RangeNode
25417
 
         * @extends {Node}
25418
 
         * create a range
25419
 
         * @param {Node} start  included lower-bound
25420
 
         * @param {Node} end    included lower-bound
25421
 
         * @param {Node} [step] optional step
25422
 
         */
25423
 
        function RangeNode (start, end, step) {
25424
 
          if (!(this instanceof RangeNode)) {
25425
 
            throw new SyntaxError('Constructor must be called with the new operator');
25426
 
          }
25427
 
 
25428
 
          // validate inputs
25429
 
          if (!isNode(start)) throw new TypeError('Node expected');
25430
 
          if (!isNode(end)) throw new TypeError('Node expected');
25431
 
          if (step && !isNode(step)) throw new TypeError('Node expected');
25432
 
          if (arguments.length > 3) throw new Error('Too many arguments');
25433
 
 
25434
 
          this.start = start;         // included lower-bound
25435
 
          this.end   = end;           // included upper-bound
25436
 
          this.step  = step || null;  // optional step
25437
 
        }
25438
 
 
25439
 
        RangeNode.prototype = new Node();
25440
 
 
25441
 
        RangeNode.prototype.type = 'RangeNode';
25442
 
 
25443
 
        /**
25444
 
         * Compile the node to javascript code
25445
 
         * @param {Object} defs     Object which can be used to define functions
25446
 
         *                          or constants globally available for the compiled
25447
 
         *                          expression
25448
 
         * @return {String} js
25449
 
         * @private
25450
 
         */
25451
 
        RangeNode.prototype._compile = function (defs) {
25452
 
          return 'math.range(' +
25453
 
              this.start._compile(defs) + ', ' +
25454
 
              this.end._compile(defs) +
25455
 
              (this.step ? (', ' + this.step._compile(defs)) : '') +
25456
 
              ')';
25457
 
        };
25458
 
 
25459
 
        /**
25460
 
         * Execute a callback for each of the child nodes of this node
25461
 
         * @param {function(child: Node, path: string, parent: Node)} callback
25462
 
         */
25463
 
        RangeNode.prototype.forEach = function (callback) {
25464
 
          callback(this.start, 'start', this);
25465
 
          callback(this.end, 'end', this);
25466
 
          if (this.step) {
25467
 
            callback(this.step, 'step', this);
25468
 
          }
25469
 
        };
25470
 
 
25471
 
        /**
25472
 
         * Create a new RangeNode having it's childs be the results of calling
25473
 
         * the provided callback function for each of the childs of the original node.
25474
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
25475
 
         * @returns {RangeNode} Returns a transformed copy of the node
25476
 
         */
25477
 
        RangeNode.prototype.map = function (callback) {
25478
 
          return new RangeNode(
25479
 
              this._ifNode(callback(this.start, 'start', this)),
25480
 
              this._ifNode(callback(this.end, 'end', this)),
25481
 
              this.step && this._ifNode(callback(this.step, 'step', this))
25482
 
          );
25483
 
        };
25484
 
 
25485
 
        /**
25486
 
         * Create a clone of this node, a shallow copy
25487
 
         * @return {RangeNode}
25488
 
         */
25489
 
        RangeNode.prototype.clone = function() {
25490
 
          return new RangeNode(this.start, this.end, this.step && this.step);
25491
 
        };
25492
 
 
25493
 
        /**
25494
 
         * Get string representation
25495
 
         * @return {String} str
25496
 
         */
25497
 
        RangeNode.prototype.toString = function() {
25498
 
          // format the range like "start:step:end"
25499
 
          var str = this.start.toString();
25500
 
          if (this.step) {
25501
 
            str += ':' + this.step.toString();
25502
 
          }
25503
 
          str += ':' + this.end.toString();
25504
 
 
25505
 
          return str;
25506
 
        };
25507
 
 
25508
 
        /**
25509
 
         * Get LaTeX representation
25510
 
         * @return {String} str
25511
 
         */
25512
 
        RangeNode.prototype.toTex = function() {
25513
 
          var str = this.start.toTex();
25514
 
          if (this.step) {
25515
 
            str += ':' + this.step.toTex();
25516
 
          }
25517
 
          str += ':' + this.end.toTex();
25518
 
 
25519
 
          return str;
25520
 
        };
25521
 
 
25522
 
        module.exports = RangeNode;
25523
 
 
25524
 
 
25525
 
/***/ },
25526
 
/* 171 */
25527
 
/***/ function(module, exports, __webpack_require__) {
25528
 
 
25529
 
        'use strict';
25530
 
 
25531
 
        var Node = __webpack_require__(173),
25532
 
            Unit = __webpack_require__(10),
25533
 
 
25534
 
            latex = __webpack_require__(315),
25535
 
            isString = __webpack_require__(176).isString;
25536
 
 
25537
 
        /**
25538
 
         * @constructor SymbolNode
25539
 
         * @extends {Node}
25540
 
         * A symbol node can hold and resolve a symbol
25541
 
         * @param {String} name
25542
 
         * @extends {Node}
25543
 
         */
25544
 
        function SymbolNode(name) {
25545
 
          if (!(this instanceof SymbolNode)) {
25546
 
            throw new SyntaxError('Constructor must be called with the new operator');
25547
 
          }
25548
 
 
25549
 
          // validate input
25550
 
          if (!isString(name))  throw new TypeError('String expected for parameter "name"');
25551
 
 
25552
 
          this.name = name;
25553
 
        }
25554
 
 
25555
 
        SymbolNode.prototype = new Node();
25556
 
 
25557
 
        SymbolNode.prototype.type = 'SymbolNode';
25558
 
 
25559
 
        /**
25560
 
         * Compile the node to javascript code
25561
 
         * @param {Object} defs     Object which can be used to define functions
25562
 
         *                          or constants globally available for the compiled
25563
 
         *                          expression
25564
 
         * @return {String} js
25565
 
         * @private
25566
 
         */
25567
 
        SymbolNode.prototype._compile = function (defs) {
25568
 
          // add a function to the definitions
25569
 
          defs['undef'] = undef;
25570
 
          defs['Unit'] = Unit;
25571
 
 
25572
 
          if (this.name in defs.math) {
25573
 
            return '("' + this.name + '" in scope ? scope["' + this.name + '"] : math["' + this.name + '"])';
25574
 
          }
25575
 
          else {
25576
 
            return '(' +
25577
 
                '"' + this.name + '" in scope ? scope["' + this.name + '"] : ' +
25578
 
                (Unit.isValuelessUnit(this.name) ?
25579
 
                    'new Unit(null, "' + this.name + '")' :
25580
 
                    'undef("' + this.name + '")') +
25581
 
                ')';
25582
 
          }
25583
 
        };
25584
 
 
25585
 
        /**
25586
 
         * Execute a callback for each of the child nodes of this node
25587
 
         * @param {function(child: Node, path: string, parent: Node)} callback
25588
 
         */
25589
 
        SymbolNode.prototype.forEach = function (callback) {
25590
 
          // nothing to do, we don't have childs
25591
 
        };
25592
 
 
25593
 
        /**
25594
 
         * Create a new SymbolNode having it's childs be the results of calling
25595
 
         * the provided callback function for each of the childs of the original node.
25596
 
         * @param {function(child: Node, path: string, parent: Node) : Node} callback
25597
 
         * @returns {SymbolNode} Returns a clone of the node
25598
 
         */
25599
 
        SymbolNode.prototype.map = function (callback) {
25600
 
          return this.clone();
25601
 
        };
25602
 
 
25603
 
        /**
25604
 
         * Throws an error 'Undefined symbol {name}'
25605
 
         * @param {String} name
25606
 
         */
25607
 
        function undef (name) {
25608
 
          throw new Error('Undefined symbol ' + name);
25609
 
        }
25610
 
 
25611
 
        /**
25612
 
         * Create a clone of this node, a shallow copy
25613
 
         * @return {SymbolNode}
25614
 
         */
25615
 
        SymbolNode.prototype.clone = function() {
25616
 
          return new SymbolNode(this.name);
25617
 
        };
25618
 
 
25619
 
        /**
25620
 
         * Get string representation
25621
 
         * @return {String} str
25622
 
         * @override
25623
 
         */
25624
 
        SymbolNode.prototype.toString = function() {
25625
 
          return this.name;
25626
 
        };
25627
 
 
25628
 
        /**
25629
 
         * Get LaTeX representation
25630
 
         * @return {String} str
25631
 
         * @override
25632
 
         */
25633
 
        SymbolNode.prototype.toTex = function() {
25634
 
          return latex.toSymbol(this.name);
25635
 
        };
25636
 
 
25637
 
        module.exports = SymbolNode;
25638
 
 
25639
 
 
25640
 
/***/ },
25641
 
/* 172 */
25642
 
/***/ function(module, exports, __webpack_require__) {
25643
 
 
25644
 
        'use strict';
25645
 
 
25646
 
        var Node = __webpack_require__(173),
25647
 
            IndexNode = __webpack_require__(167);
25648
 
 
25649
 
        /**
25650
 
         * @constructor UpdateNode
25651
 
         * @extends {Node}
25652
 
         * Update a matrix subset, like A[2,3] = 4.5
25653
 
         *
25654
 
         * @param {IndexNode} index             IndexNode containing symbol and ranges
25655
 
         * @param {Node} expr                   The expression defining the symbol
25656
 
         */
25657
 
        function UpdateNode(index, expr) {
25658
 
          if (!(this instanceof UpdateNode)) {
25659
 
            throw new SyntaxError('Constructor must be called with the new operator');
25660
 
          }
25661
 
 
25662
 
          if (!(index instanceof IndexNode)) {
25663
 
            throw new TypeError('Expected IndexNode for parameter "index"');
25664
 
          }
25665
 
          if (!(expr instanceof Node)) {
25666
 
            throw new TypeError('Expected Node for parameter "expr"');
25667
 
          }
25668
 
 
25669
 
          this.index = index;
25670
 
          this.expr = expr;
25671
 
        }
25672
 
 
25673
 
        UpdateNode.prototype = new Node();
25674
 
 
25675
 
        UpdateNode.prototype.type = 'UpdateNode';
25676
 
 
25677
 
        /**
25678
 
         * Compile the node to javascript code
25679
 
         * @param {Object} defs     Object which can be used to define functions
25680
 
         *                          or constants globally available for the compiled
25681
 
         *                          expression
25682
 
         * @return {String} js
25683
 
         * @private
25684
 
         */
25685
 
        UpdateNode.prototype._compile = function (defs) {
25686
 
          return 'scope["' + this.index.objectName() + '\"] = ' +
25687
 
              this.index.compileSubset(defs,  this.expr._compile(defs));
25688
 
        };
25689
 
 
25690
 
        /**
25691
 
         * Execute a callback for each of the child nodes of this node
25692
 
         * @param {function(child: Node, path: string, parent: Node)} callback
25693
 
         */
25694
 
        UpdateNode.prototype.forEach = function (callback) {
25695
 
          callback(this.index, 'index', this);
25696
 
          callback(this.expr, 'expr', this);
25697
 
        };
25698
 
 
25699
 
        /**
25700
 
         * Create a new UpdateNode having it's childs be the results of calling
25701
 
         * the provided callback function for each of the childs of the original node.
25702
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
25703
 
         * @returns {UpdateNode} Returns a transformed copy of the node
25704
 
         */
25705
 
        UpdateNode.prototype.map = function (callback) {
25706
 
          return new UpdateNode(
25707
 
              this._ifNode(callback(this.index, 'index', this)),
25708
 
              this._ifNode(callback(this.expr, 'expr', this))
25709
 
          );
25710
 
        };
25711
 
 
25712
 
        /**
25713
 
         * Create a clone of this node, a shallow copy
25714
 
         * @return {UpdateNode}
25715
 
         */
25716
 
        UpdateNode.prototype.clone = function() {
25717
 
          return new UpdateNode(this.index, this.expr);
25718
 
        };
25719
 
 
25720
 
        /**
25721
 
         * Get string representation
25722
 
         * @return {String}
25723
 
         */
25724
 
        UpdateNode.prototype.toString = function() {
25725
 
          return this.index.toString() + ' = ' + this.expr.toString();
25726
 
        };
25727
 
 
25728
 
        /**
25729
 
         * Get LaTeX representation
25730
 
         * @return {String}
25731
 
         */
25732
 
        UpdateNode.prototype.toTex = function() {
25733
 
          return this.index.toTex() + ' = ' + this.expr.toTex();
25734
 
        };
25735
 
 
25736
 
        module.exports = UpdateNode;
25737
 
 
25738
 
 
25739
 
/***/ },
25740
 
/* 173 */
25741
 
/***/ function(module, exports, __webpack_require__) {
25742
 
 
25743
 
        'use strict';
25744
 
 
25745
 
        var keywords = __webpack_require__(314);
25746
 
 
25747
 
        /**
25748
 
         * Node
25749
 
         */
25750
 
        function Node() {
25751
 
          if (!(this instanceof Node)) {
25752
 
            throw new SyntaxError('Constructor must be called with the new operator');
25753
 
          }
25754
 
        }
25755
 
 
25756
 
        /**
25757
 
         * Evaluate the node
25758
 
         * @return {*} result
25759
 
         */
25760
 
        // TODO: cleanup deprecated code one day. Deprecated since version 0.19.0
25761
 
        Node.prototype.eval = function () {
25762
 
          throw new Error('Node.eval is deprecated. ' +
25763
 
              'Use Node.compile(math).eval([scope]) instead.');
25764
 
        };
25765
 
 
25766
 
        Node.prototype.type = 'Node';
25767
 
 
25768
 
        /**
25769
 
         * Compile the node to javascript code
25770
 
         * @param {Object} math             math.js instance
25771
 
         * @return {{eval: function}} expr  Returns an object with a function 'eval',
25772
 
         *                                  which can be invoked as expr.eval([scope]),
25773
 
         *                                  where scope is an optional object with
25774
 
         *                                  variables.
25775
 
         */
25776
 
        Node.prototype.compile = function (math) {
25777
 
          if (!(math instanceof Object)) {
25778
 
            throw new TypeError('Object expected for parameter math');
25779
 
          }
25780
 
 
25781
 
          // definitions globally available inside the closure of the compiled expressions
25782
 
          var defs = {
25783
 
            math: _transform(math),
25784
 
            _validateScope: _validateScope
25785
 
          };
25786
 
 
25787
 
          var code = this._compile(defs);
25788
 
 
25789
 
          var defsCode = Object.keys(defs).map(function (name) {
25790
 
            return '    var ' + name + ' = defs["' + name + '"];';
25791
 
          });
25792
 
 
25793
 
          var factoryCode =
25794
 
              defsCode.join(' ') +
25795
 
                  'return {' +
25796
 
                  '  "eval": function (scope) {' +
25797
 
                  '    if (scope) _validateScope(scope);' +
25798
 
                  '    scope = scope || {};' +
25799
 
                  '    return ' + code + ';' +
25800
 
                  '  }' +
25801
 
                  '};';
25802
 
 
25803
 
          var factory = new Function ('defs', factoryCode);
25804
 
          return factory(defs);
25805
 
        };
25806
 
 
25807
 
        /**
25808
 
         * Compile the node to javascript code
25809
 
         * @param {Object} defs     Object which can be used to define functions
25810
 
         *                          and constants globally available inside the closure
25811
 
         *                          of the compiled expression
25812
 
         * @return {String} js
25813
 
         * @private
25814
 
         */
25815
 
        Node.prototype._compile = function (defs) {
25816
 
          // must be implemented by each of the Node implementations
25817
 
          throw new Error('Cannot compile a Node interface');
25818
 
        };
25819
 
 
25820
 
        /**
25821
 
         * Execute a callback for each of the child nodes of this node
25822
 
         * @param {function(child: Node, path: string, parent: Node)} callback
25823
 
         */
25824
 
        Node.prototype.forEach = function (callback) {
25825
 
          // must be implemented by each of the Node implementations
25826
 
          throw new Error('Cannot run forEach on a Node interface');
25827
 
        };
25828
 
 
25829
 
        /**
25830
 
         * Create a new Node having it's childs be the results of calling
25831
 
         * the provided callback function for each of the childs of the original node.
25832
 
         * @param {function(child: Node, path: string, parent: Node): Node} callback
25833
 
         * @returns {OperatorNode} Returns a transformed copy of the node
25834
 
         */
25835
 
        Node.prototype.map = function (callback) {
25836
 
          // must be implemented by each of the Node implementations
25837
 
          throw new Error('Cannot run map on a Node interface');
25838
 
        };
25839
 
 
25840
 
        /**
25841
 
         * Validate whether an object is a Node, for use with map
25842
 
         * @param {Node} node
25843
 
         * @returns {Node} Returns the input if it's a node, else throws an Error
25844
 
         * @protected
25845
 
         */
25846
 
        Node.prototype._ifNode = function (node) {
25847
 
          if (!(node instanceof Node)) {
25848
 
            throw new TypeError('Callback function must return a Node');
25849
 
          }
25850
 
 
25851
 
          return node;
25852
 
        };
25853
 
 
25854
 
        /**
25855
 
         * Recursively traverse all nodes in a node tree. Executes given callback for
25856
 
         * this node and each of its child nodes.
25857
 
         * @param {function(node: Node, path: string, parent: Node)} callback
25858
 
         *          A callback called for every node in the node tree.
25859
 
         */
25860
 
        Node.prototype.traverse = function (callback) {
25861
 
          // execute callback for itself
25862
 
          callback(this, null, null);
25863
 
 
25864
 
          // recursively traverse over all childs of a node
25865
 
          function _traverse (node, callback) {
25866
 
            node.forEach(function(child, path, parent) {
25867
 
              callback(child, path, parent);
25868
 
              _traverse(child, callback);
25869
 
            });
25870
 
          }
25871
 
          _traverse(this, callback);
25872
 
        };
25873
 
 
25874
 
        /**
25875
 
         * Recursively transform a node tree via a transform function.
25876
 
         *
25877
 
         * For example, to replace all nodes of type SymbolNode having name 'x' with a
25878
 
         * ConstantNode with value 2:
25879
 
         *
25880
 
         *     var res = Node.transform(function (node, path, parent) {
25881
 
         *       if (node instanceof SymbolNode) && (node.name == 'x')) {
25882
 
         *         return new ConstantNode(2);
25883
 
         *       }
25884
 
         *       else {
25885
 
         *         return node;
25886
 
         *       }
25887
 
         *     });
25888
 
         *
25889
 
         * @param {function(node: Node, path: string, parent: Node) : Node} callback
25890
 
         *          A mapping function accepting a node, and returning
25891
 
         *          a replacement for the node or the original node.
25892
 
         *          Signature: callback(node: Node, index: string, parent: Node) : Node
25893
 
         * @return {Node} Returns the original node or its replacement
25894
 
         */
25895
 
        Node.prototype.transform = function (callback) {
25896
 
          // check itself
25897
 
          var replacement = callback(this, null, null);
25898
 
          if (replacement !== this) {
25899
 
            return replacement;
25900
 
          }
25901
 
 
25902
 
          // traverse over all childs
25903
 
          function _transform (node, callback) {
25904
 
            return node.map(function(child, path, parent) {
25905
 
              var replacement = callback(child, path, parent);
25906
 
              return (replacement !== child) ? replacement : _transform(child, callback);
25907
 
            });
25908
 
          }
25909
 
          return _transform(this, callback);
25910
 
        };
25911
 
 
25912
 
        /**
25913
 
         * Find any node in the node tree matching given filter function. For example, to
25914
 
         * find all nodes of type SymbolNode having name 'x':
25915
 
         *
25916
 
         *     var results = Node.filter(function (node) {
25917
 
         *       return (node instanceof SymbolNode) && (node.name == 'x');
25918
 
         *     });
25919
 
         *
25920
 
         * @param {function(node: Node, path: string, parent: Node) : Node} callback
25921
 
         *            A test function returning true when a node matches, and false
25922
 
         *            otherwise. Function signature:
25923
 
         *            callback(node: Node, index: string, parent: Node) : boolean
25924
 
         * @return {Node[]} nodes       An array with nodes matching given filter criteria
25925
 
         */
25926
 
        Node.prototype.filter = function (callback) {
25927
 
          var nodes = [];
25928
 
 
25929
 
          this.traverse(function (node, path, parent) {
25930
 
            if (callback(node, path, parent)) {
25931
 
              nodes.push(node);
25932
 
            }
25933
 
          });
25934
 
 
25935
 
          return nodes;
25936
 
        };
25937
 
 
25938
 
        // TODO: deprecated since version 1.1.0, remove this some day
25939
 
        Node.prototype.find = function () {
25940
 
          throw new Error('Function Node.find is deprecated. Use Node.filter instead.');
25941
 
        };
25942
 
 
25943
 
        // TODO: deprecated since version 1.1.0, remove this some day
25944
 
        Node.prototype.match = function () {
25945
 
          throw new Error('Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.');
25946
 
        };
25947
 
 
25948
 
        /**
25949
 
         * Create a clone of this node, a shallow copy
25950
 
         * @return {Node}
25951
 
         */
25952
 
        Node.prototype.clone = function() {
25953
 
          // must be implemented by each of the Node implementations
25954
 
          throw new Error('Cannot clone a Node interface');
25955
 
        };
25956
 
 
25957
 
        /**
25958
 
         * Get string representation
25959
 
         * @return {String}
25960
 
         */
25961
 
        Node.prototype.toString = function() {
25962
 
          return '';
25963
 
        };
25964
 
 
25965
 
        /**
25966
 
         * Get LaTeX representation
25967
 
         * @return {String}
25968
 
         */
25969
 
        Node.prototype.toTex = function() {
25970
 
          return '';
25971
 
        };
25972
 
 
25973
 
        /**
25974
 
         * Test whether an object is a Node
25975
 
         * @param {*} object
25976
 
         * @returns {boolean} isNode
25977
 
         */
25978
 
        Node.isNode = function(object) {
25979
 
          return object instanceof Node;
25980
 
        };
25981
 
 
25982
 
        /**
25983
 
         * Validate the symbol names of a scope.
25984
 
         * Throws an error when the scope contains an illegal symbol.
25985
 
         * @param {Object} scope
25986
 
         */
25987
 
        function _validateScope (scope) {
25988
 
          for (var symbol in scope) {
25989
 
            if (scope.hasOwnProperty(symbol)) {
25990
 
              if (symbol in keywords) {
25991
 
                throw new Error('Scope contains an illegal symbol, "' + symbol + '" is a reserved keyword');
25992
 
              }
25993
 
            }
25994
 
          }
25995
 
        }
25996
 
 
25997
 
        /**
25998
 
         * Replace all functions having a transform function attached at property transform
25999
 
         * with their transform.
26000
 
         * @param {Object} math
26001
 
         * @return {Object} transformed
26002
 
         * @private
26003
 
         */
26004
 
        function _transform(math) {
26005
 
          var transformed = Object.create(math);
26006
 
 
26007
 
          for (var name in math) {
26008
 
            if (math.hasOwnProperty(name)) {
26009
 
              var fn = math[name];
26010
 
              var transform = fn && fn.transform;
26011
 
              if (transform) {
26012
 
                transformed[name] = transform;
26013
 
              }
26014
 
            }
26015
 
          }
26016
 
 
26017
 
          return transformed;
26018
 
        }
26019
 
 
26020
 
        module.exports = Node;
26021
 
 
26022
 
 
26023
 
/***/ },
26024
 
/* 174 */
26025
 
/***/ function(module, exports, __webpack_require__) {
26026
 
 
26027
 
        var DimensionError = __webpack_require__(156);
26028
 
        var IndexError = __webpack_require__(157);
26029
 
 
26030
 
        /**
26031
 
         * Transform zero-based indices to one-based indices in errors
26032
 
         * @param {Error} err
26033
 
         * @returns {Error} Returns the transformed error
26034
 
         */
26035
 
        exports.transform = function (err) {
26036
 
          if (err instanceof IndexError) {
26037
 
            return new IndexError(err.index + 1, err.min + 1, err.max + 1);
26038
 
          }
26039
 
 
26040
 
          return err;
26041
 
        };
26042
 
 
26043
 
 
26044
 
/***/ },
26045
 
/* 175 */
26046
 
/***/ function(module, exports, __webpack_require__) {
26047
 
 
26048
 
        'use strict';
26049
 
 
26050
 
        /**
26051
 
         * Test whether value is a Boolean
26052
 
         * @param {*} value
26053
 
         * @return {Boolean} isBoolean
26054
 
         */
26055
 
        exports.isBoolean = function(value) {
26056
 
          return (value instanceof Boolean) || (typeof value == 'boolean');
26057
 
        };
26058
 
 
26059
 
 
26060
 
/***/ },
26061
 
/* 176 */
26062
 
/***/ function(module, exports, __webpack_require__) {
26063
 
 
26064
 
        'use strict';
26065
 
 
26066
 
        var number = __webpack_require__(4),
26067
 
            bignumber = __webpack_require__(152),
26068
 
            BigNumber = __webpack_require__(159);
26069
 
 
26070
 
        /**
26071
 
         * Test whether value is a String
26072
 
         * @param {*} value
26073
 
         * @return {Boolean} isString
26074
 
         */
26075
 
        exports.isString = function(value) {
26076
 
          return (value instanceof String) || (typeof value == 'string');
26077
 
        };
26078
 
 
26079
 
        /**
26080
 
         * Check if a text ends with a certain string.
26081
 
         * @param {String} text
26082
 
         * @param {String} search
26083
 
         */
26084
 
        exports.endsWith = function(text, search) {
26085
 
          var start = text.length - search.length;
26086
 
          var end = text.length;
26087
 
          return (text.substring(start, end) === search);
26088
 
        };
26089
 
 
26090
 
        /**
26091
 
         * Format a value of any type into a string.
26092
 
         *
26093
 
         * Usage:
26094
 
         *     math.format(value)
26095
 
         *     math.format(value, precision)
26096
 
         *
26097
 
         * If value is a function, the returned string is 'function' unless the function
26098
 
         * has a property `description`, in that case this properties value is returned.
26099
 
         *
26100
 
         * Example usage:
26101
 
         *     math.format(2/7);                // '0.2857142857142857'
26102
 
         *     math.format(math.pi, 3);         // '3.14'
26103
 
         *     math.format(new Complex(2, 3));  // '2 + 3i'
26104
 
         *     math.format('hello');            // '"hello"'
26105
 
         *
26106
 
         * @param {*} value             Value to be stringified
26107
 
         * @param {Object | Number | Function} [options]  Formatting options. See
26108
 
         *                                                lib/util/number:format for a
26109
 
         *                                                description of the available
26110
 
         *                                                options.
26111
 
         * @return {String} str
26112
 
         */
26113
 
        exports.format = function(value, options) {
26114
 
          if (number.isNumber(value)) {
26115
 
            return number.format(value, options);
26116
 
          }
26117
 
 
26118
 
          if (value instanceof BigNumber) {
26119
 
            return bignumber.format(value, options);
26120
 
          }
26121
 
 
26122
 
          if (Array.isArray(value)) {
26123
 
            return formatArray(value, options);
26124
 
          }
26125
 
 
26126
 
          if (exports.isString(value)) {
26127
 
            return '"' + value + '"';
26128
 
          }
26129
 
 
26130
 
          if (typeof value === 'function') {
26131
 
            return value.syntax ? value.syntax + '' : 'function';
26132
 
          }
26133
 
 
26134
 
          if (value instanceof Object) {
26135
 
            if (typeof value.format === 'function') {
26136
 
              return value.format(options);
26137
 
            }
26138
 
            else {
26139
 
              return value.toString();
26140
 
            }
26141
 
          }
26142
 
 
26143
 
          return String(value);
26144
 
        };
26145
 
 
26146
 
        /**
26147
 
         * Recursively format an n-dimensional matrix
26148
 
         * Example output: "[[1, 2], [3, 4]]"
26149
 
         * @param {Array} array
26150
 
         * @param {Object | Number | Function} [options]  Formatting options. See
26151
 
         *                                                lib/util/number:format for a
26152
 
         *                                                description of the available
26153
 
         *                                                options.
26154
 
         * @returns {String} str
26155
 
         */
26156
 
        function formatArray (array, options) {
26157
 
          if (Array.isArray(array)) {
26158
 
            var str = '[';
26159
 
            var len = array.length;
26160
 
            for (var i = 0; i < len; i++) {
26161
 
              if (i != 0) {
26162
 
                str += ', ';
26163
 
              }
26164
 
              str += formatArray(array[i], options);
26165
 
            }
26166
 
            str += ']';
26167
 
            return str;
26168
 
          }
26169
 
          else {
26170
 
            return exports.format(array, options);
26171
 
          }
26172
 
        }
26173
 
 
26174
 
 
26175
 
/***/ },
26176
 
/* 177 */
26177
 
/***/ function(module, exports, __webpack_require__) {
26178
 
 
26179
 
        module.exports = {
26180
 
          'name': 'e',
26181
 
          'category': 'Constants',
26182
 
          'syntax': [
26183
 
            'e'
26184
 
          ],
26185
 
          'description': 'Euler\'s number, the base of the natural logarithm. Approximately equal to 2.71828',
26186
 
          'examples': [
26187
 
            'e',
26188
 
            'e ^ 2',
26189
 
            'exp(2)',
26190
 
            'log(e)'
26191
 
          ],
26192
 
          'seealso': ['exp']
26193
 
        };
26194
 
 
26195
 
 
26196
 
/***/ },
26197
 
/* 178 */
26198
 
/***/ function(module, exports, __webpack_require__) {
26199
 
 
26200
 
        module.exports = {
26201
 
          'name': 'false',
26202
 
          'category': 'Constants',
26203
 
          'syntax': [
26204
 
            'false'
26205
 
          ],
26206
 
          'description': 'Boolean value false',
26207
 
          'examples': [
26208
 
            'false'
26209
 
          ],
26210
 
          'seealso': ['true']
26211
 
        };
26212
 
 
26213
 
 
26214
 
/***/ },
26215
 
/* 179 */
26216
 
/***/ function(module, exports, __webpack_require__) {
26217
 
 
26218
 
        module.exports = {
26219
 
          'name': 'i',
26220
 
          'category': 'Constants',
26221
 
          'syntax': [
26222
 
            'i'
26223
 
          ],
26224
 
          'description': 'Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.',
26225
 
          'examples': [
26226
 
            'i',
26227
 
            'i * i',
26228
 
            'sqrt(-1)'
26229
 
          ],
26230
 
          'seealso': []
26231
 
        };
26232
 
 
26233
 
 
26234
 
/***/ },
26235
 
/* 180 */
26236
 
/***/ function(module, exports, __webpack_require__) {
26237
 
 
26238
 
        module.exports = {
26239
 
          'name': 'Infinity',
26240
 
          'category': 'Constants',
26241
 
          'syntax': [
26242
 
            'Infinity'
26243
 
          ],
26244
 
          'description': 'Infinity, a number which is larger than the maximum number that can be handled by a floating point number.',
26245
 
          'examples': [
26246
 
            'Infinity',
26247
 
            '1 / 0'
26248
 
          ],
26249
 
          'seealso': []
26250
 
        };
26251
 
 
26252
 
 
26253
 
/***/ },
26254
 
/* 181 */
26255
 
/***/ function(module, exports, __webpack_require__) {
26256
 
 
26257
 
        module.exports = {
26258
 
          'name': 'LN2',
26259
 
          'category': 'Constants',
26260
 
          'syntax': [
26261
 
            'LN2'
26262
 
          ],
26263
 
          'description': 'Returns the natural logarithm of 2, approximately equal to 0.693',
26264
 
          'examples': [
26265
 
            'LN2',
26266
 
            'log(2)'
26267
 
          ],
26268
 
          'seealso': []
26269
 
        };
26270
 
 
26271
 
 
26272
 
/***/ },
26273
 
/* 182 */
26274
 
/***/ function(module, exports, __webpack_require__) {
26275
 
 
26276
 
        module.exports = {
26277
 
          'name': 'LN10',
26278
 
          'category': 'Constants',
26279
 
          'syntax': [
26280
 
            'LN10'
26281
 
          ],
26282
 
          'description': 'Returns the natural logarithm of 10, approximately equal to 2.302',
26283
 
          'examples': [
26284
 
            'LN10',
26285
 
            'log(10)'
26286
 
          ],
26287
 
          'seealso': []
26288
 
        };
26289
 
 
26290
 
 
26291
 
/***/ },
26292
 
/* 183 */
26293
 
/***/ function(module, exports, __webpack_require__) {
26294
 
 
26295
 
        module.exports = {
26296
 
          'name': 'LOG2E',
26297
 
          'category': 'Constants',
26298
 
          'syntax': [
26299
 
            'LOG2E'
26300
 
          ],
26301
 
          'description': 'Returns the base-2 logarithm of E, approximately equal to 1.442',
26302
 
          'examples': [
26303
 
            'LOG2E',
26304
 
            'log(e, 2)'
26305
 
          ],
26306
 
          'seealso': []
26307
 
        };
26308
 
 
26309
 
 
26310
 
/***/ },
26311
 
/* 184 */
26312
 
/***/ function(module, exports, __webpack_require__) {
26313
 
 
26314
 
        module.exports = {
26315
 
          'name': 'LOG10E',
26316
 
          'category': 'Constants',
26317
 
          'syntax': [
26318
 
            'LOG10E'
26319
 
          ],
26320
 
          'description': 'Returns the base-10 logarithm of E, approximately equal to 0.434',
26321
 
          'examples': [
26322
 
            'LOG10E',
26323
 
            'log(e, 10)'
26324
 
          ],
26325
 
          'seealso': []
26326
 
        };
26327
 
 
26328
 
 
26329
 
/***/ },
26330
 
/* 185 */
26331
 
/***/ function(module, exports, __webpack_require__) {
26332
 
 
26333
 
        module.exports = {
26334
 
          'name': 'NaN',
26335
 
          'category': 'Constants',
26336
 
          'syntax': [
26337
 
            'NaN'
26338
 
          ],
26339
 
          'description': 'Not a number',
26340
 
          'examples': [
26341
 
            'NaN',
26342
 
            '0 / 0'
26343
 
          ],
26344
 
          'seealso': []
26345
 
        };
26346
 
 
26347
 
 
26348
 
/***/ },
26349
 
/* 186 */
26350
 
/***/ function(module, exports, __webpack_require__) {
26351
 
 
26352
 
        module.exports = {
26353
 
          'name': 'null',
26354
 
          'category': 'Constants',
26355
 
          'syntax': [
26356
 
            'null'
26357
 
          ],
26358
 
          'description': 'Value null',
26359
 
          'examples': [
26360
 
            'null'
26361
 
          ],
26362
 
          'seealso': ['true', 'false']
26363
 
        };
26364
 
 
26365
 
 
26366
 
/***/ },
26367
 
/* 187 */
26368
 
/***/ function(module, exports, __webpack_require__) {
26369
 
 
26370
 
        module.exports = {
26371
 
          'name': 'pi',
26372
 
          'category': 'Constants',
26373
 
          'syntax': [
26374
 
            'pi'
26375
 
          ],
26376
 
          'description': 'The number pi is a mathematical constant that is the ratio of a circle\'s circumference to its diameter, and is approximately equal to 3.14159',
26377
 
          'examples': [
26378
 
            'pi',
26379
 
            'sin(pi/2)'
26380
 
          ],
26381
 
          'seealso': ['tau']
26382
 
        };
26383
 
 
26384
 
 
26385
 
/***/ },
26386
 
/* 188 */
26387
 
/***/ function(module, exports, __webpack_require__) {
26388
 
 
26389
 
        module.exports = {
26390
 
          'name': 'phi',
26391
 
          'category': 'Constants',
26392
 
          'syntax': [
26393
 
            'phi'
26394
 
          ],
26395
 
          'description': 'Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...',
26396
 
          'examples': [
26397
 
            'tau'
26398
 
          ],
26399
 
          'seealso': []
26400
 
        };
26401
 
 
26402
 
 
26403
 
/***/ },
26404
 
/* 189 */
26405
 
/***/ function(module, exports, __webpack_require__) {
26406
 
 
26407
 
        module.exports = {
26408
 
          'name': 'SQRT1_2',
26409
 
          'category': 'Constants',
26410
 
          'syntax': [
26411
 
            'SQRT1_2'
26412
 
          ],
26413
 
          'description': 'Returns the square root of 1/2, approximately equal to 0.707',
26414
 
          'examples': [
26415
 
            'SQRT1_2',
26416
 
            'sqrt(1/2)'
26417
 
          ],
26418
 
          'seealso': []
26419
 
        };
26420
 
 
26421
 
 
26422
 
/***/ },
26423
 
/* 190 */
26424
 
/***/ function(module, exports, __webpack_require__) {
26425
 
 
26426
 
        module.exports = {
26427
 
          'name': 'SQRT2',
26428
 
          'category': 'Constants',
26429
 
          'syntax': [
26430
 
            'SQRT2'
26431
 
          ],
26432
 
          'description': 'Returns the square root of 2, approximately equal to 1.414',
26433
 
          'examples': [
26434
 
            'SQRT2',
26435
 
            'sqrt(2)'
26436
 
          ],
26437
 
          'seealso': []
26438
 
        };
26439
 
 
26440
 
 
26441
 
/***/ },
26442
 
/* 191 */
26443
 
/***/ function(module, exports, __webpack_require__) {
26444
 
 
26445
 
        module.exports = {
26446
 
          'name': 'tau',
26447
 
          'category': 'Constants',
26448
 
          'syntax': [
26449
 
            'tau'
26450
 
          ],
26451
 
          'description': 'Tau is the ratio constant of a circle\'s circumference to radius, equal to 2 * pi, approximately 6.2832.',
26452
 
          'examples': [
26453
 
            'tau',
26454
 
            '2 * pi'
26455
 
          ],
26456
 
          'seealso': ['pi']
26457
 
        };
26458
 
 
26459
 
 
26460
 
/***/ },
26461
 
/* 192 */
26462
 
/***/ function(module, exports, __webpack_require__) {
26463
 
 
26464
 
        module.exports = {
26465
 
          'name': 'true',
26466
 
          'category': 'Constants',
26467
 
          'syntax': [
26468
 
            'true'
26469
 
          ],
26470
 
          'description': 'Boolean value true',
26471
 
          'examples': [
26472
 
            'true'
26473
 
          ],
26474
 
          'seealso': ['false']
26475
 
        };
26476
 
 
26477
 
 
26478
 
/***/ },
26479
 
/* 193 */
26480
 
/***/ function(module, exports, __webpack_require__) {
26481
 
 
26482
 
        module.exports = {
26483
 
          'name': 'version',
26484
 
          'category': 'Constants',
26485
 
          'syntax': [
26486
 
            'version'
26487
 
          ],
26488
 
          'description': 'A string with the version number of math.js',
26489
 
          'examples': [
26490
 
            'version'
26491
 
          ],
26492
 
          'seealso': []
26493
 
        };
26494
 
 
26495
 
 
26496
 
/***/ },
26497
 
/* 194 */
26498
 
/***/ function(module, exports, __webpack_require__) {
26499
 
 
26500
 
        'use strict';
26501
 
 
26502
 
        // NOTE: distribution is NOT added to math.distribution but returned by the factory function
26503
 
        // TODO: rethink math.distribution
26504
 
 
26505
 
        module.exports = function (math) {
26506
 
          var Matrix = __webpack_require__(9);
26507
 
          var array = __webpack_require__(153);
26508
 
          var collection = __webpack_require__(13);
26509
 
          var isCollection = collection.isCollection;
26510
 
 
26511
 
          /**
26512
 
           * Create a distribution object with a set of random functions for given
26513
 
           * random distribution.
26514
 
           *
26515
 
           * Syntax:
26516
 
           *
26517
 
           *     math.distribution(name)
26518
 
           *
26519
 
           * Examples:
26520
 
           *
26521
 
           *     var normalDist = math.distribution('normal'); // create a normal distribution
26522
 
           *     normalDist.random(0, 10);                      // get a random value between 0 and 10
26523
 
           *
26524
 
           * See also:
26525
 
           *
26526
 
           *     random, randomInt, pickRandom
26527
 
           *
26528
 
           * @param {String} name   Name of a distribution. Choose from 'uniform', 'normal'.
26529
 
           * @return {Object}       Returns a distribution object containing functions:
26530
 
           *                        `random([size] [, min] [, max])`,
26531
 
           *                        `randomInt([min] [, max])`,
26532
 
           *                        `pickRandom(array)`
26533
 
           */
26534
 
          function distribution(name) {
26535
 
            if (!distributions.hasOwnProperty(name))
26536
 
              throw new Error('Unknown distribution ' + name);
26537
 
 
26538
 
            var args = Array.prototype.slice.call(arguments, 1),
26539
 
                distribution = distributions[name].apply(this, args);
26540
 
 
26541
 
            return (function(distribution) {
26542
 
 
26543
 
              // This is the public API for all distributions
26544
 
              var randFunctions = {
26545
 
 
26546
 
                random: function(arg1, arg2, arg3) {
26547
 
                  var size, min, max;
26548
 
                  if (arguments.length > 3) {
26549
 
                    throw new math.error.ArgumentsError('random', arguments.length, 0, 3);
26550
 
 
26551
 
                  // `random(max)` or `random(size)`
26552
 
                  } else if (arguments.length === 1) {
26553
 
                    if (isCollection(arg1)) {
26554
 
                      size = arg1;
26555
 
                    }
26556
 
                    else {
26557
 
                      max = arg1;
26558
 
                    }
26559
 
                  // `random(min, max)` or `random(size, max)`
26560
 
                  } else if (arguments.length === 2) {
26561
 
                    if (isCollection(arg1)) {
26562
 
                      size = arg1;
26563
 
                      max = arg2;
26564
 
                    }
26565
 
                    else {
26566
 
                      min = arg1;
26567
 
                      max = arg2;
26568
 
                    }
26569
 
                  // `random(size, min, max)`
26570
 
                  } else {
26571
 
                    size = arg1;
26572
 
                    min = arg2;
26573
 
                    max = arg3;
26574
 
                  }
26575
 
 
26576
 
                  // TODO: validate type of min, max, and size
26577
 
 
26578
 
                  if (max === undefined) max = 1;
26579
 
                  if (min === undefined) min = 0;
26580
 
                  if (size !== undefined) {
26581
 
                    var res = _randomDataForMatrix(size.valueOf(), min, max, _random);
26582
 
                    return (size instanceof Matrix) ? new Matrix(res) : res;
26583
 
                  }
26584
 
                  else return _random(min, max);
26585
 
                },
26586
 
 
26587
 
                randomInt: function(arg1, arg2, arg3) {
26588
 
                  var size, min, max;
26589
 
                  if (arguments.length > 3 || arguments.length < 1)
26590
 
                    throw new math.error.ArgumentsError('randomInt', arguments.length, 1, 3);
26591
 
 
26592
 
                  // `random(max)` or `random(size)`
26593
 
                  else if (arguments.length === 1)
26594
 
                    if (isCollection(arg1)) {
26595
 
                      size = arg1;
26596
 
                    }
26597
 
                    else {
26598
 
                      max = arg1;
26599
 
                    }
26600
 
                  // `randomInt(min, max)` or `randomInt(size, max)`
26601
 
                  else if (arguments.length === 2) {
26602
 
                    if (isCollection(arg1)) {
26603
 
                      size = arg1;
26604
 
                      max = arg2;
26605
 
                    }
26606
 
                    else {
26607
 
                      min = arg1;
26608
 
                      max = arg2;
26609
 
                    }
26610
 
                  // `randomInt(size, min, max)`
26611
 
                  } else {
26612
 
                    size = arg1;
26613
 
                    min = arg2;
26614
 
                    max = arg3;
26615
 
                  }
26616
 
 
26617
 
                  // TODO: validate type of min, max, and size
26618
 
 
26619
 
                  if (min === undefined) min = 0;
26620
 
                  if (size !== undefined) {
26621
 
                    var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);
26622
 
                    return (size instanceof Matrix) ? new Matrix(res) : res;
26623
 
                  }
26624
 
                  else return _randomInt(min, max);
26625
 
                },
26626
 
 
26627
 
                pickRandom: function(possibles) {
26628
 
                  if (arguments.length !== 1) {
26629
 
                    throw new math.error.ArgumentsError('pickRandom', arguments.length, 1);
26630
 
                  }
26631
 
                  if (possibles instanceof Matrix) {
26632
 
                    possibles = possibles.valueOf(); // get Array
26633
 
                  }
26634
 
                  else if (!Array.isArray(possibles)) {
26635
 
                    throw new math.error.UnsupportedTypeError('pickRandom', math['typeof'](possibles));
26636
 
                  }
26637
 
 
26638
 
                  if (array.size(possibles).length > 1) {
26639
 
                    throw new Error('Only one dimensional vectors supported');
26640
 
                  }
26641
 
 
26642
 
                  // TODO: add support for multi dimensional matrices
26643
 
                  return possibles[Math.floor(Math.random() * possibles.length)];
26644
 
                }
26645
 
 
26646
 
              };
26647
 
 
26648
 
              var _random = function(min, max) {
26649
 
                return min + distribution() * (max - min);
26650
 
              };
26651
 
 
26652
 
              var _randomInt = function(min, max) {
26653
 
                return Math.floor(min + distribution() * (max - min));
26654
 
              };
26655
 
 
26656
 
              // This is a function for generating a random matrix recursively.
26657
 
              var _randomDataForMatrix = function(size, min, max, randFunc) {
26658
 
                var data = [], length, i;
26659
 
                size = size.slice(0);
26660
 
 
26661
 
                if (size.length > 1) {
26662
 
                  for (i = 0, length = size.shift(); i < length; i++)
26663
 
                    data.push(_randomDataForMatrix(size, min, max, randFunc));
26664
 
                } else {
26665
 
                  for (i = 0, length = size.shift(); i < length; i++)
26666
 
                    data.push(randFunc(min, max));
26667
 
                }
26668
 
 
26669
 
                return data;
26670
 
              };
26671
 
 
26672
 
              return randFunctions;
26673
 
 
26674
 
            })(distribution);
26675
 
          };
26676
 
 
26677
 
          // Each distribution is a function that takes no argument and when called returns
26678
 
          // a number between 0 and 1.
26679
 
          var distributions = {
26680
 
 
26681
 
            uniform: function() {
26682
 
              return Math.random;
26683
 
            },
26684
 
 
26685
 
            // Implementation of normal distribution using Box-Muller transform
26686
 
            // ref : http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform
26687
 
            // We take : mean = 0.5, standard deviation = 1/6
26688
 
            // so that 99.7% values are in [0, 1].
26689
 
            normal: function() {
26690
 
              return function() {
26691
 
                var u1, u2,
26692
 
                    picked = -1;
26693
 
                // We reject values outside of the interval [0, 1]
26694
 
                // TODO: check if it is ok to do that?
26695
 
                while (picked < 0 || picked > 1) {
26696
 
                  u1 = Math.random();
26697
 
                  u2 = Math.random();
26698
 
                  picked = 1/6 * Math.pow(-2 * Math.log(u1), 0.5) * Math.cos(2 * Math.PI * u2) + 0.5;
26699
 
                }
26700
 
                return picked;
26701
 
              }
26702
 
            }
26703
 
          };
26704
 
 
26705
 
          return distribution;
26706
 
        };
26707
 
 
26708
 
 
26709
 
/***/ },
26710
 
/* 195 */
26711
 
/***/ function(module, exports, __webpack_require__) {
26712
 
 
26713
 
        var map = {
26714
 
                "./clone": 143,
26715
 
                "./clone.js": 143,
26716
 
                "./filter": 144,
26717
 
                "./filter.js": 144,
26718
 
                "./forEach": 151,
26719
 
                "./forEach.js": 151,
26720
 
                "./format": 145,
26721
 
                "./format.js": 145,
26722
 
                "./import": 146,
26723
 
                "./import.js": 146,
26724
 
                "./map": 147,
26725
 
                "./map.js": 147,
26726
 
                "./print": 148,
26727
 
                "./print.js": 148,
26728
 
                "./sort": 149,
26729
 
                "./sort.js": 149,
26730
 
                "./typeof": 150,
26731
 
                "./typeof.js": 150
26732
 
        };
26733
 
        function webpackContext(req) {
26734
 
                return __webpack_require__(webpackContextResolve(req));
26735
 
        };
26736
 
        function webpackContextResolve(req) {
26737
 
                return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
26738
 
        };
26739
 
        webpackContext.keys = function webpackContextKeys() {
26740
 
                return Object.keys(map);
26741
 
        };
26742
 
        webpackContext.resolve = webpackContextResolve;
26743
 
        module.exports = webpackContext;
26744
 
        webpackContext.id = 195;
26745
 
 
26746
 
 
26747
 
/***/ },
26748
 
/* 196 */
26749
 
/***/ function(module, exports, __webpack_require__) {
26750
 
 
26751
 
        'use strict';
26752
 
 
26753
 
        /**
26754
 
         * Determine the type of a variable
26755
 
         *
26756
 
         *     type(x)
26757
 
         *
26758
 
         * @param {*} x
26759
 
         * @return {String} type  Lower case type, for example 'number', 'string',
26760
 
         *                        'array', 'date'.
26761
 
         */
26762
 
        exports.type = function(x) {
26763
 
          var type = typeof x;
26764
 
 
26765
 
          if (type === 'object') {
26766
 
            if (x === null)           return 'null';
26767
 
            if (x instanceof Boolean) return 'boolean';
26768
 
            if (x instanceof Number)  return 'number';
26769
 
            if (x instanceof String)  return 'string';
26770
 
            if (Array.isArray(x))     return 'array';
26771
 
            if (x instanceof Date)    return 'date';
26772
 
            if (x instanceof Function)return 'function';
26773
 
            if (x instanceof RegExp)  return 'regexp';
26774
 
          }
26775
 
 
26776
 
          return type;
26777
 
        };
26778
 
 
26779
 
 
26780
 
/***/ },
26781
 
/* 197 */
26782
 
/***/ function(module, exports, __webpack_require__) {
26783
 
 
26784
 
        module.exports = {
26785
 
          'name': 'abs',
26786
 
          'category': 'Arithmetic',
26787
 
          'syntax': [
26788
 
            'abs(x)'
26789
 
          ],
26790
 
          'description': 'Compute the absolute value.',
26791
 
          'examples': [
26792
 
            'abs(3.5)',
26793
 
            'abs(-4.2)'
26794
 
          ],
26795
 
          'seealso': ['sign']
26796
 
        };
26797
 
 
26798
 
 
26799
 
/***/ },
26800
 
/* 198 */
26801
 
/***/ function(module, exports, __webpack_require__) {
26802
 
 
26803
 
        module.exports = {
26804
 
          'name': 'add',
26805
 
          'category': 'Operators',
26806
 
          'syntax': [
26807
 
            'x + y',
26808
 
            'add(x, y)'
26809
 
          ],
26810
 
          'description': 'Add two values.',
26811
 
          'examples': [
26812
 
            'a = 2.1 + 3.6',
26813
 
            'a - 3.6',
26814
 
            '3 + 2i',
26815
 
            '"hello" + " world"',
26816
 
            '3 cm + 2 inch'
26817
 
          ],
26818
 
          'seealso': [
26819
 
            'subtract'
26820
 
          ]
26821
 
        };
26822
 
 
26823
 
 
26824
 
/***/ },
26825
 
/* 199 */
26826
 
/***/ function(module, exports, __webpack_require__) {
26827
 
 
26828
 
        module.exports = {
26829
 
          'name': 'ceil',
26830
 
          'category': 'Arithmetic',
26831
 
          'syntax': [
26832
 
            'ceil(x)'
26833
 
          ],
26834
 
          'description':
26835
 
              'Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.',
26836
 
          'examples': [
26837
 
            'ceil(3.2)',
26838
 
            'ceil(3.8)',
26839
 
            'ceil(-4.2)'
26840
 
          ],
26841
 
          'seealso': ['floor', 'fix', 'round']
26842
 
        };
26843
 
 
26844
 
 
26845
 
/***/ },
26846
 
/* 200 */
26847
 
/***/ function(module, exports, __webpack_require__) {
26848
 
 
26849
 
        module.exports = {
26850
 
          'name': 'cube',
26851
 
          'category': 'Arithmetic',
26852
 
          'syntax': [
26853
 
            'cube(x)'
26854
 
          ],
26855
 
          'description': 'Compute the cube of a value. The cube of x is x * x * x.',
26856
 
          'examples': [
26857
 
            'cube(2)',
26858
 
            '2^3',
26859
 
            '2 * 2 * 2'
26860
 
          ],
26861
 
          'seealso': [
26862
 
            'multiply',
26863
 
            'square',
26864
 
            'pow'
26865
 
          ]
26866
 
        };
26867
 
 
26868
 
 
26869
 
/***/ },
26870
 
/* 201 */
26871
 
/***/ function(module, exports, __webpack_require__) {
26872
 
 
26873
 
        module.exports = {
26874
 
          'name': 'divide',
26875
 
          'category': 'Operators',
26876
 
          'syntax': [
26877
 
            'x / y',
26878
 
            'divide(x, y)'
26879
 
          ],
26880
 
          'description': 'Divide two values.',
26881
 
          'examples': [
26882
 
            'a = 2 / 3',
26883
 
            'a * 3',
26884
 
            '4.5 / 2',
26885
 
            '3 + 4 / 2',
26886
 
            '(3 + 4) / 2',
26887
 
            '18 km / 4.5'
26888
 
          ],
26889
 
          'seealso': [
26890
 
            'multiply'
26891
 
          ]
26892
 
        };
26893
 
 
26894
 
 
26895
 
/***/ },
26896
 
/* 202 */
26897
 
/***/ function(module, exports, __webpack_require__) {
26898
 
 
26899
 
        module.exports = {
26900
 
          'name': 'dotDivide',
26901
 
          'category': 'Operators',
26902
 
          'syntax': [
26903
 
            'x ./ y',
26904
 
            'dotDivide(x, y)'
26905
 
          ],
26906
 
          'description': 'Divide two values element wise.',
26907
 
          'examples': [
26908
 
            'a = [1, 2, 3; 4, 5, 6]',
26909
 
            'b = [2, 1, 1; 3, 2, 5]',
26910
 
            'a ./ b'
26911
 
          ],
26912
 
          'seealso': [
26913
 
            'multiply',
26914
 
            'dotMultiply',
26915
 
            'divide'
26916
 
          ]
26917
 
        };
26918
 
 
26919
 
 
26920
 
/***/ },
26921
 
/* 203 */
26922
 
/***/ function(module, exports, __webpack_require__) {
26923
 
 
26924
 
        module.exports = {
26925
 
          'name': 'dotMultiply',
26926
 
          'category': 'Operators',
26927
 
          'syntax': [
26928
 
            'x .* y',
26929
 
            'dotMultiply(x, y)'
26930
 
          ],
26931
 
          'description': 'Multiply two values element wise.',
26932
 
          'examples': [
26933
 
            'a = [1, 2, 3; 4, 5, 6]',
26934
 
            'b = [2, 1, 1; 3, 2, 5]',
26935
 
            'a .* b'
26936
 
          ],
26937
 
          'seealso': [
26938
 
            'multiply',
26939
 
            'divide',
26940
 
            'dotDivide'
26941
 
          ]
26942
 
        };
26943
 
 
26944
 
 
26945
 
/***/ },
26946
 
/* 204 */
26947
 
/***/ function(module, exports, __webpack_require__) {
26948
 
 
26949
 
        module.exports = {
26950
 
          'name': 'dotpow',
26951
 
          'category': 'Operators',
26952
 
          'syntax': [
26953
 
            'x .^ y',
26954
 
            'dotpow(x, y)'
26955
 
          ],
26956
 
          'description':
26957
 
              'Calculates the power of x to y element wise.',
26958
 
          'examples': [
26959
 
            'a = [1, 2, 3; 4, 5, 6]',
26960
 
            'a .^ 2'
26961
 
          ],
26962
 
          'seealso': [
26963
 
            'pow'
26964
 
          ]
26965
 
        };
26966
 
 
26967
 
 
26968
 
/***/ },
26969
 
/* 205 */
26970
 
/***/ function(module, exports, __webpack_require__) {
26971
 
 
26972
 
        module.exports = {
26973
 
          'name': 'exp',
26974
 
          'category': 'Arithmetic',
26975
 
          'syntax': [
26976
 
            'exp(x)'
26977
 
          ],
26978
 
          'description': 'Calculate the exponent of a value.',
26979
 
          'examples': [
26980
 
            'exp(1.3)',
26981
 
            'e ^ 1.3',
26982
 
            'log(exp(1.3))',
26983
 
            'x = 2.4',
26984
 
            '(exp(i*x) == cos(x) + i*sin(x))   # Euler\'s formula'
26985
 
          ],
26986
 
          'seealso': [
26987
 
            'pow',
26988
 
            'log'
26989
 
          ]
26990
 
        };
26991
 
 
26992
 
 
26993
 
/***/ },
26994
 
/* 206 */
26995
 
/***/ function(module, exports, __webpack_require__) {
26996
 
 
26997
 
        module.exports = {
26998
 
          'name': 'fix',
26999
 
          'category': 'Arithmetic',
27000
 
          'syntax': [
27001
 
            'fix(x)'
27002
 
          ],
27003
 
          'description':
27004
 
              'Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.',
27005
 
          'examples': [
27006
 
            'fix(3.2)',
27007
 
            'fix(3.8)',
27008
 
            'fix(-4.2)',
27009
 
            'fix(-4.8)'
27010
 
          ],
27011
 
          'seealso': ['ceil', 'floor', 'round']
27012
 
        };
27013
 
 
27014
 
 
27015
 
/***/ },
27016
 
/* 207 */
27017
 
/***/ function(module, exports, __webpack_require__) {
27018
 
 
27019
 
        module.exports = {
27020
 
          'name': 'floor',
27021
 
          'category': 'Arithmetic',
27022
 
          'syntax': [
27023
 
            'floor(x)'
27024
 
          ],
27025
 
          'description':
27026
 
              'Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.',
27027
 
          'examples': [
27028
 
            'floor(3.2)',
27029
 
            'floor(3.8)',
27030
 
            'floor(-4.2)'
27031
 
          ],
27032
 
          'seealso': ['ceil', 'fix', 'round']
27033
 
        };
27034
 
 
27035
 
 
27036
 
/***/ },
27037
 
/* 208 */
27038
 
/***/ function(module, exports, __webpack_require__) {
27039
 
 
27040
 
        module.exports = {
27041
 
          'name': 'gcd',
27042
 
          'category': 'Arithmetic',
27043
 
          'syntax': [
27044
 
            'gcd(a, b)',
27045
 
            'gcd(a, b, c, ...)'
27046
 
          ],
27047
 
          'description': 'Compute the greatest common divisor.',
27048
 
          'examples': [
27049
 
            'gcd(8, 12)',
27050
 
            'gcd(-4, 6)',
27051
 
            'gcd(25, 15, -10)'
27052
 
          ],
27053
 
          'seealso': [ 'lcm', 'xgcd' ]
27054
 
        };
27055
 
 
27056
 
 
27057
 
/***/ },
27058
 
/* 209 */
27059
 
/***/ function(module, exports, __webpack_require__) {
27060
 
 
27061
 
        module.exports = {
27062
 
          'name': 'lcm',
27063
 
          'category': 'Arithmetic',
27064
 
          'syntax': [
27065
 
            'lcm(x, y)'
27066
 
          ],
27067
 
          'description': 'Compute the least common multiple.',
27068
 
          'examples': [
27069
 
            'lcm(4, 6)',
27070
 
            'lcm(6, 21)',
27071
 
            'lcm(6, 21, 5)'
27072
 
          ],
27073
 
          'seealso': [ 'gcd' ]
27074
 
        };
27075
 
 
27076
 
 
27077
 
/***/ },
27078
 
/* 210 */
27079
 
/***/ function(module, exports, __webpack_require__) {
27080
 
 
27081
 
        module.exports = {
27082
 
          'name': 'log',
27083
 
          'category': 'Arithmetic',
27084
 
          'syntax': [
27085
 
            'log(x)',
27086
 
            'log(x, base)'
27087
 
          ],
27088
 
          'description': 'Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).',
27089
 
          'examples': [
27090
 
            'log(3.5)',
27091
 
            'a = log(2.4)',
27092
 
            'exp(a)',
27093
 
            '10 ^ 4',
27094
 
            'log(10000, 10)',
27095
 
            'log(10000) / log(10)',
27096
 
            'b = log(1024, 2)',
27097
 
            '2 ^ b'
27098
 
          ],
27099
 
          'seealso': [
27100
 
            'exp',
27101
 
            'log10'
27102
 
          ]
27103
 
        };
27104
 
 
27105
 
/***/ },
27106
 
/* 211 */
27107
 
/***/ function(module, exports, __webpack_require__) {
27108
 
 
27109
 
        module.exports = {
27110
 
          'name': 'log10',
27111
 
          'category': 'Arithmetic',
27112
 
          'syntax': [
27113
 
            'log10(x)'
27114
 
          ],
27115
 
          'description': 'Compute the 10-base logarithm of a value.',
27116
 
          'examples': [
27117
 
            'log10(0.00001)',
27118
 
            'log10(10000)',
27119
 
            '10 ^ 4',
27120
 
            'log(10000) / log(10)',
27121
 
            'log(10000, 10)'
27122
 
          ],
27123
 
          'seealso': [
27124
 
            'exp',
27125
 
            'log'
27126
 
          ]
27127
 
        };
27128
 
 
27129
 
 
27130
 
/***/ },
27131
 
/* 212 */
27132
 
/***/ function(module, exports, __webpack_require__) {
27133
 
 
27134
 
        module.exports = {
27135
 
          'name': 'mod',
27136
 
          'category': 'Operators',
27137
 
          'syntax': [
27138
 
            'x % y',
27139
 
            'x mod y',
27140
 
            'mod(x, y)'
27141
 
          ],
27142
 
          'description':
27143
 
              'Calculates the modulus, the remainder of an integer division.',
27144
 
          'examples': [
27145
 
            '7 % 3',
27146
 
            '11 % 2',
27147
 
            '10 mod 4',
27148
 
            'function isOdd(x) = x % 2',
27149
 
            'isOdd(2)',
27150
 
            'isOdd(3)'
27151
 
          ],
27152
 
          'seealso': ['divide']
27153
 
        };
27154
 
 
27155
 
 
27156
 
/***/ },
27157
 
/* 213 */
27158
 
/***/ function(module, exports, __webpack_require__) {
27159
 
 
27160
 
        module.exports = {
27161
 
          'name': 'multiply',
27162
 
          'category': 'Operators',
27163
 
          'syntax': [
27164
 
            'x * y',
27165
 
            'multiply(x, y)'
27166
 
          ],
27167
 
          'description': 'multiply two values.',
27168
 
          'examples': [
27169
 
            'a = 2.1 * 3.4',
27170
 
            'a / 3.4',
27171
 
            '2 * 3 + 4',
27172
 
            '2 * (3 + 4)',
27173
 
            '3 * 2.1 km'
27174
 
          ],
27175
 
          'seealso': [
27176
 
            'divide'
27177
 
          ]
27178
 
        };
27179
 
 
27180
 
 
27181
 
/***/ },
27182
 
/* 214 */
27183
 
/***/ function(module, exports, __webpack_require__) {
27184
 
 
27185
 
        module.exports = {
27186
 
          'name': 'norm',
27187
 
          'category': 'Arithmetic',
27188
 
          'syntax': [
27189
 
            'norm(x)',
27190
 
            'norm(x, p)'
27191
 
          ],
27192
 
          'description': 'Calculate the norm of a number, vector or matrix.',
27193
 
          'examples': [
27194
 
            'abs(-3.5)',
27195
 
            'norm(-3.5)',
27196
 
            'norm(3 - 4i))',
27197
 
            'norm([1, 2, -3], Infinity)',
27198
 
            'norm([1, 2, -3], -Infinity)',
27199
 
            'norm([3, 4], 2)',
27200
 
            'norm([[1, 2], [3, 4]], 1)',
27201
 
            'norm([[1, 2], [3, 4]], \'inf\')',
27202
 
            'norm([[1, 2], [3, 4]], \'fro\')'
27203
 
          ]
27204
 
        };
27205
 
 
27206
 
 
27207
 
/***/ },
27208
 
/* 215 */
27209
 
/***/ function(module, exports, __webpack_require__) {
27210
 
 
27211
 
        module.exports = {
27212
 
          'name': 'nthRoot',
27213
 
          'category': 'Arithmetic',
27214
 
          'syntax': [
27215
 
            'nthRoot(a)',
27216
 
            'nthRoot(a, root)'
27217
 
          ],
27218
 
          'description': 'Calculate the nth root of a value. ' +
27219
 
              'The principal nth root of a positive real number A, ' +
27220
 
              'is the positive real solution of the equation "x^root = A".',
27221
 
          'examples': [
27222
 
            '4 ^ 3',
27223
 
            'nthRoot(64, 3)',
27224
 
            'nthRoot(9, 2)',
27225
 
            'sqrt(9)'
27226
 
          ],
27227
 
          'seealso': [
27228
 
            'sqrt',
27229
 
            'pow'
27230
 
          ]
27231
 
        };
27232
 
 
27233
 
/***/ },
27234
 
/* 216 */
27235
 
/***/ function(module, exports, __webpack_require__) {
27236
 
 
27237
 
        module.exports = {
27238
 
          'name': 'pow',
27239
 
          'category': 'Operators',
27240
 
          'syntax': [
27241
 
            'x ^ y',
27242
 
            'pow(x, y)'
27243
 
          ],
27244
 
          'description':
27245
 
              'Calculates the power of x to y, x^y.',
27246
 
          'examples': [
27247
 
            '2^3 = 8',
27248
 
            '2*2*2',
27249
 
            '1 + e ^ (pi * i)'
27250
 
          ],
27251
 
          'seealso': [ 'multiply' ]
27252
 
        };
27253
 
 
27254
 
 
27255
 
/***/ },
27256
 
/* 217 */
27257
 
/***/ function(module, exports, __webpack_require__) {
27258
 
 
27259
 
        module.exports = {
27260
 
          'name': 'round',
27261
 
          'category': 'Arithmetic',
27262
 
          'syntax': [
27263
 
            'round(x)',
27264
 
            'round(x, n)'
27265
 
          ],
27266
 
          'description':
27267
 
              'round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.',
27268
 
          'examples': [
27269
 
            'round(3.2)',
27270
 
            'round(3.8)',
27271
 
            'round(-4.2)',
27272
 
            'round(-4.8)',
27273
 
            'round(pi, 3)',
27274
 
            'round(123.45678, 2)'
27275
 
          ],
27276
 
          'seealso': ['ceil', 'floor', 'fix']
27277
 
        };
27278
 
 
27279
 
 
27280
 
/***/ },
27281
 
/* 218 */
27282
 
/***/ function(module, exports, __webpack_require__) {
27283
 
 
27284
 
        module.exports = {
27285
 
          'name': 'sign',
27286
 
          'category': 'Arithmetic',
27287
 
          'syntax': [
27288
 
            'sign(x)'
27289
 
          ],
27290
 
          'description':
27291
 
              'Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.',
27292
 
          'examples': [
27293
 
            'sign(3.5)',
27294
 
            'sign(-4.2)',
27295
 
            'sign(0)'
27296
 
          ],
27297
 
          'seealso': [
27298
 
            'abs'
27299
 
          ]
27300
 
        };
27301
 
 
27302
 
 
27303
 
/***/ },
27304
 
/* 219 */
27305
 
/***/ function(module, exports, __webpack_require__) {
27306
 
 
27307
 
        module.exports = {
27308
 
          'name': 'sqrt',
27309
 
          'category': 'Arithmetic',
27310
 
          'syntax': [
27311
 
            'sqrt(x)'
27312
 
          ],
27313
 
          'description':
27314
 
              'Compute the square root value. If x = y * y, then y is the square root of x.',
27315
 
          'examples': [
27316
 
            'sqrt(25)',
27317
 
            '5 * 5',
27318
 
            'sqrt(-1)'
27319
 
          ],
27320
 
          'seealso': [
27321
 
            'square',
27322
 
            'multiply'
27323
 
          ]
27324
 
        };
27325
 
 
27326
 
 
27327
 
/***/ },
27328
 
/* 220 */
27329
 
/***/ function(module, exports, __webpack_require__) {
27330
 
 
27331
 
        module.exports = {
27332
 
          'name': 'square',
27333
 
          'category': 'Arithmetic',
27334
 
          'syntax': [
27335
 
            'square(x)'
27336
 
          ],
27337
 
          'description':
27338
 
              'Compute the square of a value. The square of x is x * x.',
27339
 
          'examples': [
27340
 
            'square(3)',
27341
 
            'sqrt(9)',
27342
 
            '3^2',
27343
 
            '3 * 3'
27344
 
          ],
27345
 
          'seealso': [
27346
 
            'multiply',
27347
 
            'pow',
27348
 
            'sqrt',
27349
 
            'cube'
27350
 
          ]
27351
 
        };
27352
 
 
27353
 
 
27354
 
/***/ },
27355
 
/* 221 */
27356
 
/***/ function(module, exports, __webpack_require__) {
27357
 
 
27358
 
        module.exports = {
27359
 
          'name': 'subtract',
27360
 
          'category': 'Operators',
27361
 
          'syntax': [
27362
 
            'x - y',
27363
 
            'subtract(x, y)'
27364
 
          ],
27365
 
          'description': 'subtract two values.',
27366
 
          'examples': [
27367
 
            'a = 5.3 - 2',
27368
 
            'a + 2',
27369
 
            '2/3 - 1/6',
27370
 
            '2 * 3 - 3',
27371
 
            '2.1 km - 500m'
27372
 
          ],
27373
 
          'seealso': [
27374
 
            'add'
27375
 
          ]
27376
 
        };
27377
 
 
27378
 
 
27379
 
/***/ },
27380
 
/* 222 */
27381
 
/***/ function(module, exports, __webpack_require__) {
27382
 
 
27383
 
        module.exports = {
27384
 
          'name': 'unaryMinus',
27385
 
          'category': 'Operators',
27386
 
          'syntax': [
27387
 
            '-x',
27388
 
            'unaryMinus(x)'
27389
 
          ],
27390
 
          'description':
27391
 
              'Inverse the sign of a value. Converts booleans and strings to numbers.',
27392
 
          'examples': [
27393
 
            '-4.5',
27394
 
            '-(-5.6)',
27395
 
            '-"22"'
27396
 
          ],
27397
 
          'seealso': [
27398
 
            'add', 'subtract', 'unaryPlus'
27399
 
          ]
27400
 
        };
27401
 
 
27402
 
 
27403
 
/***/ },
27404
 
/* 223 */
27405
 
/***/ function(module, exports, __webpack_require__) {
27406
 
 
27407
 
        module.exports = {
27408
 
          'name': 'unaryPlus',
27409
 
          'category': 'Operators',
27410
 
          'syntax': [
27411
 
            '+x',
27412
 
            'unaryPlus(x)'
27413
 
          ],
27414
 
          'description':
27415
 
              'Converts booleans and strings to numbers.',
27416
 
          'examples': [
27417
 
            '+true',
27418
 
            '+"2"'
27419
 
          ],
27420
 
          'seealso': [
27421
 
            'add', 'subtract', 'unaryMinus'
27422
 
          ]
27423
 
        };
27424
 
 
27425
 
 
27426
 
/***/ },
27427
 
/* 224 */
27428
 
/***/ function(module, exports, __webpack_require__) {
27429
 
 
27430
 
        module.exports = {
27431
 
          'name': 'xgcd',
27432
 
          'category': 'Arithmetic',
27433
 
          'syntax': [
27434
 
            'xgcd(a, b)'
27435
 
          ],
27436
 
          'description': 'Calculate the extended greatest common divisor for two values',
27437
 
          'examples': [
27438
 
            'xgcd(8, 12)',
27439
 
            'gcd(8, 12)',
27440
 
            'xgcd(36163, 21199)'
27441
 
          ],
27442
 
          'seealso': [ 'gcd', 'lcm' ]
27443
 
        };
27444
 
 
27445
 
 
27446
 
/***/ },
27447
 
/* 225 */
27448
 
/***/ function(module, exports, __webpack_require__) {
27449
 
 
27450
 
        module.exports = {
27451
 
          'name': 'bitAnd',
27452
 
          'category': 'Bitwise',
27453
 
          'syntax': [
27454
 
            'x & y',
27455
 
            'bitAnd(x, y)'
27456
 
          ],
27457
 
          'description': 'Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0',
27458
 
          'examples': [
27459
 
            '5 & 3',
27460
 
            'bitAnd(53, 131)',
27461
 
            '[1, 12, 31] & 42'
27462
 
          ],
27463
 
          'seealso': [
27464
 
            'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'
27465
 
          ]
27466
 
        };
27467
 
 
27468
 
 
27469
 
/***/ },
27470
 
/* 226 */
27471
 
/***/ function(module, exports, __webpack_require__) {
27472
 
 
27473
 
        module.exports = {
27474
 
          'name': 'bitNot',
27475
 
          'category': 'Bitwise',
27476
 
          'syntax': [
27477
 
            '~x',
27478
 
            'bitNot(x)'
27479
 
          ],
27480
 
          'description': 'Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.',
27481
 
          'examples': [
27482
 
            '~1',
27483
 
            '~2',
27484
 
            'bitNot([2, -3, 4])'
27485
 
          ],
27486
 
          'seealso': [
27487
 
            'bitAnd', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'
27488
 
          ]
27489
 
        };
27490
 
 
27491
 
 
27492
 
/***/ },
27493
 
/* 227 */
27494
 
/***/ function(module, exports, __webpack_require__) {
27495
 
 
27496
 
        module.exports = {
27497
 
          'name': 'bitOr',
27498
 
          'category': 'Bitwise',
27499
 
          'syntax': [
27500
 
            'x | y',
27501
 
            'bitOr(x, y)'
27502
 
          ],
27503
 
          'description': 'Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.',
27504
 
          'examples': [
27505
 
            '5 | 3',
27506
 
            'bitOr([1, 2, 3], 4)'
27507
 
          ],
27508
 
          'seealso': [
27509
 
            'bitAnd', 'bitNot', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'
27510
 
          ]
27511
 
        };
27512
 
 
27513
 
 
27514
 
/***/ },
27515
 
/* 228 */
27516
 
/***/ function(module, exports, __webpack_require__) {
27517
 
 
27518
 
        module.exports = {
27519
 
          'name': 'bitXor',
27520
 
          'category': 'Bitwise',
27521
 
          'syntax': [
27522
 
            'bitXor(x, y)'
27523
 
          ],
27524
 
          'description': 'Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.',
27525
 
          'examples': [
27526
 
            'bitOr(1, 2)',
27527
 
            'bitXor([2, 3, 4], 4)'
27528
 
          ],
27529
 
          'seealso': [
27530
 
            'bitAnd', 'bitNot', 'bitOr', 'leftShift', 'rightArithShift', 'rightLogShift'
27531
 
          ]
27532
 
        };
27533
 
 
27534
 
 
27535
 
/***/ },
27536
 
/* 229 */
27537
 
/***/ function(module, exports, __webpack_require__) {
27538
 
 
27539
 
        module.exports = {
27540
 
          'name': 'leftShift',
27541
 
          'category': 'Bitwise',
27542
 
          'syntax': [
27543
 
            'x << y',
27544
 
            'leftShift(x, y)'
27545
 
          ],
27546
 
          'description': 'Bitwise left logical shift of a value x by y number of bits.',
27547
 
          'examples': [
27548
 
            '4 << 1',
27549
 
            '8 >> 1'
27550
 
          ],
27551
 
          'seealso': [
27552
 
            'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'rightArithShift', 'rightLogShift'
27553
 
          ]
27554
 
        };
27555
 
 
27556
 
 
27557
 
/***/ },
27558
 
/* 230 */
27559
 
/***/ function(module, exports, __webpack_require__) {
27560
 
 
27561
 
        module.exports = {
27562
 
          'name': 'rightArithShift',
27563
 
          'category': 'Bitwise',
27564
 
          'syntax': [
27565
 
            'x >> y',
27566
 
            'leftShift(x, y)'
27567
 
          ],
27568
 
          'description': 'Bitwise right arithmetic shift of a value x by y number of bits.',
27569
 
          'examples': [
27570
 
            '8 >> 1',
27571
 
            '4 << 1',
27572
 
            '-12 >> 2'
27573
 
          ],
27574
 
          'seealso': [
27575
 
            'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightLogShift'
27576
 
          ]
27577
 
        };
27578
 
 
27579
 
 
27580
 
/***/ },
27581
 
/* 231 */
27582
 
/***/ function(module, exports, __webpack_require__) {
27583
 
 
27584
 
        module.exports = {
27585
 
          'name': 'rightLogShift',
27586
 
          'category': 'Bitwise',
27587
 
          'syntax': [
27588
 
            'x >> y',
27589
 
            'leftShift(x, y)'
27590
 
          ],
27591
 
          'description': 'Bitwise right logical shift of a value x by y number of bits.',
27592
 
          'examples': [
27593
 
            '8 >>> 1',
27594
 
            '4 << 1',
27595
 
            '-12 >>> 2'
27596
 
          ],
27597
 
          'seealso': [
27598
 
            'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift'
27599
 
          ]
27600
 
        };
27601
 
 
27602
 
 
27603
 
/***/ },
27604
 
/* 232 */
27605
 
/***/ function(module, exports, __webpack_require__) {
27606
 
 
27607
 
        module.exports = {
27608
 
          'name': 'arg',
27609
 
          'category': 'Complex',
27610
 
          'syntax': [
27611
 
            'arg(x)'
27612
 
          ],
27613
 
          'description':
27614
 
              'Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).',
27615
 
          'examples': [
27616
 
            'arg(2 + 2i)',
27617
 
            'atan2(3, 2)',
27618
 
            'arg(2 + 3i)'
27619
 
          ],
27620
 
          'seealso': [
27621
 
            're',
27622
 
            'im',
27623
 
            'conj',
27624
 
            'abs'
27625
 
          ]
27626
 
        };
27627
 
 
27628
 
 
27629
 
/***/ },
27630
 
/* 233 */
27631
 
/***/ function(module, exports, __webpack_require__) {
27632
 
 
27633
 
        module.exports = {
27634
 
          'name': 'conj',
27635
 
          'category': 'Complex',
27636
 
          'syntax': [
27637
 
            'conj(x)'
27638
 
          ],
27639
 
          'description':
27640
 
              'Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.',
27641
 
          'examples': [
27642
 
            'conj(2 + 3i)',
27643
 
            'conj(2 - 3i)',
27644
 
            'conj(-5.2i)'
27645
 
          ],
27646
 
          'seealso': [
27647
 
            're',
27648
 
            'im',
27649
 
            'abs',
27650
 
            'arg'
27651
 
          ]
27652
 
        };
27653
 
 
27654
 
 
27655
 
/***/ },
27656
 
/* 234 */
27657
 
/***/ function(module, exports, __webpack_require__) {
27658
 
 
27659
 
        module.exports = {
27660
 
          'name': 're',
27661
 
          'category': 'Complex',
27662
 
          'syntax': [
27663
 
            're(x)'
27664
 
          ],
27665
 
          'description': 'Get the real part of a complex number.',
27666
 
          'examples': [
27667
 
            're(2 + 3i)',
27668
 
            'im(2 + 3i)',
27669
 
            're(-5.2i)',
27670
 
            're(2.4)'
27671
 
          ],
27672
 
          'seealso': [
27673
 
            'im',
27674
 
            'conj',
27675
 
            'abs',
27676
 
            'arg'
27677
 
          ]
27678
 
        };
27679
 
 
27680
 
 
27681
 
/***/ },
27682
 
/* 235 */
27683
 
/***/ function(module, exports, __webpack_require__) {
27684
 
 
27685
 
        module.exports = {
27686
 
          'name': 'im',
27687
 
          'category': 'Complex',
27688
 
          'syntax': [
27689
 
            'im(x)'
27690
 
          ],
27691
 
          'description': 'Get the imaginary part of a complex number.',
27692
 
          'examples': [
27693
 
            'im(2 + 3i)',
27694
 
            're(2 + 3i)',
27695
 
            'im(-5.2i)',
27696
 
            'im(2.4)'
27697
 
          ],
27698
 
          'seealso': [
27699
 
            're',
27700
 
            'conj',
27701
 
            'abs',
27702
 
            'arg'
27703
 
          ]
27704
 
        };
27705
 
 
27706
 
 
27707
 
/***/ },
27708
 
/* 236 */
27709
 
/***/ function(module, exports, __webpack_require__) {
27710
 
 
27711
 
        module.exports = {
27712
 
          'name': 'bignumber',
27713
 
          'category': 'Type',
27714
 
          'syntax': [
27715
 
            'bignumber(x)'
27716
 
          ],
27717
 
          'description':
27718
 
              'Create a big number from a number or string.',
27719
 
          'examples': [
27720
 
            '0.1 + 0.2',
27721
 
            'bignumber(0.1) + bignumber(0.2)',
27722
 
            'bignumber("7.2")',
27723
 
            'bignumber("7.2e500")',
27724
 
            'bignumber([0.1, 0.2, 0.3])'
27725
 
          ],
27726
 
          'seealso': [
27727
 
            'boolean', 'complex', 'index', 'matrix', 'string', 'unit'
27728
 
          ]
27729
 
        };
27730
 
 
27731
 
 
27732
 
/***/ },
27733
 
/* 237 */
27734
 
/***/ function(module, exports, __webpack_require__) {
27735
 
 
27736
 
        module.exports = {
27737
 
          'name': 'boolean',
27738
 
          'category': 'Type',
27739
 
          'syntax': [
27740
 
            'x',
27741
 
            'boolean(x)'
27742
 
          ],
27743
 
          'description':
27744
 
              'Convert a string or number into a boolean.',
27745
 
          'examples': [
27746
 
            'boolean(0)',
27747
 
            'boolean(1)',
27748
 
            'boolean(3)',
27749
 
            'boolean("true")',
27750
 
            'boolean("false")',
27751
 
            'boolean([1, 0, 1, 1])'
27752
 
          ],
27753
 
          'seealso': [
27754
 
            'bignumber', 'complex', 'index', 'matrix', 'number', 'string', 'unit'
27755
 
          ]
27756
 
        };
27757
 
 
27758
 
 
27759
 
/***/ },
27760
 
/* 238 */
27761
 
/***/ function(module, exports, __webpack_require__) {
27762
 
 
27763
 
        module.exports = {
27764
 
          'name': 'complex',
27765
 
          'category': 'Type',
27766
 
          'syntax': [
27767
 
            'complex()',
27768
 
            'complex(re, im)',
27769
 
            'complex(string)'
27770
 
          ],
27771
 
          'description':
27772
 
              'Create a complex number.',
27773
 
          'examples': [
27774
 
            'complex()',
27775
 
            'complex(2, 3)',
27776
 
            'complex("7 - 2i")'
27777
 
          ],
27778
 
          'seealso': [
27779
 
            'bignumber', 'boolean', 'index', 'matrix', 'number', 'string', 'unit'
27780
 
          ]
27781
 
        };
27782
 
 
27783
 
 
27784
 
/***/ },
27785
 
/* 239 */
27786
 
/***/ function(module, exports, __webpack_require__) {
27787
 
 
27788
 
        module.exports = {
27789
 
          'name': 'index',
27790
 
          'category': 'Type',
27791
 
          'syntax': [
27792
 
            '[start]',
27793
 
            '[start:end]',
27794
 
            '[start:step:end]',
27795
 
            '[start1, start 2, ...]',
27796
 
            '[start1:end1, start2:end2, ...]',
27797
 
            '[start1:step1:end1, start2:step2:end2, ...]'
27798
 
          ],
27799
 
          'description':
27800
 
              'Create an index to get or replace a subset of a matrix',
27801
 
          'examples': [
27802
 
            '[]',
27803
 
            '[1, 2, 3]',
27804
 
            'A = [1, 2, 3; 4, 5, 6]',
27805
 
            'A[1, :]',
27806
 
            'A[1, 2] = 50',
27807
 
            'A[0:2, 0:2] = ones(2, 2)'
27808
 
          ],
27809
 
          'seealso': [
27810
 
            'bignumber', 'boolean', 'complex', 'matrix,', 'number', 'range', 'string', 'unit'
27811
 
          ]
27812
 
        };
27813
 
 
27814
 
 
27815
 
/***/ },
27816
 
/* 240 */
27817
 
/***/ function(module, exports, __webpack_require__) {
27818
 
 
27819
 
        module.exports = {
27820
 
          'name': 'matrix',
27821
 
          'category': 'Type',
27822
 
          'syntax': [
27823
 
            '[]',
27824
 
            '[a1, b1, ...; a2, b2, ...]',
27825
 
            'matrix()',
27826
 
            'matrix([...])'
27827
 
          ],
27828
 
          'description':
27829
 
              'Create a matrix.',
27830
 
          'examples': [
27831
 
            '[]',
27832
 
            '[1, 2, 3]',
27833
 
            '[1, 2, 3; 4, 5, 6]',
27834
 
            'matrix()',
27835
 
            'matrix([3, 4])'
27836
 
          ],
27837
 
          'seealso': [
27838
 
            'bignumber', 'boolean', 'complex', 'index', 'number', 'string', 'unit'
27839
 
          ]
27840
 
        };
27841
 
 
27842
 
 
27843
 
/***/ },
27844
 
/* 241 */
27845
 
/***/ function(module, exports, __webpack_require__) {
27846
 
 
27847
 
        module.exports = {
27848
 
          'name': 'number',
27849
 
          'category': 'Type',
27850
 
          'syntax': [
27851
 
            'x',
27852
 
            'number(x)'
27853
 
          ],
27854
 
          'description':
27855
 
              'Create a number or convert a string or boolean into a number.',
27856
 
          'examples': [
27857
 
            '2',
27858
 
            '2e3',
27859
 
            '4.05',
27860
 
            'number(2)',
27861
 
            'number("7.2")',
27862
 
            'number(true)',
27863
 
            'number([true, false, true, true])',
27864
 
            'number("52cm", "m")'
27865
 
          ],
27866
 
          'seealso': [
27867
 
            'bignumber', 'boolean', 'complex', 'index', 'matrix', 'string', 'unit'
27868
 
          ]
27869
 
        };
27870
 
 
27871
 
 
27872
 
/***/ },
27873
 
/* 242 */
27874
 
/***/ function(module, exports, __webpack_require__) {
27875
 
 
27876
 
        module.exports = {
27877
 
          'name': 'string',
27878
 
          'category': 'Type',
27879
 
          'syntax': [
27880
 
            '"text"',
27881
 
            'string(x)'
27882
 
          ],
27883
 
          'description':
27884
 
              'Create a string or convert a value to a string',
27885
 
          'examples': [
27886
 
            '"Hello World!"',
27887
 
            'string(4.2)',
27888
 
            'string(3 + 2i)'
27889
 
          ],
27890
 
          'seealso': [
27891
 
            'bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'unit'
27892
 
          ]
27893
 
        };
27894
 
 
27895
 
 
27896
 
/***/ },
27897
 
/* 243 */
27898
 
/***/ function(module, exports, __webpack_require__) {
27899
 
 
27900
 
        module.exports = {
27901
 
          'name': 'unit',
27902
 
          'category': 'Type',
27903
 
          'syntax': [
27904
 
            'value unit',
27905
 
            'unit(value, unit)',
27906
 
            'unit(string)'
27907
 
          ],
27908
 
          'description':
27909
 
              'Create a unit.',
27910
 
          'examples': [
27911
 
            '5.5 mm',
27912
 
            '3 inch',
27913
 
            'unit(7.1, "kilogram")',
27914
 
            'unit("23 deg")'
27915
 
          ],
27916
 
          'seealso': [
27917
 
            'bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'string'
27918
 
          ]
27919
 
        };
27920
 
 
27921
 
 
27922
 
/***/ },
27923
 
/* 244 */
27924
 
/***/ function(module, exports, __webpack_require__) {
27925
 
 
27926
 
        module.exports = {
27927
 
          'name': 'eval',
27928
 
          'category': 'Expression',
27929
 
          'syntax': [
27930
 
            'eval(expression)',
27931
 
            'eval([expr1, expr2, expr3, ...])'
27932
 
          ],
27933
 
          'description': 'Evaluate an expression or an array with expressions.',
27934
 
          'examples': [
27935
 
            'eval("2 + 3")',
27936
 
            'eval("sqrt(" + 4 + ")")'
27937
 
          ],
27938
 
          'seealso': []
27939
 
        };
27940
 
 
27941
 
 
27942
 
/***/ },
27943
 
/* 245 */
27944
 
/***/ function(module, exports, __webpack_require__) {
27945
 
 
27946
 
        module.exports = {
27947
 
          'name': 'help',
27948
 
          'category': 'Expression',
27949
 
          'syntax': [
27950
 
            'help(object)',
27951
 
            'help(string)'
27952
 
          ],
27953
 
          'description': 'Display documentation on a function or data type.',
27954
 
          'examples': [
27955
 
            'help(sqrt)',
27956
 
            'help("complex")'
27957
 
          ],
27958
 
          'seealso': []
27959
 
        };
27960
 
 
27961
 
 
27962
 
/***/ },
27963
 
/* 246 */
27964
 
/***/ function(module, exports, __webpack_require__) {
27965
 
 
27966
 
        module.exports = {
27967
 
          'name': 'and',
27968
 
          'category': 'Logical',
27969
 
          'syntax': [
27970
 
            'x and y',
27971
 
            'and(x, y)'
27972
 
          ],
27973
 
          'description': 'Logical and. Test whether two values are both defined with a nonzero/nonempty value.',
27974
 
          'examples': [
27975
 
            'true and false',
27976
 
            'true and true',
27977
 
            '2 and 4'
27978
 
          ],
27979
 
          'seealso': [
27980
 
            'not', 'or', 'xor'
27981
 
          ]
27982
 
        };
27983
 
 
27984
 
 
27985
 
/***/ },
27986
 
/* 247 */
27987
 
/***/ function(module, exports, __webpack_require__) {
27988
 
 
27989
 
        module.exports = {
27990
 
          'name': 'not',
27991
 
          'category': 'Logical',
27992
 
          'syntax': [
27993
 
            '!x',
27994
 
            'not x',
27995
 
            'not(x)'
27996
 
          ],
27997
 
          'description': 'Logical not. Flips the boolean value of given argument.',
27998
 
          'examples': [
27999
 
            '!true',
28000
 
            'not false',
28001
 
            '!2',
28002
 
            '!0'
28003
 
          ],
28004
 
          'seealso': [
28005
 
            'and', 'or', 'xor'
28006
 
          ]
28007
 
        };
28008
 
 
28009
 
 
28010
 
/***/ },
28011
 
/* 248 */
28012
 
/***/ function(module, exports, __webpack_require__) {
28013
 
 
28014
 
        module.exports = {
28015
 
          'name': 'or',
28016
 
          'category': 'Logical',
28017
 
          'syntax': [
28018
 
            'x or y',
28019
 
            'or(x, y)'
28020
 
          ],
28021
 
          'description': 'Logical or. Test if at least one value is defined with a nonzero/nonempty value.',
28022
 
          'examples': [
28023
 
            'true or false',
28024
 
            'false or false',
28025
 
            '0 or 4'
28026
 
          ],
28027
 
          'seealso': [
28028
 
            'not', 'and', 'xor'
28029
 
          ]
28030
 
        };
28031
 
 
28032
 
 
28033
 
/***/ },
28034
 
/* 249 */
28035
 
/***/ function(module, exports, __webpack_require__) {
28036
 
 
28037
 
        module.exports = {
28038
 
          'name': 'xor',
28039
 
          'category': 'Logical',
28040
 
          'syntax': [
28041
 
            'x or y',
28042
 
            'or(x, y)'
28043
 
          ],
28044
 
          'description': 'Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.',
28045
 
          'examples': [
28046
 
            'true xor false',
28047
 
            'false xor false',
28048
 
            'true xor true',
28049
 
            '0 or 4'
28050
 
          ],
28051
 
          'seealso': [
28052
 
            'not', 'and', 'or'
28053
 
          ]
28054
 
        };
28055
 
 
28056
 
 
28057
 
/***/ },
28058
 
/* 250 */
28059
 
/***/ function(module, exports, __webpack_require__) {
28060
 
 
28061
 
        module.exports = {
28062
 
          'name': 'concat',
28063
 
          'category': 'Matrix',
28064
 
          'syntax': [
28065
 
            'concat(A, B, C, ...)',
28066
 
            'concat(A, B, C, ..., dim)'
28067
 
          ],
28068
 
          'description': 'Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.',
28069
 
          'examples': [
28070
 
            'A = [1, 2; 5, 6]',
28071
 
            'B = [3, 4; 7, 8]',
28072
 
            'concat(A, B)',
28073
 
            'concat(A, B, 1)',
28074
 
            'concat(A, B, 2)'
28075
 
          ],
28076
 
          'seealso': [
28077
 
            'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'transpose', 'zeros'
28078
 
          ]
28079
 
        };
28080
 
 
28081
 
 
28082
 
/***/ },
28083
 
/* 251 */
28084
 
/***/ function(module, exports, __webpack_require__) {
28085
 
 
28086
 
        module.exports = {
28087
 
          'name': 'cross',
28088
 
          'category': 'Matrix',
28089
 
          'syntax': [
28090
 
            'cross(A, B)'
28091
 
          ],
28092
 
          'description': 'Calculate the cross product for two vectors in three dimensional space.',
28093
 
          'examples': [
28094
 
            'cross([1, 1, 0],  [0, 1, 1])',
28095
 
            'cross([3, -3, 1], [4, 9, 2])',
28096
 
            'cross([2, 3, 4],  [5, 6, 7])'
28097
 
          ],
28098
 
          'seealso': [
28099
 
            'multiply',
28100
 
            'dot'
28101
 
          ]
28102
 
        };
28103
 
 
28104
 
 
28105
 
/***/ },
28106
 
/* 252 */
28107
 
/***/ function(module, exports, __webpack_require__) {
28108
 
 
28109
 
        module.exports = {
28110
 
          'name': 'det',
28111
 
          'category': 'Matrix',
28112
 
          'syntax': [
28113
 
            'det(x)'
28114
 
          ],
28115
 
          'description': 'Calculate the determinant of a matrix',
28116
 
          'examples': [
28117
 
            'det([1, 2; 3, 4])',
28118
 
            'det([-2, 2, 3; -1, 1, 3; 2, 0, -1])'
28119
 
          ],
28120
 
          'seealso': [
28121
 
            'concat', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'transpose', 'zeros'
28122
 
          ]
28123
 
        };
28124
 
 
28125
 
 
28126
 
/***/ },
28127
 
/* 253 */
28128
 
/***/ function(module, exports, __webpack_require__) {
28129
 
 
28130
 
        module.exports = {
28131
 
          'name': 'diag',
28132
 
          'category': 'Matrix',
28133
 
          'syntax': [
28134
 
            'diag(x)',
28135
 
            'diag(x, k)'
28136
 
          ],
28137
 
          'description': 'Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.',
28138
 
          'examples': [
28139
 
            'diag(1:3)',
28140
 
            'diag(1:3, 1)',
28141
 
            'a = [1, 2, 3; 4, 5, 6; 7, 8, 9]',
28142
 
            'diag(a)'
28143
 
          ],
28144
 
          'seealso': [
28145
 
            'concat', 'det', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'transpose', 'zeros'
28146
 
          ]
28147
 
        };
28148
 
 
28149
 
 
28150
 
/***/ },
28151
 
/* 254 */
28152
 
/***/ function(module, exports, __webpack_require__) {
28153
 
 
28154
 
        module.exports = {
28155
 
          'name': 'dot',
28156
 
          'category': 'Matrix',
28157
 
          'syntax': [
28158
 
            'dot(A, B)'
28159
 
          ],
28160
 
          'description': 'Calculate the dot product of two vectors. ' +
28161
 
              'The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] ' +
28162
 
              'is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn',
28163
 
          'examples': [
28164
 
            'dot([2, 4, 1], [2, 2, 3])',
28165
 
            '[2, 4, 1] * [2, 2, 3]'
28166
 
          ],
28167
 
          'seealso': [
28168
 
            'multiply',
28169
 
            'cross'
28170
 
          ]
28171
 
        };
28172
 
 
28173
 
 
28174
 
/***/ },
28175
 
/* 255 */
28176
 
/***/ function(module, exports, __webpack_require__) {
28177
 
 
28178
 
        module.exports = {
28179
 
          'name': 'eye',
28180
 
          'category': 'Matrix',
28181
 
          'syntax': [
28182
 
            'eye(n)',
28183
 
            'eye(m, n)',
28184
 
            'eye([m, n])',
28185
 
            'eye'
28186
 
          ],
28187
 
          'description': 'Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.',
28188
 
          'examples': [
28189
 
            'eye(3)',
28190
 
            'eye(3, 5)',
28191
 
            'a = [1, 2, 3; 4, 5, 6]',
28192
 
            'eye(size(a))'
28193
 
          ],
28194
 
          'seealso': [
28195
 
            'concat', 'det', 'diag', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'transpose', 'zeros'
28196
 
          ]
28197
 
        };
28198
 
 
28199
 
 
28200
 
/***/ },
28201
 
/* 256 */
28202
 
/***/ function(module, exports, __webpack_require__) {
28203
 
 
28204
 
        module.exports = {
28205
 
          'name': 'flatten',
28206
 
          'category': 'Matrix',
28207
 
          'syntax': [
28208
 
            'flatten(x)'
28209
 
          ],
28210
 
          'description': 'Flatten a multi dimensional matrix into a single dimensional matrix.',
28211
 
          'examples': [
28212
 
            'a = [1, 2, 3; 4, 5, 6]',
28213
 
            'size(a)',
28214
 
            'b = flatten(a)',
28215
 
            'size(b)'
28216
 
          ],
28217
 
          'seealso': [
28218
 
            'concat', 'resize', 'size', 'squeeze'
28219
 
          ]
28220
 
        };
28221
 
 
28222
 
 
28223
 
/***/ },
28224
 
/* 257 */
28225
 
/***/ function(module, exports, __webpack_require__) {
28226
 
 
28227
 
        module.exports = {
28228
 
          'name': 'inv',
28229
 
          'category': 'Matrix',
28230
 
          'syntax': [
28231
 
            'inv(x)'
28232
 
          ],
28233
 
          'description': 'Calculate the inverse of a matrix',
28234
 
          'examples': [
28235
 
            'inv([1, 2; 3, 4])',
28236
 
            'inv(4)',
28237
 
            '1 / 4'
28238
 
          ],
28239
 
          'seealso': [
28240
 
            'concat', 'det', 'diag', 'eye', 'ones', 'range', 'size', 'squeeze', 'subset', 'transpose', 'zeros'
28241
 
          ]
28242
 
        };
28243
 
 
28244
 
 
28245
 
/***/ },
28246
 
/* 258 */
28247
 
/***/ function(module, exports, __webpack_require__) {
28248
 
 
28249
 
        module.exports = {
28250
 
          'name': 'ones',
28251
 
          'category': 'Matrix',
28252
 
          'syntax': [
28253
 
            'ones(m)',
28254
 
            'ones(m, n)',
28255
 
            'ones(m, n, p, ...)',
28256
 
            'ones([m])',
28257
 
            'ones([m, n])',
28258
 
            'ones([m, n, p, ...])',
28259
 
            'ones'
28260
 
          ],
28261
 
          'description': 'Create a matrix containing ones.',
28262
 
          'examples': [
28263
 
            'ones(3)',
28264
 
            'ones(3, 5)',
28265
 
            'ones([2,3]) * 4.5',
28266
 
            'a = [1, 2, 3; 4, 5, 6]',
28267
 
            'ones(size(a))'
28268
 
          ],
28269
 
          'seealso': [
28270
 
            'concat', 'det', 'diag', 'eye', 'inv', 'range', 'size', 'squeeze', 'subset', 'transpose', 'zeros'
28271
 
          ]
28272
 
        };
28273
 
 
28274
 
 
28275
 
/***/ },
28276
 
/* 259 */
28277
 
/***/ function(module, exports, __webpack_require__) {
28278
 
 
28279
 
        module.exports = {
28280
 
          'name': 'range',
28281
 
          'category': 'Type',
28282
 
          'syntax': [
28283
 
            'start:end',
28284
 
            'start:step:end',
28285
 
            'range(start, end)',
28286
 
            'range(start, end, step)',
28287
 
            'range(string)'
28288
 
          ],
28289
 
          'description':
28290
 
              'Create a range. Lower bound of the range is included, upper bound is excluded.',
28291
 
          'examples': [
28292
 
            '1:5',
28293
 
            '3:-1:-3',
28294
 
            'range(3, 7)',
28295
 
            'range(0, 12, 2)',
28296
 
            'range("4:10")',
28297
 
            'a = [1, 2, 3, 4; 5, 6, 7, 8]',
28298
 
            'a[1:2, 1:2]'
28299
 
          ],
28300
 
          'seealso': [
28301
 
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'size', 'squeeze', 'subset', 'transpose', 'zeros'
28302
 
          ]
28303
 
        };
28304
 
 
28305
 
 
28306
 
/***/ },
28307
 
/* 260 */
28308
 
/***/ function(module, exports, __webpack_require__) {
28309
 
 
28310
 
        module.exports = {
28311
 
          'name': 'resize',
28312
 
          'category': 'Matrix',
28313
 
          'syntax': [
28314
 
            'resize(x, size)',
28315
 
            'resize(x, size, defaultValue)'
28316
 
          ],
28317
 
          'description': 'Resize a matrix.',
28318
 
          'examples': [
28319
 
            'resize([1,2,3,4,5], [3])',
28320
 
            'resize([1,2,3], [5])',
28321
 
            'resize([1,2,3], [5], -1)',
28322
 
            'resize(2, [2, 3])',
28323
 
            'resize("hello", [8], "!")'
28324
 
          ],
28325
 
          'seealso': [
28326
 
            'size', 'subset', 'squeeze'
28327
 
          ]
28328
 
        };
28329
 
 
28330
 
 
28331
 
/***/ },
28332
 
/* 261 */
28333
 
/***/ function(module, exports, __webpack_require__) {
28334
 
 
28335
 
        module.exports = {
28336
 
          'name': 'size',
28337
 
          'category': 'Matrix',
28338
 
          'syntax': [
28339
 
            'size(x)'
28340
 
          ],
28341
 
          'description': 'Calculate the size of a matrix.',
28342
 
          'examples': [
28343
 
            'size(2.3)',
28344
 
            'size("hello world")',
28345
 
            'a = [1, 2; 3, 4; 5, 6]',
28346
 
            'size(a)',
28347
 
            'size(1:6)'
28348
 
          ],
28349
 
          'seealso': [
28350
 
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'squeeze', 'subset', 'transpose', 'zeros'
28351
 
          ]
28352
 
        };
28353
 
 
28354
 
 
28355
 
/***/ },
28356
 
/* 262 */
28357
 
/***/ function(module, exports, __webpack_require__) {
28358
 
 
28359
 
        module.exports = {
28360
 
          'name': 'squeeze',
28361
 
          'category': 'Matrix',
28362
 
          'syntax': [
28363
 
            'squeeze(x)'
28364
 
          ],
28365
 
          'description': 'Remove inner and outer singleton dimensions from a matrix.',
28366
 
          'examples': [
28367
 
            'a = zeros(3,2,1)',
28368
 
            'size(squeeze(a))',
28369
 
            'b = zeros(1,1,3)',
28370
 
            'size(squeeze(b))'
28371
 
          ],
28372
 
          'seealso': [
28373
 
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'subset', 'transpose', 'zeros'
28374
 
          ]
28375
 
        };
28376
 
 
28377
 
 
28378
 
/***/ },
28379
 
/* 263 */
28380
 
/***/ function(module, exports, __webpack_require__) {
28381
 
 
28382
 
        module.exports = {
28383
 
          'name': 'subset',
28384
 
          'category': 'Matrix',
28385
 
          'syntax': [
28386
 
            'value(index)',
28387
 
            'value(index) = replacement',
28388
 
            'subset(value, [index])',
28389
 
            'subset(value, [index], replacement)'
28390
 
          ],
28391
 
          'description': 'Get or set a subset of a matrix or string. ' +
28392
 
              'Indexes are one-based. ' +
28393
 
              'Both the ranges lower-bound and upper-bound are included.',
28394
 
          'examples': [
28395
 
            'd = [1, 2; 3, 4]',
28396
 
            'e = []',
28397
 
            'e[1, 1:2] = [5, 6]',
28398
 
            'e[2, :] = [7, 8]',
28399
 
            'f = d * e',
28400
 
            'f[2, 1]',
28401
 
            'f[:, 1]'
28402
 
          ],
28403
 
          'seealso': [
28404
 
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'transpose', 'zeros'
28405
 
          ]
28406
 
        };
28407
 
 
28408
 
 
28409
 
/***/ },
28410
 
/* 264 */
28411
 
/***/ function(module, exports, __webpack_require__) {
28412
 
 
28413
 
        module.exports = {
28414
 
          'name': 'transpose',
28415
 
          'category': 'Matrix',
28416
 
          'syntax': [
28417
 
            'x\'',
28418
 
            'transpose(x)'
28419
 
          ],
28420
 
          'description': 'Transpose a matrix',
28421
 
          'examples': [
28422
 
            'a = [1, 2, 3; 4, 5, 6]',
28423
 
            'a\'',
28424
 
            'transpose(a)'
28425
 
          ],
28426
 
          'seealso': [
28427
 
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'zeros'
28428
 
          ]
28429
 
        };
28430
 
 
28431
 
 
28432
 
/***/ },
28433
 
/* 265 */
28434
 
/***/ function(module, exports, __webpack_require__) {
28435
 
 
28436
 
        module.exports = {
28437
 
          'name': 'zeros',
28438
 
          'category': 'Matrix',
28439
 
          'syntax': [
28440
 
            'zeros(m)',
28441
 
            'zeros(m, n)',
28442
 
            'zeros(m, n, p, ...)',
28443
 
            'zeros([m])',
28444
 
            'zeros([m, n])',
28445
 
            'zeros([m, n, p, ...])',
28446
 
            'zeros'
28447
 
          ],
28448
 
          'description': 'Create a matrix containing zeros.',
28449
 
          'examples': [
28450
 
            'zeros(3)',
28451
 
            'zeros(3, 5)',
28452
 
            'a = [1, 2, 3; 4, 5, 6]',
28453
 
            'zeros(size(a))'
28454
 
          ],
28455
 
          'seealso': [
28456
 
            'concat', 'det', 'diag', 'eye', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'transpose'
28457
 
          ]
28458
 
        };
28459
 
 
28460
 
 
28461
 
/***/ },
28462
 
/* 266 */
28463
 
/***/ function(module, exports, __webpack_require__) {
28464
 
 
28465
 
        module.exports = {
28466
 
          'name': 'combinations',
28467
 
          'category': 'Probability',
28468
 
          'syntax': [
28469
 
            'combinations(n, k)'
28470
 
          ],
28471
 
          'description': 'Compute the number of combinations of n items taken k at a time',
28472
 
          'examples': [
28473
 
            'combinations(7, 5)'
28474
 
          ],
28475
 
          'seealso': ['permutations', 'factorial']
28476
 
        };
28477
 
 
28478
 
 
28479
 
/***/ },
28480
 
/* 267 */
28481
 
/***/ function(module, exports, __webpack_require__) {
28482
 
 
28483
 
        module.exports = {
28484
 
          'name': 'factorial',
28485
 
          'category': 'Probability',
28486
 
          'syntax': [
28487
 
            'n!',
28488
 
            'factorial(n)'
28489
 
          ],
28490
 
          'description': 'Compute the factorial of a value',
28491
 
          'examples': [
28492
 
            '5!',
28493
 
            '5 * 4 * 3 * 2 * 1',
28494
 
            '3!'
28495
 
          ],
28496
 
          'seealso': ['combinations', 'permutations', 'gamma']
28497
 
        };
28498
 
 
28499
 
 
28500
 
/***/ },
28501
 
/* 268 */
28502
 
/***/ function(module, exports, __webpack_require__) {
28503
 
 
28504
 
        module.exports = {
28505
 
          'name': 'gamma',
28506
 
          'category': 'Probability',
28507
 
          'syntax': [
28508
 
            'gamma(n)'
28509
 
          ],
28510
 
          'description': 'Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.',
28511
 
          'examples': [
28512
 
            'gamma(4)',
28513
 
            '3!',
28514
 
            'gamma(1/2)',
28515
 
            'sqrt(pi)'
28516
 
          ],
28517
 
          'seealso': ['factorial']
28518
 
        };
28519
 
 
28520
 
 
28521
 
/***/ },
28522
 
/* 269 */
28523
 
/***/ function(module, exports, __webpack_require__) {
28524
 
 
28525
 
        module.exports = {
28526
 
          'name': 'permutations',
28527
 
          'category': 'Probability',
28528
 
          'syntax': [
28529
 
            'permutations(n)',
28530
 
            'permutations(n, k)'
28531
 
          ],
28532
 
          'description': 'Compute the number of permutations of n items taken k at a time',
28533
 
          'examples': [
28534
 
            'permutations(5)',
28535
 
            'permutations(5, 3)'
28536
 
          ],
28537
 
          'seealso': ['combinations', 'factorial']
28538
 
        };
28539
 
 
28540
 
 
28541
 
/***/ },
28542
 
/* 270 */
28543
 
/***/ function(module, exports, __webpack_require__) {
28544
 
 
28545
 
        module.exports = {
28546
 
          'name': 'pickRandom',
28547
 
          'category': 'Probability',
28548
 
          'syntax': [
28549
 
            'pickRandom(array)'
28550
 
          ],
28551
 
          'description':
28552
 
              'Pick a random entry from a given array.',
28553
 
          'examples': [
28554
 
            'pickRandom(0:10)',
28555
 
            'pickRandom([1, 3, 1, 6])'
28556
 
          ],
28557
 
          'seealso': ['random', 'randomInt']
28558
 
        };
28559
 
 
28560
 
 
28561
 
/***/ },
28562
 
/* 271 */
28563
 
/***/ function(module, exports, __webpack_require__) {
28564
 
 
28565
 
        module.exports = {
28566
 
          'name': 'random',
28567
 
          'category': 'Probability',
28568
 
          'syntax': [
28569
 
            'random()',
28570
 
            'random(max)',
28571
 
            'random(min, max)',
28572
 
            'random(size)',
28573
 
            'random(size, max)',
28574
 
            'random(size, min, max)'
28575
 
          ],
28576
 
          'description':
28577
 
              'Return a random number.',
28578
 
          'examples': [
28579
 
            'random()',
28580
 
            'random(10, 20)',
28581
 
            'random([2, 3])'
28582
 
          ],
28583
 
          'seealso': ['pickRandom', 'randomInt']
28584
 
        };
28585
 
 
28586
 
 
28587
 
/***/ },
28588
 
/* 272 */
28589
 
/***/ function(module, exports, __webpack_require__) {
28590
 
 
28591
 
        module.exports = {
28592
 
          'name': 'randInt',
28593
 
          'category': 'Probability',
28594
 
          'syntax': [
28595
 
            'randInt()',
28596
 
            'randInt(max)',
28597
 
            'randInt(min, max)',
28598
 
            'randInt(size)',
28599
 
            'randInt(size, max)',
28600
 
            'randInt(size, min, max)'
28601
 
          ],
28602
 
          'description':
28603
 
              'Return a random integer number',
28604
 
          'examples': [
28605
 
            'randInt()',
28606
 
            'randInt(10, 20)',
28607
 
            'randInt([2, 3], 10)'
28608
 
          ],
28609
 
          'seealso': ['pickRandom', 'random']
28610
 
        };
28611
 
 
28612
 
/***/ },
28613
 
/* 273 */
28614
 
/***/ function(module, exports, __webpack_require__) {
28615
 
 
28616
 
        module.exports = {
28617
 
          'name': 'compare',
28618
 
          'category': 'Relational',
28619
 
          'syntax': [
28620
 
            'compare(x, y)'
28621
 
          ],
28622
 
          'description':
28623
 
              'Compare two values. Returns 1 if x is larger than y, -1 if x is smaller than y, and 0 if x and y are equal.',
28624
 
          'examples': [
28625
 
            'compare(2, 3)',
28626
 
            'compare(3, 2)',
28627
 
            'compare(2, 2)',
28628
 
            'compare(5cm, 40mm)',
28629
 
            'compare(2, [1, 2, 3])'
28630
 
          ],
28631
 
          'seealso': [
28632
 
            'equal', 'unequal', 'smaller', 'smallerEq', 'largerEq'
28633
 
          ]
28634
 
        };
28635
 
 
28636
 
 
28637
 
/***/ },
28638
 
/* 274 */
28639
 
/***/ function(module, exports, __webpack_require__) {
28640
 
 
28641
 
        module.exports = {
28642
 
          'name': 'deepEqual',
28643
 
          'category': 'Relational',
28644
 
          'syntax': [
28645
 
            'deepEqual(x, y)'
28646
 
          ],
28647
 
          'description':
28648
 
              'Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.',
28649
 
          'examples': [
28650
 
            '[1,3,4] == [1,3,4]',
28651
 
            '[1,3,4] == [1,3]'
28652
 
          ],
28653
 
          'seealso': [
28654
 
            'equal', 'unequal', 'smaller', 'larger', 'smallerEq', 'largerEq', 'compare'
28655
 
          ]
28656
 
        };
28657
 
 
28658
 
 
28659
 
/***/ },
28660
 
/* 275 */
28661
 
/***/ function(module, exports, __webpack_require__) {
28662
 
 
28663
 
        module.exports = {
28664
 
          'name': 'equal',
28665
 
          'category': 'Relational',
28666
 
          'syntax': [
28667
 
            'x == y',
28668
 
            'equal(x, y)'
28669
 
          ],
28670
 
          'description':
28671
 
              'Check equality of two values. Returns true if the values are equal, and false if not.',
28672
 
          'examples': [
28673
 
            '2+2 == 3',
28674
 
            '2+2 == 4',
28675
 
            'a = 3.2',
28676
 
            'b = 6-2.8',
28677
 
            'a == b',
28678
 
            '50cm == 0.5m'
28679
 
          ],
28680
 
          'seealso': [
28681
 
            'unequal', 'smaller', 'larger', 'smallerEq', 'largerEq', 'compare', 'deepEqual'
28682
 
          ]
28683
 
        };
28684
 
 
28685
 
 
28686
 
/***/ },
28687
 
/* 276 */
28688
 
/***/ function(module, exports, __webpack_require__) {
28689
 
 
28690
 
        module.exports = {
28691
 
          'name': 'larger',
28692
 
          'category': 'Relational',
28693
 
          'syntax': [
28694
 
            'x > y',
28695
 
            'larger(x, y)'
28696
 
          ],
28697
 
          'description':
28698
 
              'Check if value x is larger than y. Returns true if x is larger than y, and false if not.',
28699
 
          'examples': [
28700
 
            '2 > 3',
28701
 
            '5 > 2*2',
28702
 
            'a = 3.3',
28703
 
            'b = 6-2.8',
28704
 
            '(a > b)',
28705
 
            '(b < a)',
28706
 
            '5 cm > 2 inch'
28707
 
          ],
28708
 
          'seealso': [
28709
 
            'equal', 'unequal', 'smaller', 'smallerEq', 'largerEq', 'compare'
28710
 
          ]
28711
 
        };
28712
 
 
28713
 
 
28714
 
/***/ },
28715
 
/* 277 */
28716
 
/***/ function(module, exports, __webpack_require__) {
28717
 
 
28718
 
        module.exports = {
28719
 
          'name': 'largerEq',
28720
 
          'category': 'Relational',
28721
 
          'syntax': [
28722
 
            'x >= y',
28723
 
            'largerEq(x, y)'
28724
 
          ],
28725
 
          'description':
28726
 
              'Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.',
28727
 
          'examples': [
28728
 
            '2 > 1+1',
28729
 
            '2 >= 1+1',
28730
 
            'a = 3.2',
28731
 
            'b = 6-2.8',
28732
 
            '(a > b)'
28733
 
          ],
28734
 
          'seealso': [
28735
 
            'equal', 'unequal', 'smallerEq', 'smaller', 'largerEq', 'compare'
28736
 
          ]
28737
 
        };
28738
 
 
28739
 
 
28740
 
/***/ },
28741
 
/* 278 */
28742
 
/***/ function(module, exports, __webpack_require__) {
28743
 
 
28744
 
        module.exports = {
28745
 
          'name': 'smaller',
28746
 
          'category': 'Relational',
28747
 
          'syntax': [
28748
 
            'x < y',
28749
 
            'smaller(x, y)'
28750
 
          ],
28751
 
          'description':
28752
 
              'Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.',
28753
 
          'examples': [
28754
 
            '2 < 3',
28755
 
            '5 < 2*2',
28756
 
            'a = 3.3',
28757
 
            'b = 6-2.8',
28758
 
            '(a < b)',
28759
 
            '5 cm < 2 inch'
28760
 
          ],
28761
 
          'seealso': [
28762
 
            'equal', 'unequal', 'larger', 'smallerEq', 'largerEq', 'compare'
28763
 
          ]
28764
 
        };
28765
 
 
28766
 
 
28767
 
/***/ },
28768
 
/* 279 */
28769
 
/***/ function(module, exports, __webpack_require__) {
28770
 
 
28771
 
        module.exports = {
28772
 
          'name': 'smallerEq',
28773
 
          'category': 'Relational',
28774
 
          'syntax': [
28775
 
            'x <= y',
28776
 
            'smallerEq(x, y)'
28777
 
          ],
28778
 
          'description':
28779
 
              'Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.',
28780
 
          'examples': [
28781
 
            '2 < 1+1',
28782
 
            '2 <= 1+1',
28783
 
            'a = 3.2',
28784
 
            'b = 6-2.8',
28785
 
            '(a < b)'
28786
 
          ],
28787
 
          'seealso': [
28788
 
            'equal', 'unequal', 'larger', 'smaller', 'largerEq', 'compare'
28789
 
          ]
28790
 
        };
28791
 
 
28792
 
 
28793
 
/***/ },
28794
 
/* 280 */
28795
 
/***/ function(module, exports, __webpack_require__) {
28796
 
 
28797
 
        module.exports = {
28798
 
          'name': 'unequal',
28799
 
          'category': 'Relational',
28800
 
          'syntax': [
28801
 
            'x != y',
28802
 
            'unequal(x, y)'
28803
 
          ],
28804
 
          'description':
28805
 
              'Check unequality of two values. Returns true if the values are unequal, and false if they are equal.',
28806
 
          'examples': [
28807
 
            '2+2 != 3',
28808
 
            '2+2 != 4',
28809
 
            'a = 3.2',
28810
 
            'b = 6-2.8',
28811
 
            'a != b',
28812
 
            '50cm != 0.5m',
28813
 
            '5 cm != 2 inch'
28814
 
          ],
28815
 
          'seealso': [
28816
 
            'equal', 'smaller', 'larger', 'smallerEq', 'largerEq', 'compare', 'deepEqual'
28817
 
          ]
28818
 
        };
28819
 
 
28820
 
 
28821
 
/***/ },
28822
 
/* 281 */
28823
 
/***/ function(module, exports, __webpack_require__) {
28824
 
 
28825
 
        module.exports = {
28826
 
          'name': 'max',
28827
 
          'category': 'Statistics',
28828
 
          'syntax': [
28829
 
            'max(a, b, c, ...)',
28830
 
            'max(A)',
28831
 
            'max(A, dim)'
28832
 
          ],
28833
 
          'description': 'Compute the maximum value of a list of values.',
28834
 
          'examples': [
28835
 
            'max(2, 3, 4, 1)',
28836
 
            'max([2, 3, 4, 1])',
28837
 
            'max([2, 5; 4, 3], 0)',
28838
 
            'max([2, 5; 4, 3], 1)',
28839
 
            'max(2.7, 7.1, -4.5, 2.0, 4.1)',
28840
 
            'min(2.7, 7.1, -4.5, 2.0, 4.1)'
28841
 
          ],
28842
 
          'seealso': [
28843
 
            'mean',
28844
 
            'median',
28845
 
            'min',
28846
 
            'prod',
28847
 
            'std',
28848
 
            'sum',
28849
 
            'var'
28850
 
          ]
28851
 
        };
28852
 
 
28853
 
 
28854
 
/***/ },
28855
 
/* 282 */
28856
 
/***/ function(module, exports, __webpack_require__) {
28857
 
 
28858
 
        module.exports = {
28859
 
          'name': 'mean',
28860
 
          'category': 'Statistics',
28861
 
          'syntax': [
28862
 
            'mean(a, b, c, ...)',
28863
 
            'mean(A)',
28864
 
            'mean(A, dim)'
28865
 
          ],
28866
 
          'description': 'Compute the arithmetic mean of a list of values.',
28867
 
          'examples': [
28868
 
            'mean(2, 3, 4, 1)',
28869
 
            'mean([2, 3, 4, 1])',
28870
 
            'mean([2, 5; 4, 3], 0)',
28871
 
            'mean([2, 5; 4, 3], 1)',
28872
 
            'mean([1.0, 2.7, 3.2, 4.0])'
28873
 
          ],
28874
 
          'seealso': [
28875
 
            'max',
28876
 
            'median',
28877
 
            'min',
28878
 
            'prod',
28879
 
            'std',
28880
 
            'sum',
28881
 
            'var'
28882
 
          ]
28883
 
        };
28884
 
 
28885
 
 
28886
 
/***/ },
28887
 
/* 283 */
28888
 
/***/ function(module, exports, __webpack_require__) {
28889
 
 
28890
 
        module.exports = {
28891
 
          'name': 'median',
28892
 
          'category': 'Statistics',
28893
 
          'syntax': [
28894
 
            'median(a, b, c, ...)',
28895
 
            'median(A)'
28896
 
          ],
28897
 
          'description': 'Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.',
28898
 
          'examples': [
28899
 
            'median(5, 2, 7)',
28900
 
            'median([3, -1, 5, 7])'
28901
 
          ],
28902
 
          'seealso': [
28903
 
            'max',
28904
 
            'mean',
28905
 
            'min',
28906
 
            'prod',
28907
 
            'std',
28908
 
            'sum',
28909
 
            'var'
28910
 
          ]
28911
 
        };
28912
 
 
28913
 
 
28914
 
/***/ },
28915
 
/* 284 */
28916
 
/***/ function(module, exports, __webpack_require__) {
28917
 
 
28918
 
        module.exports = {
28919
 
          'name': 'min',
28920
 
          'category': 'Statistics',
28921
 
          'syntax': [
28922
 
            'min(a, b, c, ...)',
28923
 
            'min(A)',
28924
 
            'min(A, dim)'
28925
 
          ],
28926
 
          'description': 'Compute the minimum value of a list of values.',
28927
 
          'examples': [
28928
 
            'min(2, 3, 4, 1)',
28929
 
            'min([2, 3, 4, 1])',
28930
 
            'min([2, 5; 4, 3], 0)',
28931
 
            'min([2, 5; 4, 3], 1)',
28932
 
            'min(2.7, 7.1, -4.5, 2.0, 4.1)',
28933
 
            'max(2.7, 7.1, -4.5, 2.0, 4.1)'
28934
 
          ],
28935
 
          'seealso': [
28936
 
            'max',
28937
 
            'mean',
28938
 
            'median',
28939
 
            'prod',
28940
 
            'std',
28941
 
            'sum',
28942
 
            'var'
28943
 
          ]
28944
 
        };
28945
 
 
28946
 
 
28947
 
/***/ },
28948
 
/* 285 */
28949
 
/***/ function(module, exports, __webpack_require__) {
28950
 
 
28951
 
        module.exports = {
28952
 
          'name': 'prod',
28953
 
          'category': 'Statistics',
28954
 
          'syntax': [
28955
 
            'prod(a, b, c, ...)',
28956
 
            'prod(A)'
28957
 
          ],
28958
 
          'description': 'Compute the product of all values.',
28959
 
          'examples': [
28960
 
            'prod(2, 3, 4)',
28961
 
            'prod([2, 3, 4])',
28962
 
            'prod([2, 5; 4, 3])'
28963
 
          ],
28964
 
          'seealso': [
28965
 
            'max',
28966
 
            'mean',
28967
 
            'min',
28968
 
            'median',
28969
 
            'min',
28970
 
            'std',
28971
 
            'sum',
28972
 
            'var'
28973
 
          ]
28974
 
        };
28975
 
 
28976
 
 
28977
 
/***/ },
28978
 
/* 286 */
28979
 
/***/ function(module, exports, __webpack_require__) {
28980
 
 
28981
 
        module.exports = {
28982
 
          'name': 'std',
28983
 
          'category': 'Statistics',
28984
 
          'syntax': [
28985
 
            'std(a, b, c, ...)',
28986
 
            'std(A)',
28987
 
            'std(A, normalization)'
28988
 
          ],
28989
 
          'description': 'Compute the standard deviation of all values, defined as std(A) = sqrt(var(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',
28990
 
          'examples': [
28991
 
            'std(2, 4, 6)',
28992
 
            'std([2, 4, 6, 8])',
28993
 
            'std([2, 4, 6, 8], "uncorrected")',
28994
 
            'std([2, 4, 6, 8], "biased")',
28995
 
            'std([1, 2, 3; 4, 5, 6])'
28996
 
          ],
28997
 
          'seealso': [
28998
 
            'max',
28999
 
            'mean',
29000
 
            'min',
29001
 
            'median',
29002
 
            'min',
29003
 
            'prod',
29004
 
            'sum',
29005
 
            'var'
29006
 
          ]
29007
 
        };
29008
 
 
29009
 
 
29010
 
/***/ },
29011
 
/* 287 */
29012
 
/***/ function(module, exports, __webpack_require__) {
29013
 
 
29014
 
        module.exports = {
29015
 
          'name': 'sum',
29016
 
          'category': 'Statistics',
29017
 
          'syntax': [
29018
 
            'sum(a, b, c, ...)',
29019
 
            'sum(A)'
29020
 
          ],
29021
 
          'description': 'Compute the sum of all values.',
29022
 
          'examples': [
29023
 
            'sum(2, 3, 4, 1)',
29024
 
            'sum([2, 3, 4, 1])',
29025
 
            'sum([2, 5; 4, 3])'
29026
 
          ],
29027
 
          'seealso': [
29028
 
            'max',
29029
 
            'mean',
29030
 
            'median',
29031
 
            'min',
29032
 
            'prod',
29033
 
            'std',
29034
 
            'sum',
29035
 
            'var'
29036
 
          ]
29037
 
        };
29038
 
 
29039
 
 
29040
 
/***/ },
29041
 
/* 288 */
29042
 
/***/ function(module, exports, __webpack_require__) {
29043
 
 
29044
 
        module.exports = {
29045
 
          'name': 'var',
29046
 
          'category': 'Statistics',
29047
 
          'syntax': [
29048
 
            'var(a, b, c, ...)',
29049
 
            'var(A)',
29050
 
            'var(A, normalization)'
29051
 
          ],
29052
 
          'description': 'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',
29053
 
          'examples': [
29054
 
            'var(2, 4, 6)',
29055
 
            'var([2, 4, 6, 8])',
29056
 
            'var([2, 4, 6, 8], "uncorrected")',
29057
 
            'var([2, 4, 6, 8], "biased")',
29058
 
            'var([1, 2, 3; 4, 5, 6])'
29059
 
          ],
29060
 
          'seealso': [
29061
 
            'max',
29062
 
            'mean',
29063
 
            'min',
29064
 
            'median',
29065
 
            'min',
29066
 
            'prod',
29067
 
            'std',
29068
 
            'sum'
29069
 
          ]
29070
 
        };
29071
 
 
29072
 
 
29073
 
/***/ },
29074
 
/* 289 */
29075
 
/***/ function(module, exports, __webpack_require__) {
29076
 
 
29077
 
        module.exports = {
29078
 
          'name': 'acos',
29079
 
          'category': 'Trigonometry',
29080
 
          'syntax': [
29081
 
            'acos(x)'
29082
 
          ],
29083
 
          'description': 'Compute the inverse cosine of a value in radians.',
29084
 
          'examples': [
29085
 
            'acos(0.5)',
29086
 
            'acos(cos(2.3))'
29087
 
          ],
29088
 
          'seealso': [
29089
 
            'cos',
29090
 
            'atan',
29091
 
            'asin'
29092
 
          ]
29093
 
        };
29094
 
 
29095
 
 
29096
 
/***/ },
29097
 
/* 290 */
29098
 
/***/ function(module, exports, __webpack_require__) {
29099
 
 
29100
 
        module.exports = {
29101
 
          'name': 'asin',
29102
 
          'category': 'Trigonometry',
29103
 
          'syntax': [
29104
 
            'asin(x)'
29105
 
          ],
29106
 
          'description': 'Compute the inverse sine of a value in radians.',
29107
 
          'examples': [
29108
 
            'asin(0.5)',
29109
 
            'asin(sin(2.3))'
29110
 
          ],
29111
 
          'seealso': [
29112
 
            'sin',
29113
 
            'acos',
29114
 
            'atan'
29115
 
          ]
29116
 
        };
29117
 
 
29118
 
 
29119
 
/***/ },
29120
 
/* 291 */
29121
 
/***/ function(module, exports, __webpack_require__) {
29122
 
 
29123
 
        module.exports = {
29124
 
          'name': 'atan',
29125
 
          'category': 'Trigonometry',
29126
 
          'syntax': [
29127
 
            'atan(x)'
29128
 
          ],
29129
 
          'description': 'Compute the inverse tangent of a value in radians.',
29130
 
          'examples': [
29131
 
            'atan(0.5)',
29132
 
            'atan(tan(2.3))'
29133
 
          ],
29134
 
          'seealso': [
29135
 
            'tan',
29136
 
            'acos',
29137
 
            'asin'
29138
 
          ]
29139
 
        };
29140
 
 
29141
 
 
29142
 
/***/ },
29143
 
/* 292 */
29144
 
/***/ function(module, exports, __webpack_require__) {
29145
 
 
29146
 
        module.exports = {
29147
 
          'name': 'atan2',
29148
 
          'category': 'Trigonometry',
29149
 
          'syntax': [
29150
 
            'atan2(y, x)'
29151
 
          ],
29152
 
          'description':
29153
 
              'Computes the principal value of the arc tangent of y/x in radians.',
29154
 
          'examples': [
29155
 
            'atan2(2, 2) / pi',
29156
 
            'angle = 60 deg in rad',
29157
 
            'x = cos(angle)',
29158
 
            'y = sin(angle)',
29159
 
            'atan2(y, x)'
29160
 
          ],
29161
 
          'seealso': [
29162
 
            'sin',
29163
 
            'cos',
29164
 
            'tan'
29165
 
          ]
29166
 
        };
29167
 
 
29168
 
 
29169
 
/***/ },
29170
 
/* 293 */
29171
 
/***/ function(module, exports, __webpack_require__) {
29172
 
 
29173
 
        module.exports = {
29174
 
          'name': 'cos',
29175
 
          'category': 'Trigonometry',
29176
 
          'syntax': [
29177
 
            'cos(x)'
29178
 
          ],
29179
 
          'description': 'Compute the cosine of x in radians.',
29180
 
          'examples': [
29181
 
            'cos(2)',
29182
 
            'cos(pi / 4) ^ 2',
29183
 
            'cos(180 deg)',
29184
 
            'cos(60 deg)',
29185
 
            'sin(0.2)^2 + cos(0.2)^2'
29186
 
          ],
29187
 
          'seealso': [
29188
 
            'acos',
29189
 
            'sin',
29190
 
            'tan'
29191
 
          ]
29192
 
        };
29193
 
 
29194
 
 
29195
 
/***/ },
29196
 
/* 294 */
29197
 
/***/ function(module, exports, __webpack_require__) {
29198
 
 
29199
 
        module.exports = {
29200
 
          'name': 'cosh',
29201
 
          'category': 'Trigonometry',
29202
 
          'syntax': [
29203
 
            'cosh(x)'
29204
 
          ],
29205
 
          'description': 'Compute the hyperbolic cosine of x in radians.',
29206
 
          'examples': [
29207
 
            'cosh(0.5)'
29208
 
          ],
29209
 
          'seealso': [
29210
 
            'sinh',
29211
 
            'tanh',
29212
 
            'coth'
29213
 
          ]
29214
 
        };
29215
 
 
29216
 
 
29217
 
/***/ },
29218
 
/* 295 */
29219
 
/***/ function(module, exports, __webpack_require__) {
29220
 
 
29221
 
        module.exports = {
29222
 
          'name': 'cot',
29223
 
          'category': 'Trigonometry',
29224
 
          'syntax': [
29225
 
            'cot(x)'
29226
 
          ],
29227
 
          'description': 'Compute the cotangent of x in radians. Defined as 1/tan(x)',
29228
 
          'examples': [
29229
 
            'cot(2)',
29230
 
            '1 / tan(2)'
29231
 
          ],
29232
 
          'seealso': [
29233
 
            'sec',
29234
 
            'csc',
29235
 
            'tan'
29236
 
          ]
29237
 
        };
29238
 
 
29239
 
 
29240
 
/***/ },
29241
 
/* 296 */
29242
 
/***/ function(module, exports, __webpack_require__) {
29243
 
 
29244
 
        module.exports = {
29245
 
          'name': 'coth',
29246
 
          'category': 'Trigonometry',
29247
 
          'syntax': [
29248
 
            'coth(x)'
29249
 
          ],
29250
 
          'description': 'Compute the hyperbolic cotangent of x in radians.',
29251
 
          'examples': [
29252
 
            'coth(2)',
29253
 
            '1 / tanh(2)'
29254
 
          ],
29255
 
          'seealso': [
29256
 
            'sech',
29257
 
            'csch',
29258
 
            'tanh'
29259
 
          ]
29260
 
        };
29261
 
 
29262
 
 
29263
 
/***/ },
29264
 
/* 297 */
29265
 
/***/ function(module, exports, __webpack_require__) {
29266
 
 
29267
 
        module.exports = {
29268
 
          'name': 'csc',
29269
 
          'category': 'Trigonometry',
29270
 
          'syntax': [
29271
 
            'csc(x)'
29272
 
          ],
29273
 
          'description': 'Compute the cosecant of x in radians. Defined as 1/sin(x)',
29274
 
          'examples': [
29275
 
            'csc(2)',
29276
 
            '1 / sin(2)'
29277
 
          ],
29278
 
          'seealso': [
29279
 
            'sec',
29280
 
            'cot',
29281
 
            'sin'
29282
 
          ]
29283
 
        };
29284
 
 
29285
 
 
29286
 
/***/ },
29287
 
/* 298 */
29288
 
/***/ function(module, exports, __webpack_require__) {
29289
 
 
29290
 
        module.exports = {
29291
 
          'name': 'csch',
29292
 
          'category': 'Trigonometry',
29293
 
          'syntax': [
29294
 
            'csch(x)'
29295
 
          ],
29296
 
          'description': 'Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)',
29297
 
          'examples': [
29298
 
            'csch(2)',
29299
 
            '1 / sinh(2)'
29300
 
          ],
29301
 
          'seealso': [
29302
 
            'sech',
29303
 
            'coth',
29304
 
            'sinh'
29305
 
          ]
29306
 
        };
29307
 
 
29308
 
 
29309
 
/***/ },
29310
 
/* 299 */
29311
 
/***/ function(module, exports, __webpack_require__) {
29312
 
 
29313
 
        module.exports = {
29314
 
          'name': 'sec',
29315
 
          'category': 'Trigonometry',
29316
 
          'syntax': [
29317
 
            'sec(x)'
29318
 
          ],
29319
 
          'description': 'Compute the secant of x in radians. Defined as 1/cos(x)',
29320
 
          'examples': [
29321
 
            'sec(2)',
29322
 
            '1 / cos(2)'
29323
 
          ],
29324
 
          'seealso': [
29325
 
            'cot',
29326
 
            'csc',
29327
 
            'cos'
29328
 
          ]
29329
 
        };
29330
 
 
29331
 
 
29332
 
/***/ },
29333
 
/* 300 */
29334
 
/***/ function(module, exports, __webpack_require__) {
29335
 
 
29336
 
        module.exports = {
29337
 
          'name': 'sech',
29338
 
          'category': 'Trigonometry',
29339
 
          'syntax': [
29340
 
            'sech(x)'
29341
 
          ],
29342
 
          'description': 'Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)',
29343
 
          'examples': [
29344
 
            'sech(2)',
29345
 
            '1 / cosh(2)'
29346
 
          ],
29347
 
          'seealso': [
29348
 
            'coth',
29349
 
            'csch',
29350
 
            'cosh'
29351
 
          ]
29352
 
        };
29353
 
 
29354
 
 
29355
 
/***/ },
29356
 
/* 301 */
29357
 
/***/ function(module, exports, __webpack_require__) {
29358
 
 
29359
 
        module.exports = {
29360
 
          'name': 'sin',
29361
 
          'category': 'Trigonometry',
29362
 
          'syntax': [
29363
 
            'sin(x)'
29364
 
          ],
29365
 
          'description': 'Compute the sine of x in radians.',
29366
 
          'examples': [
29367
 
            'sin(2)',
29368
 
            'sin(pi / 4) ^ 2',
29369
 
            'sin(90 deg)',
29370
 
            'sin(30 deg)',
29371
 
            'sin(0.2)^2 + cos(0.2)^2'
29372
 
          ],
29373
 
          'seealso': [
29374
 
            'asin',
29375
 
            'cos',
29376
 
            'tan'
29377
 
          ]
29378
 
        };
29379
 
 
29380
 
 
29381
 
/***/ },
29382
 
/* 302 */
29383
 
/***/ function(module, exports, __webpack_require__) {
29384
 
 
29385
 
        module.exports = {
29386
 
          'name': 'sinh',
29387
 
          'category': 'Trigonometry',
29388
 
          'syntax': [
29389
 
            'sinh(x)'
29390
 
          ],
29391
 
          'description': 'Compute the hyperbolic sine of x in radians.',
29392
 
          'examples': [
29393
 
            'sinh(0.5)'
29394
 
          ],
29395
 
          'seealso': [
29396
 
            'cosh',
29397
 
            'tanh'
29398
 
          ]
29399
 
        };
29400
 
 
29401
 
 
29402
 
/***/ },
29403
 
/* 303 */
29404
 
/***/ function(module, exports, __webpack_require__) {
29405
 
 
29406
 
        module.exports = {
29407
 
          'name': 'tan',
29408
 
          'category': 'Trigonometry',
29409
 
          'syntax': [
29410
 
            'tan(x)'
29411
 
          ],
29412
 
          'description': 'Compute the tangent of x in radians.',
29413
 
          'examples': [
29414
 
            'tan(0.5)',
29415
 
            'sin(0.5) / cos(0.5)',
29416
 
            'tan(pi / 4)',
29417
 
            'tan(45 deg)'
29418
 
          ],
29419
 
          'seealso': [
29420
 
            'atan',
29421
 
            'sin',
29422
 
            'cos'
29423
 
          ]
29424
 
        };
29425
 
 
29426
 
 
29427
 
/***/ },
29428
 
/* 304 */
29429
 
/***/ function(module, exports, __webpack_require__) {
29430
 
 
29431
 
        module.exports = {
29432
 
          'name': 'tanh',
29433
 
          'category': 'Trigonometry',
29434
 
          'syntax': [
29435
 
            'tanh(x)'
29436
 
          ],
29437
 
          'description': 'Compute the hyperbolic tangent of x in radians.',
29438
 
          'examples': [
29439
 
            'tanh(0.5)',
29440
 
            'sinh(0.5) / cosh(0.5)'
29441
 
          ],
29442
 
          'seealso': [
29443
 
            'sinh',
29444
 
            'cosh'
29445
 
          ]
29446
 
        };
29447
 
 
29448
 
 
29449
 
/***/ },
29450
 
/* 305 */
29451
 
/***/ function(module, exports, __webpack_require__) {
29452
 
 
29453
 
        module.exports = {
29454
 
          'name': 'to',
29455
 
          'category': 'Units',
29456
 
          'syntax': [
29457
 
            'x to unit',
29458
 
            'to(x, unit)'
29459
 
          ],
29460
 
          'description': 'Change the unit of a value.',
29461
 
          'examples': [
29462
 
            '5 inch to cm',
29463
 
            '3.2kg to g',
29464
 
            '16 bytes in bits'
29465
 
          ],
29466
 
          'seealso': []
29467
 
        };
29468
 
 
29469
 
 
29470
 
/***/ },
29471
 
/* 306 */
29472
 
/***/ function(module, exports, __webpack_require__) {
29473
 
 
29474
 
        module.exports = {
29475
 
          'name': 'clone',
29476
 
          'category': 'Utils',
29477
 
          'syntax': [
29478
 
            'clone(x)'
29479
 
          ],
29480
 
          'description': 'Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices',
29481
 
          'examples': [
29482
 
            'clone(3.5)',
29483
 
            'clone(2 - 4i)',
29484
 
            'clone(45 deg)',
29485
 
            'clone([1, 2; 3, 4])',
29486
 
            'clone("hello world")'
29487
 
          ],
29488
 
          'seealso': []
29489
 
        };
29490
 
 
29491
 
 
29492
 
/***/ },
29493
 
/* 307 */
29494
 
/***/ function(module, exports, __webpack_require__) {
29495
 
 
29496
 
        module.exports = {
29497
 
          'name': 'map',
29498
 
          'category': 'Utils',
29499
 
          'syntax': [
29500
 
            'map(x, callback)'
29501
 
          ],
29502
 
          'description': 'Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.',
29503
 
          'examples': [
29504
 
            'map([1, 2, 3], function(val) { return value * value })'
29505
 
          ],
29506
 
          'seealso': ['filter', 'forEach']
29507
 
        };
29508
 
 
29509
 
 
29510
 
/***/ },
29511
 
/* 308 */
29512
 
/***/ function(module, exports, __webpack_require__) {
29513
 
 
29514
 
        module.exports = {
29515
 
          'name': 'filter',
29516
 
          'category': 'Utils',
29517
 
          'syntax': [
29518
 
            'filter(x, test)'
29519
 
          ],
29520
 
          'description': 'Filter items in a matrix.',
29521
 
          'examples': [
29522
 
            'isPositive(x) = x > 0',
29523
 
            'filter([6, -2, -1, 4, 3], isPositive)',
29524
 
            'filter([6, -2, 0, 1, 0], x != 0)'
29525
 
          ],
29526
 
          'seealso': ['sort', 'map', 'forEach']
29527
 
        };
29528
 
 
29529
 
 
29530
 
/***/ },
29531
 
/* 309 */
29532
 
/***/ function(module, exports, __webpack_require__) {
29533
 
 
29534
 
        module.exports = {
29535
 
          'name': 'forEach',
29536
 
          'category': 'Utils',
29537
 
          'syntax': [
29538
 
            'forEach(x, callback)'
29539
 
          ],
29540
 
          'description': 'Iterates over all elements of a matrix/array, and executes the given callback function.',
29541
 
          'examples': [
29542
 
            'forEach([1, 2, 3], function(val) { console.log(val) })'
29543
 
          ],
29544
 
          'seealso': ['map', 'sort', 'filter']
29545
 
        };
29546
 
 
29547
 
 
29548
 
/***/ },
29549
 
/* 310 */
29550
 
/***/ function(module, exports, __webpack_require__) {
29551
 
 
29552
 
        module.exports = {
29553
 
          'name': 'format',
29554
 
          'category': 'Utils',
29555
 
          'syntax': [
29556
 
            'format(value)',
29557
 
            'format(value, precision)'
29558
 
          ],
29559
 
          'description': 'Format a value of any type as string.',
29560
 
          'examples': [
29561
 
            'format(2.3)',
29562
 
            'format(3 - 4i)',
29563
 
            'format([])',
29564
 
            'format(pi, 3)'
29565
 
          ],
29566
 
          'seealso': ['print']
29567
 
        };
29568
 
 
29569
 
 
29570
 
/***/ },
29571
 
/* 311 */
29572
 
/***/ function(module, exports, __webpack_require__) {
29573
 
 
29574
 
        module.exports = {
29575
 
          'name': 'import',
29576
 
          'category': 'Utils',
29577
 
          'syntax': [
29578
 
            'import(string)'
29579
 
          ],
29580
 
          'description': 'Import functions from a file.',
29581
 
          'examples': [
29582
 
            'import("numbers")',
29583
 
            'import("./mylib.js")'
29584
 
          ],
29585
 
          'seealso': []
29586
 
        };
29587
 
 
29588
 
 
29589
 
/***/ },
29590
 
/* 312 */
29591
 
/***/ function(module, exports, __webpack_require__) {
29592
 
 
29593
 
        module.exports = {
29594
 
          'name': 'sort',
29595
 
          'category': 'Utils',
29596
 
          'syntax': [
29597
 
            'sort(x)',
29598
 
            'sort(x, compare)'
29599
 
          ],
29600
 
          'description': 'Sort the items in a matrix. Compare can be a string "asc" or "desc", or a custom sort function.',
29601
 
          'examples': [
29602
 
            'sort([5, 10, 1])',
29603
 
            'sort(["C", "B", "A", "D"])',
29604
 
            'sortByLength(a, b) = size(a)[1] - size(b)[1]',
29605
 
            'sort(["Langdon", "Tom", "Sara"], sortByLength)'
29606
 
          ],
29607
 
          'seealso': ['map', 'filter', 'forEach']
29608
 
        };
29609
 
 
29610
 
 
29611
 
/***/ },
29612
 
/* 313 */
29613
 
/***/ function(module, exports, __webpack_require__) {
29614
 
 
29615
 
        module.exports = {
29616
 
          'name': 'typeof',
29617
 
          'category': 'Utils',
29618
 
          'syntax': [
29619
 
            'typeof(x)'
29620
 
          ],
29621
 
          'description': 'Get the type of a variable.',
29622
 
          'examples': [
29623
 
            'typeof(3.5)',
29624
 
            'typeof(2 - 4i)',
29625
 
            'typeof(45 deg)',
29626
 
            'typeof("hello world")'
29627
 
          ],
29628
 
          'seealso': []
29629
 
        };
29630
 
 
29631
 
 
29632
 
/***/ },
29633
 
/* 314 */
 
31958
/* 337 */
29634
31959
/***/ function(module, exports, __webpack_require__) {
29635
31960
 
29636
31961
        'use strict';
29642
31967
 
29643
31968
 
29644
31969
/***/ },
29645
 
/* 315 */
 
31970
/* 338 */
29646
31971
/***/ function(module, exports, __webpack_require__) {
29647
31972
 
29648
31973
        'use strict';
29649
31974
 
29650
 
        var ArrayNode = __webpack_require__(161),
29651
 
            OperatorNode = __webpack_require__(168);
 
31975
        // FIXME: remove dependencies on Nodes
 
31976
        var ArrayNode = __webpack_require__(172);
 
31977
        var OperatorNode = __webpack_require__(181);
 
31978
        var SymbolNode = __webpack_require__(183);
 
31979
        var ConstantNode = __webpack_require__(176);
29652
31980
 
29653
31981
        // GREEK LETTERS
29654
31982
        var greek = {
29998
32326
 
29999
32327
            case 'permutations':
30000
32328
              if (args.length === 1) {
30001
 
                op = '!';
 
32329
                if (args[0] instanceof SymbolNode || args[0] instanceof ConstantNode) {
 
32330
                  op = '!';
 
32331
                }
 
32332
                else {
 
32333
                  return '{\\left(' + args[0].toTex() + '\\right)!}';
 
32334
                }
30002
32335
              }
30003
32336
              else {
30004
32337
                // op = 'P';