MCPcopy Create free account
hub / github.com/arguiot/TheoremJS / arange

Method arange

__test__/theorem.js:1330–1337  ·  view source on GitHub ↗
(start, end, step, offset)

Source from the content-addressed store, hash-verified

1328 return this.arange(start, end, step);
1329 }
1330 arange(start, end, step, offset) {
1331 const len = (Math.abs(end - start) + ((offset || 0) * 2)) / (step || 1) + 1;
1332 const direction = start < end ? 1 : -1;
1333 const startingPoint = start - (direction * (offset || 0));
1334 const stepSize = direction * (step || 1);
1335
1336 return Array(len).fill(0).map((_, index) => startingPoint + (stepSize * index));
1337 }
1338 range(n) {
1339 return this.arange(0, n, 1);
1340 }

Callers 4

linspaceMethod · 0.95
rangeMethod · 0.95
linspace.jsFile · 0.80
range.jsFile · 0.80

Calls 1

absMethod · 0.45

Tested by

no test coverage detected