Narafir Posted December 3, 2008 Share Posted December 3, 2008 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 More sharing options...
keiran420 Posted December 3, 2008 Share Posted December 3, 2008 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 :> Link to comment https://forums.phpfreaks.com/topic/135311-help-with-equation-needed/#findComment-704822 Share on other sites More sharing options...
Narafir Posted December 3, 2008 Author Share Posted December 3, 2008 Thank you so much!! I greatly appreciate your effort Link to comment https://forums.phpfreaks.com/topic/135311-help-with-equation-needed/#findComment-704836 Share on other sites More sharing options...
keiran420 Posted December 3, 2008 Share Posted December 3, 2008 Grrr >.< No luck as of yet... 1 question what the * is it?.. Whats it gonna be for, do... why is it what it is? My head hurts... Link to comment https://forums.phpfreaks.com/topic/135311-help-with-equation-needed/#findComment-705293 Share on other sites More sharing options...
corbin Posted December 3, 2008 Share Posted December 3, 2008 2934,70 In some [usually European] countries, that is the same as our ".". Think of it as 2934.70. Link to comment https://forums.phpfreaks.com/topic/135311-help-with-equation-needed/#findComment-705438 Share on other sites More sharing options...
Narafir Posted December 4, 2008 Author Share Posted December 4, 2008 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!!! Link to comment https://forums.phpfreaks.com/topic/135311-help-with-equation-needed/#findComment-705700 Share on other sites More sharing options...
genericnumber1 Posted December 4, 2008 Share Posted December 4, 2008 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. Link to comment https://forums.phpfreaks.com/topic/135311-help-with-equation-needed/#findComment-705726 Share on other sites More sharing options...
Narafir Posted December 4, 2008 Author Share Posted December 4, 2008 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 Link to comment https://forums.phpfreaks.com/topic/135311-help-with-equation-needed/#findComment-705739 Share on other sites More sharing options...
genericnumber1 Posted December 4, 2008 Share Posted December 4, 2008 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?). Link to comment https://forums.phpfreaks.com/topic/135311-help-with-equation-needed/#findComment-705745 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.