-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
The eigs function throws a TypeError for some (but not all) matrices using BigNumber.
This example from eigs.test.js works as expected:
var A = [
[-4.78, -1.0, -2.59, -3.26, 4.24, 4.14],
[-1.0, -2.45, -0.92, -2.33, -4.68, 4.27],
[-2.59, -0.92, -2.45, 4.17, -3.33, 3.05],
[-3.26, -2.33, 4.17, 2.51, 1.67, 2.24],
[4.24, -4.68, -3.33, 1.67, 2.80, 2.73],
[4.14, 4.27, 3.05, 2.24, 2.73, -4.47]
];
A = math.bignumber(A);
const ans = math.eigs(A);However, the following example produces a TypeError:
var B = [
[0.0, 1.0, 0.0, 0.0, 0.0, 1.0],
[1.0, 0.0, 1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0, 1.0],
[1.0, 0.0, 0.0, 0.0, 1.0, 0.0]
];
B = math.bignumber(B);
const ans2 = math.eigs(B);TypeError: Cannot implicitly convert a number with >15 significant digits to BigNumber (value: 0.7071067811865476). Use function bignumber(x) to convert to BigNumber.
at convert (/home/professorchaos/Dokumente/javascript/node_modules/mathjs/lib/core/function/typed.js:208:15)
at Array.convertArg (/home/professorchaos/Dokumente/javascript/node_modules/typed-function/typed-function.js:819:22)
at convertArgs (/home/professorchaos/Dokumente/javascript/node_modules/typed-function/typed-function.js:766:45)
at generic (/home/professorchaos/Dokumente/javascript/node_modules/typed-function/typed-function.js:1073:27)
at multiplyScalar (/home/professorchaos/Dokumente/javascript/node_modules/typed-function/typed-function.js:1092:24)
at Sij1Big (/home/professorchaos/Dokumente/javascript/node_modules/mathjs/lib/function/matrix/eigs.js:274:25)
at diagBig (/home/professorchaos/Dokumente/javascript/node_modules/mathjs/lib/function/matrix/eigs.js:202:13)
at checkAndSubmit (/home/professorchaos/Dokumente/javascript/node_modules/mathjs/lib/function/matrix/eigs.js:143:14)
at Array (/home/professorchaos/Dokumente/javascript/node_modules/mathjs/lib/function/matrix/eigs.js:73:17)
at Object.eigs (/home/professorchaos/Dokumente/javascript/node_modules/typed-function/typed-function.js:1085:85)I'm using math.js v6.6.1, the problem occurs both in node and in the browser using math.min.js. Let me know if you need any additional info.
Reactions are currently unavailable