是否有Java API或内置函数可以解决年金问题?
我的老板要求我创建一个用于计算反向复合的模块。
问题是:如果我想在 24 个月内达到 1.000.000,00 美元,利率为 18%/年(或 1.5%/月)。 我每个月必须存多少钱?
我在网上查了一下,除了有人提到Excel公式之外,什么也没找到。 你知道这种情况的数学公式是什么吗?
我在这个模块中使用 Java。 有Java库或者API吗?
I was asked by my boss to create a module for calculating reverse compound.
The question is: if I want to achieve $1.000.000,00 in 24 months with interest rate 18%/year (or 1.5%/month). how much money do I have to save every month?
I searched on the internet, but found nothing except people referring to the Excel formula.
Do you know what the mathematical formula is for this case?
I am using Java for this module. Is there any Java library or API?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
假设您在每个月初投资
D
美元,为期M
个月,每月复利利率为r
。 我们将设置i = r / 12
。M
个月结束后,您的帐户中将有资金。 这是因为第一个月的
D
美元投资了M
个月,第二个月的D
美元投资了M-1
个月,依此类推。 这是一个几何级数并简化为因此,如果你想要
X
在您的帐户中,在M
个月结束时,您解决了D
以获得问题您实际上并不需要 API 来解决此问题,因为您可以看到该解决方案非常简单简单的。 您可能想在这里阅读的概念是年金。
Let us say that you are investing
D
dollars at the beginning of each month forM
months earning an interest rate ofr
compounded monthly. We will seti = r / 12
. At the end ofM
months you will havein your account. This is because the
D
dollars in the first month are invested forM
months, theD
dollars in the second month are invested forM-1
months, and so on. This is a geometric progression and simplifies toTherefore, if you want
X
in your account at the end ofM
months you solvefor
D
to obtainYou don't really need an API here to solve this as you can see the solution is quite simple. The concept that you might want to read about here is that of annuities.
如果您这样做不是为了贷款目的,其他答案中发布的简单公式可能就足够了。
如果这是针对任何类型的金融活动,请注意任何简单的复利计算。 如果是任何贷款,您可能需要遵守严格的规则(例如在英国,利率必须以年利率的形式报价)。
计算需要考虑以下因素:
实际上,这需要一种迭代形式来找到定期和最终付款。
If you are not doing it for lending purposes, the simple formulae posted in other answers will probably be good enough.
If this is for any kind of financial activity, beware of any simple calculation for compound interest. If it is for any lending you are probably required to conform to strict rules (e.g in the UK the rate must be quoted in the form of an APR).
The calculations need to take into account:
In practice this needs a form of iteration to find the regular and final payments.
您想要的公式是
S = R * [(1+i )^n - 1] / i
所以你的答案 R = 1000000 * .015 / (1.015^24 - 1) (~= 34924.10)
编辑:
这假设付款是在每个周期结束时,如果在每个周期开始时付款,则将您的答案除以 (1+i)
The formula you want is
S = R * [(1+i)^n - 1] / i
whereso your answer R = 1000000 * .015 / (1.015^24 - 1) (~= 34924.10)
EDIT:
This assumes payments are at the end of each period, if payments are made at the beginning of each period, then divide your answer by (1+i)
我认为这可以满足您的需求。 它甚至是 LGPL,即使您的资金回报率为 18%,价格也不重要;-)。
I think this gets you what you want. Its even LGPL, even though if you are getting 18% returns on your money, price shouldn't matter ;-).