How do I get points on a curve in PHP with log()?
- by Erick
I have a graph I am trying to replicate:
I have the following PHP code:
$sale_price = 25000;
$future_val = 5000;
$term = 60;
$x = $sale_price / $future_val;
$pts = array();
$pts[] = array($x,0);
for ($i=1; $i<=$term; $i++) {
$y = log($x+0.4)+2.5;
$pts[] = array($i,$y);
echo $y . " <br>\n";
}
How do I make the code work to give me the points along the lower line (between the yellow and blue areas)? It doesn't need to be exact, just somewhat close.
The formula is:
-ln(x+.4)+2.5
I got that by using the Online Function Grapher at http://www.livephysics.com/
Thanks in advance!!