Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

solving payoff amount x in last period using a IRR using mysql

Posted on 2008-10-11
4
Medium Priority
?
567 Views
Last Modified: 2013-12-13
I want to pick an IRR=r (say 15%), and determine how much would have to be paid in the last period of the cash flow sequence to achieve this IRR.
e.g.
using wikipedia e.g.
0      -100
1      40
2      59
3      55
4      x

Solving the summation equation for x
x = the amount that needs to be paid to reach an internal rate of return of 15%
r = .15
NPV = 0 = -100 + 40/(1+.15)^1 + 59/(1+.15)^2 + 55/(1+.15)^3 + x/(1+.15)^4 for x
0= -100 + 34.78261 + 44.61248 + 36.16339 + x/(1+.15)^4
0 = 15.5585 + x/(1+.15)^4
-15.5585 = x/1.749006
-15.5585*1.749006 = x
-27.2119 = x

(note: in this example the value of x is negative, but in most cases it will be positive)

please see bayparkcapital.com/topiclistE.php for progress to date
0
Comment
Question by:derekstattin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:mankowitz
ID: 22696408
I think I understand the problem.

Assume that your data are stored in an array like this

$seq = array(0=>-100, 1=>40, 2=>59, 3=>55);
$period_to_solve = 4;
$rate = 0.15;

//First sum everything up
for ($x=0; $x<$period_to_solve; $x++)
{
$sum += $seq[$x] * pow($rate + 1, $x);
}

// NPV = {sum} + x/(1+rate)^4
//  -{sum} * (1+rate)^4 = x
$final_period = 0 - $sum * pow(1+$rate,$period_to_solve);
0
 

Author Comment

by:derekstattin
ID: 22696935
Thank you for the example.
It all seems to work except on little thing
The $sum should be equal to 15.5585. I ran another example using 30, 32, and 40, but the results in Excel are not the same as using the function above.
Thanks for the help,
0
 
LVL 24

Accepted Solution

by:
mankowitz earned 2000 total points
ID: 22698340
Sorry, my mistake. I think I misread the formula. Change

$sum += $seq[$x] * pow($rate + 1, $x);

to

$sum += $seq[$x] / pow($rate + 1, $x);
0
 

Author Comment

by:derekstattin
ID: 22698698
Great,  thanks so much. I should have noticed that. Now I will try to integrate this in with
www.bayparkcapital.com/G.php
I will post a couple more questions shortly.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question