Jump to content

Help needed


JohnCarter

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>";
  }
}
Link to comment
Share on other sites

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 by Psycho
Link to comment
Share on other sites

 

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.