The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • UltraMath
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 UltraMath

  • MtraX Author 
    • 466 
    • 0 
    • 3 
    Finance Calculator

    Last reply Sep 20 2005, 04:20 PM

    by

    Posted: Sep 15 2005, 09:38 AM

    by MtraX

     

Hi

I’m trying to do a finance calculator in flash. Quite a simple application, but I have no PMT function (as you get in excel), so I need the PMT function, but can’t find it anywhere.

It’s for a car site, to work out what the user can afford as total price for a vehicle. There are some fixed amounts, which just gets added to the amount I’m trying to work out.

I’ve got the following functions from another site:

function rate(principal, periods, payment) {
myrate = 0;
increment = 0.1;
decimals = 0
while(pmt(principal,myrate,periods) != payment && decimals < 9) {
while(pmt(principal, myrate, periods) < payment) {
myrate = myrate+increment;
}
myrate = myrate-increment;
increment = increment/10;
decimals++;
}
myrate = math.round(myrate*100000000)/100000000;
return myrate;
}

function pmt(principal, rate, periods) {
if(rate == 0) {
mypayment = principal/periods;
} else {
mypayment = principal*(rate/12) / (1-1/math.pow(1+rate/12,periods));
}
return mypayment;
}

I just can’t seem to work out the principal, which I think is the value I’m after. Would be grateful if anyone can have a look at this and give me the formula/function for working out the principal.

Regards
MtraX

  3 REPLIES
 
Andy M
1  
Andy M

P = (PV*IR) / (1 - (1 + IR)^(-N))


P = payment (per period)
PV = present value of money (principal)
IR = interest rate
N = number of payments or periods

I think you’re after the P (monthly payment). PV is the amount owing for the vehicle. So for example, a $25,000 with $10,000 will have $15,000 remaining.

That’s equivalent to taking out a $15,000 loan. If it’s paid monthly with a 3% interest rate (IR = 0.03/12) over a 2 year period (24 pay periods), then you’ll have a monthly payment of $644.72 or $15473.28 after 2 years (24 x $644.72).

In that case, you can use a modified formula:

P = ((PV-DP)*IR) / (1 - (1 + IR)^(-N))


P = payment (per period)
PV = present value of car
DP = down payment
IR = interest rate (remember to divide this by 12 if monthly!)
N = number of payments or periods

or for total price with a loan:

TP = (((PV-DP)*IR) / (1 - (1 + IR)^(-N)))*N

  • 15 September 2005 02:42 PM
  •  
MtraX Author 
2  
MtraX

Hi

Thanx a bunch. Will report back if I run into problems.

Regards
MtraX

  • 19 September 2005 05:32 AM
  •  
Andy M
3  
Andy M

No problem. That’s what US is for. Glad I could help. smilie

  • 20 September 2005 04:20 PM
  •  
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 779  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,728  Assets
  • Profiles 282,751  Members
  • Topics 93,776  Topics
  • Blog 4  Blog
  • Facebook 1,679  Facebook
  • Twitter 1,163  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 11, 2012 - 19:49:47