1
0
forked from kalmar/DALGLI0
This commit is contained in:
Kacper Kruczek 2018-06-29 19:35:57 +02:00
parent 3393e46235
commit d5ffbe9c29

View File

@ -1,10 +1,20 @@
let Polynomial = require('./polynomial.js');
let mul, div, gcd;
console.log(process.argv[2]);
function parseArray(x) {
result = Array.from(x).filter(x => {
if (x == ' ' || x == '[' || x == ']' || x == ',') return false;
else return true;
}).map(x => parseInt(x));
return result;
}
let n = parseInt(process.argv[2]);
let f = new Polynomial.Class([1, 1, 1, 0, 1]);
let g = new Polynomial.Class([0, 1, 1]);
let p1 = parseArray(process.argv[3]);
let p2 = parseArray(process.argv[4]);
let f = new Polynomial.Class(p1);
let g = new Polynomial.Class(p2);
mul = Polynomial.multiply(f, g, 2).coefficients;
try {
div = Polynomial.divide(f, g, 2).coefficients