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;








0















loan calculator



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!










share|improve this question






























    0















    loan calculator



    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!










    share|improve this question


























      0












      0








      0








      loan calculator



      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!










      share|improve this question














      loan calculator



      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 6:12









      bunty007bunty007

      177 bronze badges




      177 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0
















          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;







          share|improve this answer
























            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
            );



            );














            draft saved

            draft discarded
















            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









            0
















            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;







            share|improve this answer





























              0
















              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;







              share|improve this answer



























                0














                0










                0









                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;







                share|improve this answer













                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;








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 1 at 13:05









                bunty007bunty007

                177 bronze badges




                177 bronze badges





















                    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.




















                    draft saved

                    draft discarded















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript