JohnCarter Posted July 23, 2013 Share Posted July 23, 2013 The idea I want to do based on this logarithm http://www.wolframalpha.com/input/?i...100+log%28x%29 Basically the idea is, have a linear progression of reps (+1 power per 100 reps you have), until that line intersects (around 640~), then it would follow the curve, which would reduce the progression of rep power. My problem is translating that into php Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted July 23, 2013 Share Posted July 23, 2013 your link doesn't work, and your information is a little sparse. Is this a php coding quertion or a php math question? Quote Link to comment Share on other sites More sharing options...
JohnCarter Posted July 23, 2013 Author Share Posted July 23, 2013 your link doesn't work, and your information is a little sparse. Is this a php coding quertion or a php math question? Oh I'm sorry I fixed the link http://www.wolframalpha.com/input/?i=x+%3D+100+log%28x%29 My problem is translating that into php. there's a natural logarithm function built in http://us3.php.net/log still at a loss how to apply the curve. Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted July 23, 2013 Share Posted July 23, 2013 So does something like the following help? for($i=1;$i<=700;$i++){ $rawLog= log($i); $roundedLog = round($x, 2); $roundedLogOneHundred = $y * 100; if($roundedLogOneHundred == $i){ echo $roundedLogOneHundred." - ".$i." <<<--- This one!!<br>"; } else{ echo $roundedLogOneHundred." - ".$i."<br>"; } } Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 23, 2013 Share Posted July 23, 2013 (edited) I'm not sure what X represents in your example: the reps or reps/100 (i.e. "+1 power per 100 reps you have"). I think it is the latter. So, the simplest solution would be something like this: function getPower($reps) { $divVal = $reps/100; $logVal = max(100 * log($divVal), 1); //Max is needed to prevent 0 being returned @ 100 reps return min($divVal, $logVal); } //Test loop for($rep=1; $rep<800; $rep++) { $reps = $rep * 100; $power = getPower($reps); echo "Reps: {$reps}, Power: {$power}<br>\n"; } Here is the part of the output from the test loop where you can see the transition take place: Reps: 64500, Power: 645 Reps: 64600, Power: 646 Reps: 64700, Power: 647 Reps: 64800, Power: 647.389069635 Reps: 64900, Power: 647.54327167 Reps: 65000, Power: 647.697236289 Edited July 23, 2013 by Psycho Quote Link to comment Share on other sites More sharing options...
JohnCarter Posted July 23, 2013 Author Share Posted July 23, 2013 I'm not sure what X represents in your example: the reps or reps/100 (i.e. "+1 power per 100 reps you have"). I think it is the latter. So, the simplest solution would be something like this: function getPower($reps) { $divVal = $reps/100; $logVal = max(100 * log($divVal), 1); //Max is needed to prevent 0 being returned @ 100 reps return min($divVal, $logVal); } //Test loop for($rep=1; $rep<800; $rep++) { $reps = $rep * 100; $power = getPower($reps); echo "Reps: {$reps}, Power: {$power}<br>\n"; } Here is the part of the output from the test loop where you can see the transition take place: Reps: 64500, Power: 645 Reps: 64600, Power: 646 Reps: 64700, Power: 647 Reps: 64800, Power: 647.389069635 Reps: 64900, Power: 647.54327167 Reps: 65000, Power: 647.697236289 Thanks for this, I will test it out later. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.