Results 1 to 5 of 5

Thread: Math.pow

  1. #1

    Thread Starter
    Lively Member OT²O's Avatar
    Join Date
    Jan 2010
    Location
    Washington State
    Posts
    96

    Resolved Math.pow

    Can someone please explain Math.pow to me?
    I have this formula for compound interest and my question is, is year the only exponent even though 1 + rate, year are all in the ()?
    Also could you explain the formula to me? i just cant wrap my head around it. Why do you add 1 and why is it exponential?
    Code:
    amount=principal*Math.pow(1 + rate, year);
    Last edited by OT²O; Dec 16th, 2010 at 08:31 PM.
    On the off chance that I helped you (Rate This Post){
    Also If your problem was resolved;
    }

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Math.pow

    Check this link: http://math.about.com/library/weekly/aa042002a.htm

    This is how it looks like:
    Code:
    amount=principal*((1+rate)^year)

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Lively Member OT²O's Avatar
    Join Date
    Jan 2010
    Location
    Washington State
    Posts
    96

    Re: Math.pow

    Yeah that's what i thought but why when you use math pow you have to enter two parts separated by a comma and only one of them is the actual exponent? Like in this example 1+rate is not an exponent but it is in the math.pow but year is an exponent?
    Code:
    Math.pow(1 + rate, year);
    On the off chance that I helped you (Rate This Post){
    Also If your problem was resolved;
    }

  4. #4
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Math.pow

    Quote Originally Posted by OT²O View Post
    Yeah that's what i thought but why when you use math pow you have to enter two parts separated by a comma and only one of them is the actual exponent? Like in this example 1+rate is not an exponent but it is in the math.pow but year is an exponent?
    Code:
    Math.pow(1 + rate, year);
    pow is a function of the math object. Pow requires 2 arguments, the first being a double for the base number and the second being the number of the exponent.

    So Math.pow(8,3) would be the same as 8^3

    http://download.oracle.com/javase/1....e,%20double%29

  5. #5

    Thread Starter
    Lively Member OT²O's Avatar
    Join Date
    Jan 2010
    Location
    Washington State
    Posts
    96

    Re: Math.pow

    Quote Originally Posted by kfcSmitty View Post
    pow is a function of the math object. Pow requires 2 arguments, the first being a double for the base number and the second being the number of the exponent.

    So Math.pow(8,3) would be the same as 8^3

    http://download.oracle.com/javase/1....e,%20double%29
    That makes perfect sense thank you.
    On the off chance that I helped you (Rate This Post){
    Also If your problem was resolved;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width