A community for students.
Here's the question you clicked on:
 0 viewing
Hellvince
 2 years ago
Regarding PS1 solution for bisection search, I think the answer is more complex than it should be.
Monthly payments can only be measured in cents. But here, it calculates monthly payments with numerous numbers after decimal. Once the "optimal" monthly payment is found, it manually rounds it and have to redo all the calculation with the rounded value which is a waste of time.
Why not rounding the value of monthly payments at the start of the loop since it can only be in cents ?
See
http://dpaste.com/hold/1323860/
for my code.
Hellvince
 2 years ago
Regarding PS1 solution for bisection search, I think the answer is more complex than it should be. Monthly payments can only be measured in cents. But here, it calculates monthly payments with numerous numbers after decimal. Once the "optimal" monthly payment is found, it manually rounds it and have to redo all the calculation with the rounded value which is a waste of time. Why not rounding the value of monthly payments at the start of the loop since it can only be in cents ? See http://dpaste.com/hold/1323860/ for my code.

This Question is Closed

bwCA
 2 years ago
Best ResponseYou've already chosen the best response.0well, what do you think the banks do? do you think they round in the intermediate steps of a string of calculations or do you think the only round the final answer? what do you think is mathematically correct ? how much time is being wasted? is your solution reallyreally slow? how many iterations does it take? are you getting a correct answer? with initial balance of 1000 and interest of .1 i get a minimum payment of $87.19 you get a minimum payment of $87.91 think i'll go have a burger

Hellvince
 2 years ago
Best ResponseYou've already chosen the best response.0You lost me somewhere. I posted the official solution at dpaste : http://dpaste.com/1324320/ With an initial balance of 1000 and interest of 0.1 : 1) With the official solution, i find a minimal payment of $87.92 and a balance of $0.05 2) With my code, i find a minimal payment of $87.92 and a balance of $0.05 I dont really see how you get $87.19 ? I also doublechecked my answers for test cases. I get the same minimal payment, but have a $0.01 difference on the final balance ($0.11 instead of $0.1 in case 1, and $0.11 instead of $0.12 in case 2). For your info, this difference is down to the fact that the solution actually rounds everything before doing calculation (and more precisely, rounding the interest value before substracting it to the balance, line 39). If you get rid of this round() and just round the final answers (wich seems more logical), you find a final balance identical to my solution ($0.11 and $0.11). From a theoretical and mathematical point of view, I dont see any differences between my solution and the official one. Thats why I posted.

bwCA
 2 years ago
Best ResponseYou've already chosen the best response.0mine calculates a lower pmt because it subtracts the payment before adding interest  i am making my payment at the beginning of the month. but does any of that really matter in the context of the lesson? what is the purpose of this problem set? what computational ideas are we supposed to learn?

Hellvince
 2 years ago
Best ResponseYou've already chosen the best response.0Well I kinda agree with you. This does not make any difference from an educational point of view since we deal with the same ideas and methods.
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.