zad 02,03 #37

Closed
s426159 wants to merge 14 commits from s426159/DALGLI0:master into master
Showing only changes of commit d5ffbe9c29 - Show all commits

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