From 107a6c4566f9443cd8941f01a37438d322dba22d Mon Sep 17 00:00:00 2001 From: Lars Olesen Date: Fri, 15 Nov 2019 19:35:36 +0000 Subject: [PATCH] Added Nuckols Index --- src/js/strength.js | 24 ++++++++++++++++++++++-- src/test/strength.js | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/js/strength.js b/src/js/strength.js index 1c5326018c1b..4638794262f1 100644 --- a/src/js/strength.js +++ b/src/js/strength.js @@ -7,11 +7,31 @@ motionsplan.Strength = function(weight, body_weight) { function getIndex100() { var Loeft = weight; var Vaegt = body_weight; - return Math.round(Loeft * 986.63 / (1270.4 - 172970 * ((Math.pow(Vaegt, -1.3925)))) * Math.pow(10, 0)) / Math.pow(10, 0) + return Math.round(Loeft * 986.63 / (1270.4 - 172970 * ((Math.pow(Vaegt, -1.3925)))) * Math.pow(10, 0)) / Math.pow(10, 0); + } + + function getAllometricScaling() { + var S = weight; + var M = body_weight; + return S * Math.pow(M, -2/3); + } + + function getBodyweightPercent() { + return weight / body_weight; + } + + function getNuckolsIndex() { + var a, b; + var w = weight; + var bw = body_weight; + + return 100*w/(a*Math.pow(bw, 2)+b*bw); } var publicAPI = { - getIndex100: getIndex100 + getIndex100 : getIndex100, + getAllometricScaling : getAllometricScaling, + getBodyweightPercent : getBodyweightPercent }; return publicAPI; diff --git a/src/test/strength.js b/src/test/strength.js index 5449417fce01..272a1d817bda 100644 --- a/src/test/strength.js +++ b/src/test/strength.js @@ -9,4 +9,24 @@ describe('Strength', function() { assert.equal(rm.getIndex100(), 89); }); }); + describe('getAllometricScaling', function() { + it('should return the correct number', function() { + // weigt, reps + var rm = motionsplan.Strength(405, 220); + assert.equal(rm.getAllometricScaling(), 11.11321976546847); + + var rm = motionsplan.Strength(300, 150); + assert.equal(rm.getAllometricScaling(), 10.626585691826113); + }); + }); + describe('getBodyweightPercent', function() { + it('should return the correct number', function() { + // weigt, reps + var rm = motionsplan.Strength(405, 220); + assert.equal(rm.getBodyweightPercent(), 1.8409090909090908); + + var rm = motionsplan.Strength(300, 150); + assert.equal(rm.getBodyweightPercent(), 2); + }); + }); });