math formula

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wim Smit

    math formula

    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


  • Jacob Atzen

    #2
    Re: math formula

    On 2005-04-08, Wim Smit <wim@vdhosting. nl> wrote:[color=blue]
    > 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.[/color]

    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

    Comment

    • Philip Ronan

      #3
      Re: math formula

      Wim Smit wrote:
      [color=blue]
      > 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
      >
      >[/color]

      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



      Comment

      • Wim Smit

        #4
        Re: math formula

        Thanks for the quick reply.

        I tried to use this code now:

        $x = (- log(1) - log(0.06/100))*100*67335 6;

        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" <invalid@invali d.invalid> schreef in bericht
        news:BE7C1758.2 E294%invalid@in valid.invalid.. .[color=blue]
        > Wim Smit wrote:
        >[color=green]
        >> 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
        >>
        >>[/color]
        >
        > 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/
        >
        >[/color]


        Comment

        • Wim Smit

          #5
          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


          "Jacob Atzen" <jacob@aub.dk > schreef in bericht
          news:slrnd5cm37 .2psh.jacob@tan k.aub.dk...[color=blue]
          > On 2005-04-08, Wim Smit <wim@vdhosting. nl> wrote:[color=green]
          >> 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.[/color]
          >
          > 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[/color]


          Comment

          • Philip Ronan

            #6
            Re: math formula

            Wim Smit wrote:
            [color=blue]
            > Thanks for the quick reply.
            >
            > I tried to use this code now:
            >
            > $x = (- log(1) - log(0.06/100))*100*67335 6;
            >
            > The value of $x is 499534596.235[/color]

            That is correct
            [color=blue]
            > However the value of $x should be 4645225.[/color]

            That is incorrect
            [color=blue]
            >
            > U sure log() in PHP does the same as ln()?[/color]

            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



            Comment

            Working...