formula to find for basic calculations of common loan types such as mortgages, auto loans, student loans, or personal loansGoal Seek functionality in PHPHow to calculate compound interest by days?how to calculate mortgage in javascriptComplex mathematical formula in jquery function is not workingCalculating interest rate in PHPCreating a recursive funciton in php to determine interest of a loan over 10 yearsCalculating mortgage interest in PythonPHP table with three different colums using for loopsThe Power of Compoundingconvert finance calculation to Javascript
More than three domains hosted on the same IP address
Laptop failure due to constant fluctuation of AC frequency and voltage
Professor refuses to write a recommendation letter to students who haven't written a research paper with him
How to make a pipe-divided tuple?
Constant integers and constant evaluation
Passport - tiny rip on the edge of my passport page
Relationship between speed and cadence?
Why has Marx's "Das Kapital" been translated to "Capital" in English and not "The Capital"
Do you need to burn fuel between gravity assists?
Should I tip on the Amtrak train?
Project Euler problem #112
Why are UK MPs allowed to abstain (but it counts as a no)?
Owner keeps cutting corners and poaching workers for his other company
What is the purpose of the rotating plate in front of the lock?
Let A,B,C be sets. If A△B=A△C, does this imply that B=C?
If every star in the universe except the Sun were destroyed, would we die?
What makes an ending "happy"?
What's this inadvertent thing?
How can electricity be positive when electrons are negative?
Get a MPS file using NEOS/GAMS web interface
How do I play this harmonic? (Guitar)
Is it right to use the ideas of non-winning designers in a design contest?
How do I write a vertically-stacked definition of a sequence?
Short story: Interstellar inspector senses "off" nature of planet hiding aggressive culture
formula to find for basic calculations of common loan types such as mortgages, auto loans, student loans, or personal loans
Goal Seek functionality in PHPHow to calculate compound interest by days?how to calculate mortgage in javascriptComplex mathematical formula in jquery function is not workingCalculating interest rate in PHPCreating a recursive funciton in php to determine interest of a loan over 10 yearsCalculating mortgage interest in PythonPHP table with three different colums using for loopsThe Power of Compoundingconvert finance calculation to Javascript
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to calculate EMI as per the attached screenshot. but there is a minor difference in my calculation. what I have done so far as below:
function interest($investment,$year,$rate=15,$n=1)
global $total_result, $total_interest, $totalamount;
$accumulated=0;
if ($year > 1)
$accumulated=interest($investment,$year-1,$rate,$n);
$accumulated += $investment;
$rateC = $rate / 100;
$result = $rateC / 12 * pow(1 + ($rateC) / 12, ($year * 12)) / (pow(1 + ($rateC) / 12, ($year * 12)) - 1) * $accumulated;
$result = 85.60;
for ($i=0; $i < 12; $i++)
// echo round($accumulated,2).'<br>';
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
$innntrest = ($accumulated - $investment) / 12;
$i_result = $result - $innntrest;
$accumulated = $investment - $i_result;
$investment = $accumulated;
echo '<br>***'.round($result,2).'***'.round($i_result,2).'***'.round($innntrest,2).'<br>';
$total_result = $total_result + round($result,2);
$total_interest = $total_interest + $i_result;
$totalamount = $totalamount + $innntrest;
return $accumulated;
Where $investment=1000(loan amount), $year=1 (loan term), $rate=5%(interest rate), $n=4 (compound)
So I want exact output as an attached screenshot, so can anyone help me with this code to find out the formula? Thanks in advance!
php formula
add a comment |
I'm trying to calculate EMI as per the attached screenshot. but there is a minor difference in my calculation. what I have done so far as below:
function interest($investment,$year,$rate=15,$n=1)
global $total_result, $total_interest, $totalamount;
$accumulated=0;
if ($year > 1)
$accumulated=interest($investment,$year-1,$rate,$n);
$accumulated += $investment;
$rateC = $rate / 100;
$result = $rateC / 12 * pow(1 + ($rateC) / 12, ($year * 12)) / (pow(1 + ($rateC) / 12, ($year * 12)) - 1) * $accumulated;
$result = 85.60;
for ($i=0; $i < 12; $i++)
// echo round($accumulated,2).'<br>';
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
$innntrest = ($accumulated - $investment) / 12;
$i_result = $result - $innntrest;
$accumulated = $investment - $i_result;
$investment = $accumulated;
echo '<br>***'.round($result,2).'***'.round($i_result,2).'***'.round($innntrest,2).'<br>';
$total_result = $total_result + round($result,2);
$total_interest = $total_interest + $i_result;
$totalamount = $totalamount + $innntrest;
return $accumulated;
Where $investment=1000(loan amount), $year=1 (loan term), $rate=5%(interest rate), $n=4 (compound)
So I want exact output as an attached screenshot, so can anyone help me with this code to find out the formula? Thanks in advance!
php formula
add a comment |
I'm trying to calculate EMI as per the attached screenshot. but there is a minor difference in my calculation. what I have done so far as below:
function interest($investment,$year,$rate=15,$n=1)
global $total_result, $total_interest, $totalamount;
$accumulated=0;
if ($year > 1)
$accumulated=interest($investment,$year-1,$rate,$n);
$accumulated += $investment;
$rateC = $rate / 100;
$result = $rateC / 12 * pow(1 + ($rateC) / 12, ($year * 12)) / (pow(1 + ($rateC) / 12, ($year * 12)) - 1) * $accumulated;
$result = 85.60;
for ($i=0; $i < 12; $i++)
// echo round($accumulated,2).'<br>';
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
$innntrest = ($accumulated - $investment) / 12;
$i_result = $result - $innntrest;
$accumulated = $investment - $i_result;
$investment = $accumulated;
echo '<br>***'.round($result,2).'***'.round($i_result,2).'***'.round($innntrest,2).'<br>';
$total_result = $total_result + round($result,2);
$total_interest = $total_interest + $i_result;
$totalamount = $totalamount + $innntrest;
return $accumulated;
Where $investment=1000(loan amount), $year=1 (loan term), $rate=5%(interest rate), $n=4 (compound)
So I want exact output as an attached screenshot, so can anyone help me with this code to find out the formula? Thanks in advance!
php formula
I'm trying to calculate EMI as per the attached screenshot. but there is a minor difference in my calculation. what I have done so far as below:
function interest($investment,$year,$rate=15,$n=1)
global $total_result, $total_interest, $totalamount;
$accumulated=0;
if ($year > 1)
$accumulated=interest($investment,$year-1,$rate,$n);
$accumulated += $investment;
$rateC = $rate / 100;
$result = $rateC / 12 * pow(1 + ($rateC) / 12, ($year * 12)) / (pow(1 + ($rateC) / 12, ($year * 12)) - 1) * $accumulated;
$result = 85.60;
for ($i=0; $i < 12; $i++)
// echo round($accumulated,2).'<br>';
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
$innntrest = ($accumulated - $investment) / 12;
$i_result = $result - $innntrest;
$accumulated = $investment - $i_result;
$investment = $accumulated;
echo '<br>***'.round($result,2).'***'.round($i_result,2).'***'.round($innntrest,2).'<br>';
$total_result = $total_result + round($result,2);
$total_interest = $total_interest + $i_result;
$totalamount = $totalamount + $innntrest;
return $accumulated;
Where $investment=1000(loan amount), $year=1 (loan term), $rate=5%(interest rate), $n=4 (compound)
So I want exact output as an attached screenshot, so can anyone help me with this code to find out the formula? Thanks in advance!
php formula
php formula
asked Mar 28 at 6:12
bunty007bunty007
177 bronze badges
177 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
After a few days of research, I got the solution as below:
function interest($investment,$year,$rate=15,$n=1,$payment_frequency=4)
$accumulated=0;
$accumulated += $investment;
$rateC = $rate / 100;
$total_i = 0;
if($payment_frequency == 1)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
else
$rate = pow(1 + ($rateC/$n),($n*($year/($year*$payment_frequency)))) - 1;
$result = ($rate*$accumulated)/(1 - pow((1 + $rate),-($year*$payment_frequency)));
for ($i=0; $i < ($year*$payment_frequency); $i++)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
$innntrest = ($accumulated - $investment) * 100;
$i_result = $result - $innntrest;
$accumulated = $investment - $i_result;
$investment = $accumulated;
$total_i += $innntrest;
return $total_i;
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391169%2fformula-to-find-for-basic-calculations-of-common-loan-types-such-as-mortgages-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
After a few days of research, I got the solution as below:
function interest($investment,$year,$rate=15,$n=1,$payment_frequency=4)
$accumulated=0;
$accumulated += $investment;
$rateC = $rate / 100;
$total_i = 0;
if($payment_frequency == 1)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
else
$rate = pow(1 + ($rateC/$n),($n*($year/($year*$payment_frequency)))) - 1;
$result = ($rate*$accumulated)/(1 - pow((1 + $rate),-($year*$payment_frequency)));
for ($i=0; $i < ($year*$payment_frequency); $i++)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
$innntrest = ($accumulated - $investment) * 100;
$i_result = $result - $innntrest;
$accumulated = $investment - $i_result;
$investment = $accumulated;
$total_i += $innntrest;
return $total_i;
add a comment |
After a few days of research, I got the solution as below:
function interest($investment,$year,$rate=15,$n=1,$payment_frequency=4)
$accumulated=0;
$accumulated += $investment;
$rateC = $rate / 100;
$total_i = 0;
if($payment_frequency == 1)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
else
$rate = pow(1 + ($rateC/$n),($n*($year/($year*$payment_frequency)))) - 1;
$result = ($rate*$accumulated)/(1 - pow((1 + $rate),-($year*$payment_frequency)));
for ($i=0; $i < ($year*$payment_frequency); $i++)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
$innntrest = ($accumulated - $investment) * 100;
$i_result = $result - $innntrest;
$accumulated = $investment - $i_result;
$investment = $accumulated;
$total_i += $innntrest;
return $total_i;
add a comment |
After a few days of research, I got the solution as below:
function interest($investment,$year,$rate=15,$n=1,$payment_frequency=4)
$accumulated=0;
$accumulated += $investment;
$rateC = $rate / 100;
$total_i = 0;
if($payment_frequency == 1)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
else
$rate = pow(1 + ($rateC/$n),($n*($year/($year*$payment_frequency)))) - 1;
$result = ($rate*$accumulated)/(1 - pow((1 + $rate),-($year*$payment_frequency)));
for ($i=0; $i < ($year*$payment_frequency); $i++)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
$innntrest = ($accumulated - $investment) * 100;
$i_result = $result - $innntrest;
$accumulated = $investment - $i_result;
$investment = $accumulated;
$total_i += $innntrest;
return $total_i;
After a few days of research, I got the solution as below:
function interest($investment,$year,$rate=15,$n=1,$payment_frequency=4)
$accumulated=0;
$accumulated += $investment;
$rateC = $rate / 100;
$total_i = 0;
if($payment_frequency == 1)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
else
$rate = pow(1 + ($rateC/$n),($n*($year/($year*$payment_frequency)))) - 1;
$result = ($rate*$accumulated)/(1 - pow((1 + $rate),-($year*$payment_frequency)));
for ($i=0; $i < ($year*$payment_frequency); $i++)
$accumulated = $accumulated * pow(1 + $rate/(100 * $n),$n);
$innntrest = ($accumulated - $investment) * 100;
$i_result = $result - $innntrest;
$accumulated = $investment - $i_result;
$investment = $accumulated;
$total_i += $innntrest;
return $total_i;
answered Apr 1 at 13:05
bunty007bunty007
177 bronze badges
177 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391169%2fformula-to-find-for-basic-calculations-of-common-loan-types-such-as-mortgages-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown