Jump to content

Help with equation needed!!


Narafir

Recommended Posts

Hello!! I was wondering if someone was willing to help with the code that would solve the following equation:

 

2934,70 = [141,52 / (1 + i )^1/12] + [141,52 / (1 + i )^2/12] + ... + [141,52 / (1 + i )^23/12] + [141,52 / (1 + i )^24/12]

 

The correct answer is i = 0,15405. But how can we get there with code???

 

Thank you :>

Link to comment
https://forums.phpfreaks.com/topic/135311-help-with-equation-needed/
Share on other sites

Hello!! I was wondering if someone was willing to help with the code that would solve the following equation:

 

2934,70 = [141,52 / (1 + i )^1/12] + [141,52 / (1 + i )^2/12] + ... + [141,52 / (1 + i )^23/12] + [141,52 / (1 + i )^24/12]

 

The correct answer is i = 0,15405. But how can we get there with code???

 

 

 

This is making my head hurt, lol, so you want to pass it '2934,70', and find

out what 'i' would be to make it true...

 

And from what you have got there, we need i to work it out...

I may just suck at algebra... but i can see no way to swap this formuler

around to return i...

 

But i am bored, so now its officialy in notepad and im on it >.>

 

Just dont hold your breath ^^

Thank you :>

 

Yes the symbol "," is the same with "."

 

It is for decimal numbers. e.g. 10/3 = 3.3333 = 3,3333

 

If this confuses you, by all means feel free to try the following if you find it easier, which is exactly the same, only that i don't know the correct answer:

 

1000 = [400 / (1 + i )^1/12] + [400 / (1 + i )^2/12] + ... + [400/ (1 + i )^23/12] + [400/ (1 + i )^24/12]

 

I am sorry for your head!!!  :-\

 

And thank you for your effort!!!

PHP can't do algebra without an external library (and I don't know of any, but I'm sure they exist). Making a script to solve that would be a pretty complex undertaking.

 

EDIT: hell, I plugged it into a program made to do math (matlab) and it couldn't solve it algebraically... you'd have to do it with a truncated taylor series or something.

My sincere apologies: I have just realized...

 

What I am trying to do is the following: Calculate the Annual Percentage Rate - APR

. An example is given here http://banking.about.com/library/calculators/bl_APR_calculator_load.htm

 

and more here http://www.efunda.com/formulae/finance/apr_calculator.cfm

 

I understand that more information is needed, so i will get back when I am ready.

 

Really hope to find a php apr calculator... No luck so far...

 

Thank you all for your replies :)

Well you see right there, they said they used newton's method to solve it. If you want to calculate the derivative of the second equation by hand on your second link, it shouldn't be TOO hard to write a function to calculate the APR (famous last words?).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.