How to use the mathjs.min function in mathjs

To help you get started, we’ve selected a few mathjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xFFFFF / Gekko-Strategies / NN_ADX_RSI / NN_ADX_RSI.js View on Github external
calcHACandle = function(candle) {  

    xcloseprev = result.xclose;
    xopenprev = result.xopen;

    // Calculate new Heikin-Ashi candles
    result.xclose = (candle.open + candle.close + candle.high + candle.low)/4;
    // xOpen = [xOpen(Previous Bar) + xClose(Previous Bar)]/2
    result.xopen = (xopenprev + xcloseprev)/2;
    // xHigh = Max(High, xOpen, xClose)
    result.xhigh = math.max(candle.high, result.xopen, result.xclose);
    // xLow = Min(Low, xOpen, xClose)
    result.xlow = math.min(candle.low, result.xopen, result.xclose);

    return result;
} ; //calculo de velas
github dashersw / brain-bits / src / lib / methods.js View on Github external
function winsor(percentile, arr) {
    let rv = arr.slice();
    const len = rv.length;

    const mean = m.mean(rv);
    const std = m.std(rv);

    rv = rv.map(v => (v - mean) / std);

    const percentage = percentile / 100 / 2;
    const min = m.min(rv);
    // const min = m.quantileSeq(rv, percentage);
    const max = m.max(rv);
    // const max = m.quantileSeq(rv, 1 - percentage);
    for (let i = 0; i < len; i++) {
        if (rv[i] < min) rv[i] = min;
        else if (rv[i] > max) rv[i] = max;

        // rv[i] = normalize(min, max, rv[i]);
    }

    return rv;
}
github Bluegrass-Grief-Owls / coordin-eat / server / midpointAlgorithm / mockGetTravelTime.js View on Github external
.then(scores => {
			scores = scores.map(score => score ? score : 9999)
			console.log('scores', scores)
			const indexOfMin = scores.indexOf(math.min(scores))	
			const winner = lowScore < scores[indexOfMin] ? [centroid, lowScore] : [cands[indexOfMin], scores[indexOfMin]]
			return winner	
		})
		.catch(console.error.bind(console))
github Bluegrass-Grief-Owls / coordin-eat / server / annealing / index.js View on Github external
.then(scores => {
			scores = scores.map(score => score ? score : 9999)
			const indexOfMin = scores.indexOf(math.min(scores))	
			const winner = lowScore < scores[indexOfMin] ? [centroid, lowScore] : [cands[indexOfMin], scores[indexOfMin]]
			console.log(winner, counter)
			return winner	
		})
		.catch(console.error.bind(console))
github ElliotPenson / fractal.parts / frontend / src / graphics / standardization.js View on Github external
return produce(fractal, draft => {
    const { width, height } = getCanvasSize(canvas);
    const factor = min(
      width / draft.parent.width,
      height / draft.parent.height
    );
    draft.parent = scale(draft.parent, factor);
    draft.children = draft.children.map(child => scale(child, factor));
  });
}
github Zooz / predator / src / reports / models / finalReportGenerator.js View on Github external
if (result.errors[error]) {
                result.errors[error] += count;
            } else {
                result.errors[error] = count;
            }
        });

        result.rps.count += stats.rps.count;
        result.requestsCompleted += stats.requestsCompleted;

        result.pendingRequests += stats.pendingRequests;
    });

    result.rps.mean = result.rps.count / STATS_INTERVAL;
    result.latency.median = math.median(medians);
    result.latency.min = math.min(mins);
    result.latency.max = math.max(maxs);
    result.latency.p95 = math.sum(request95) / result.requestsCompleted;
    result.latency.p99 = math.sum(request99) / result.requestsCompleted;

    result.scenarioDuration.p95 = math.sum(scenario95) / result.scenariosCompleted;
    result.scenarioDuration.p99 = math.sum(scenario99) / result.scenariosCompleted;

    return result;
}
github ElliotPenson / fractal.parts / frontend / src / graphics / geometry.js View on Github external
get topmost() {
    return min(this.topLeft.y, this.topRight.y);
  }
github Zooz / predator / src / reports / models / aggregateReportGenerator.js View on Github external
if (result.errors[error]) {
                result.errors[error] += count;
            } else {
                result.errors[error] = count;
            }
        });
    });

    result.latency.median = math.median(requestMedians);
    result.latency.min = math.min(requestMins);
    result.latency.max = math.max(requestMaxs);
    result.latency.p95 = math.sum(request95) / result.requestsCompleted;
    result.latency.p99 = math.sum(request99) / result.requestsCompleted;

    result.scenarioDuration.median = math.median(scenarioMedians);
    result.scenarioDuration.min = math.min(scenarioMins);
    result.scenarioDuration.max = math.max(scenarioMaxs);
    result.scenarioDuration.p95 = math.sum(scenario95) / result.scenariosCompleted;
    result.scenarioDuration.p99 = math.sum(scenario99) / result.scenariosCompleted;

    return result;
}

mathjs

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif

Apache-2.0
Latest version published 1 month ago

Package Health Score

91 / 100
Full package analysis