<doc>
  <legacy_id>1773</legacy_id>
  <name>annuity</name>
  <type>function</type>
  <syntax>
    <example>annuity(<i>interestRate</i>,<i>numberOfPeriods</i>)</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Math, Logic, &amp; Dates</category>
  </classification>
  <references>
    <function tag="compound">compound Function</function>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary>Computes the <function tag="value">value</function> of an annuity given an interest rate and a number of payments.</summary>
  <examples>
    <example>annuity(.08,10)</example>
    <example>annuity(currentAnnualRate/12,monthsOfLoan)</example>
  </examples>
  <description>
    <p>Use the <b>annuity</b> <control_st tag="function">function</control_st> to calculate the present or future value of an annuity or to calculate loan payments.</p><p/><p><b>Parameters:</b></p><p>The <i>interestRate</i> is a positive number. The <i>interestRate</i> is expressed as a fraction of 1 so, for example, an 8% rate is written<code> .08</code>.</p><p/><p>The <i>numberOfPeriods</i> is a positive number.</p><p/><p><b>Value:</b></p><p>The <b>annuity</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> a positive number.</p><p/><p><b>Comments:</b></p><p>The formula for the value of an ordinary annuity is</p><p>   (1 - (1 + <i>interestRate</i>)^(-<i>numberOfPeriods</i>))/<i>interestRate</i></p><p>The <b>annuity</b> <control_st tag="function">function</control_st> calculates this <function tag="value">value</function>.</p><p/><p>The <i>numberOfPeriods</i> and the <i>interestRate</i> must use the same unit of time. For example, if the periods are months, the interest rate is the interest per month.</p><p/><p>You can use the <b>annuity</b> <control_st tag="function">function</control_st> to calculate the amount of loan payments as follows:</p><p/><p><code/>  paymentAmount = totalAmount/annuity(rate,periods)</p><p/><p>For example, if the loan is for $2500 at an interest rate of 2% per month and is to be repaid in a year, the monthly payment is<code> 2500/annuity(.02,12) </code>or $236.40.</p>
  </description>
</doc>