# math formula

#### Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

•  Subject
• Author
• Posted on

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

## Re: math formula

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

## Re: math formula

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

## Re: math formula

Wim Smit wrote:

The PHP function for natural logarithms is log(), not ln(). Variable names

\$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 /

## Re: math formula

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

## Re: math formula

Wim Smit wrote:

That is correct

That is incorrect

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 <http://uk.php.net/log and <http://uk.php.net/log10

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan /