459,520 Members | 1,271 Online Need help? Post your question and get tips & solutions from a community of 459,520 IT Pros & Developers. It's quick & easy.

# math formula

 P: n/a I am trying to put the following math formula in php, but I know to little of math to do it I guess, maybe somebody can help me out. This is the formula: x = (-ln(1) - ln(y/100))*100*z The values for y and z will be submitted via a form. Any help is greatly apreciated. Wim Jul 17 '05 #1
5 Replies

 P: n/a On 2005-04-08, Wim Smit wrote: I am trying to put the following math formula in php, but I know to little of math to do it I guess, maybe somebody can help me out. This is the formula: x = (-ln(1) - ln(y/100))*100*z The values for y and z will be submitted via a form. Any help is greatly apreciated. Start by learning how to submit a variable through a form. Then move on to processing the variable. The PHP manual will tell you how to do this. -- Cheers - Jacob Atzen Jul 17 '05 #2

 P: n/a Wim Smit wrote: I am trying to put the following math formula in php, but I know to little of math to do it I guess, maybe somebody can help me out. This is the formula: x = (-ln(1) - ln(y/100))*100*z The values for y and z will be submitted via a form. Any help is greatly apreciated. Wim The PHP function for natural logarithms is log(), not ln(). Variable names start with a \$ symbol, e.g.: \$x = \$_GET['x']; \$y = \$_GET['y']; Fix that, put a semicolon at the end and it should work. BTW, ln(1) is equal to zero, so you can delete it from your equation. -- phil [dot] ronan @ virgin [dot] net http://vzone.virgin.net/phil.ronan/ Jul 17 '05 #3

 P: n/a Thanks for the quick reply. I tried to use this code now: \$x = (- log(1) - log(0.06/100))*100*673356; The value of \$x is 499534596.235 However the value of \$x should be 4645225. U sure log() in PHP does the same as ln()? Wim "Philip Ronan" schreef in bericht news:BE7C1758.2E294%in*****@invalid.invalid... Wim Smit wrote: I am trying to put the following math formula in php, but I know to little of math to do it I guess, maybe somebody can help me out. This is the formula: x = (-ln(1) - ln(y/100))*100*z The values for y and z will be submitted via a form. Any help is greatly apreciated. Wim The PHP function for natural logarithms is log(), not ln(). Variable names start with a \$ symbol, e.g.: \$x = \$_GET['x']; \$y = \$_GET['y']; Fix that, put a semicolon at the end and it should work. BTW, ln(1) is equal to zero, so you can delete it from your equation. -- phil [dot] ronan @ virgin [dot] net http://vzone.virgin.net/phil.ronan/ Jul 17 '05 #4

 P: n/a Submitting a variable won't be the problem, it is getting PHP to do the formula correctly. ln() does not show up in the manual, likely there is a way around that, but I know to little of math on how to solve that. :). Wim "Jacob Atzen" schreef in bericht news:sl*******************@tank.aub.dk... On 2005-04-08, Wim Smit wrote: I am trying to put the following math formula in php, but I know to little of math to do it I guess, maybe somebody can help me out. This is the formula: x = (-ln(1) - ln(y/100))*100*z The values for y and z will be submitted via a form. Any help is greatly apreciated. Start by learning how to submit a variable through a form. Then move on to processing the variable. The PHP manual will tell you how to do this. -- Cheers - Jacob Atzen Jul 17 '05 #5

 P: n/a Wim Smit wrote: Thanks for the quick reply. I tried to use this code now: \$x = (- log(1) - log(0.06/100))*100*673356; The value of \$x is 499534596.235 That is correct However the value of \$x should be 4645225. That is incorrect U sure log() in PHP does the same as ln()? log() is a natural logarithm function. That's what you want, isn't it? Use log10() if you want base 10 logarithms Take a look at and -- phil [dot] ronan @ virgin [dot] net http://vzone.virgin.net/phil.ronan/ Jul 17 '05 #6

### This discussion thread is closed

Replies have been disabled for this discussion. 