mathigon / fermat.js

Mathematics and statistics library for TypeScript.
http://mathigon.io/fermat
MIT License
103 stars 15 forks source link

No way to create a Vector from an array of number. #101

Closed St0wy closed 2 years ago

St0wy commented 2 years ago

The current implementation of the Vector constructor makes it so that it's only possible to create a vector with individual numbers and not an array of numbers. It would be nice if it was possible to do something like that :

const numbers = [1, 2, 3];
const vector = new Vector(numbers);

PS: Is there a reason why every opperation like Vector.difference() returns number[] and not a Vector ?

shalanah commented 2 years ago

I haven't used Vector and don't know the history of it, in the short term you should be able to use new Vector(...numbers) to change the array into args.