Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
Someone managed to solve the problem 3 set 2: Using Bisection Search to Make the Program Faster. I need help to understand this problem.
 one year ago
 one year ago
Someone managed to solve the problem 3 set 2: Using Bisection Search to Make the Program Faster. I need help to understand this problem.
 one year ago
 one year ago

This Question is Closed

RCMoreaBest ResponseYou've already chosen the best response.2
Do you mean problem 3 of set 1? Because the first set was number 0? That is the one I recall that needed to go faster by binomial search. If so, I just finished it. If you did the previous one, then your loops should pretty much work the same (mine did). Next, you have to find an upperbound and lowerbound to test against, which the problem set tells you how to do, so that part is pretty easy. Next, you set your payment halfway between the upperbound and lowerbound: payment = (upperbound+lowerbound)/2. After that, this was my logic: 1) if remaining balance after 12 months is too high, raise your payment. 2) if remaining balance after 12 months is too low, lower your payment. 3) if remaining balance after 12 months is correct, then stop. To raise your payment, set payment = (payment+upperbound)/2. REMEMBER to also set your new lowerbound to equal your old payment. Actually, it's easier to do it in reverse order. Set lowerbound = payment, then raise payment. To lower payment, do the opposite. To recognize when you are done, basically since you are going in 1 cent increments and everything has to be the same, you could overpay by up to 11 cents. So, that is your range 11 to 0 for being done. I think that's right. I got the same answers as the professor within 2 cents, which I think is probably rounding and I'm not worried about it. If you want, I can post code.
 one year ago

RCMoreaBest ResponseYou've already chosen the best response.2
OK, here is my code. It works (gives the right answer). You might not like it because I used a function. The same basic logic should work without a function, I just thought the function was easier that way. Also, of course, the professor posted his own solution in a .zip file in the lesson 4 materials. http://pastebin.com/e5UiBiVE
 one year ago

mensanaBest ResponseYou've already chosen the best response.0
Thanks RCMorea! I tested your code, but the results are different tests. Could you post the link of the file where I can download the solution of the teacher.
 one year ago

RCMoreaBest ResponseYou've already chosen the best response.2
Interesting. It's giving me 29643.04 for the first payment. I believe the "book answer" is 29643.05, but that is a rounding error. Also, it is giving me 91679.91 as the second payment, which is right on the book answer. The final balances I am getting .03 for the first one (book answer .1) and .06 for the second one (book answer .12) but again that is rounding, and I think mine is actually more accurate than the professors (he rounds before the math but I round after). If anyone else checks this, I would be curious what you get. But...I will say the professors code is a better example to look at anyway (no surprise, of course).
 one year ago

bwCABest ResponseYou've already chosen the best response.0
which course (2008 or 2011)? which ps? which problem?
 one year ago

RCMoreaBest ResponseYou've already chosen the best response.2
this was course 2011 (well, at least that is the one i did, maybe others did a different one that could account for some differences), second problem set (but numbered ps1), last problem (the one where you use bisecgtion search).
 one year ago

bwCABest ResponseYou've already chosen the best response.0
the problem set and lecture order is different for the 2008 and 2011sc series
 one year ago

bwCABest ResponseYou've already chosen the best response.0
if it is the problem for paying off debt then:  initialize the lower limits of your bisection search to 0 and the upper limit to the original balance.  make a guess at the halfway point  run the guess through the payment cycle  if the guess was too big, set the upper limit to the guess and repeat  if the guess was tool small, set the lower limit to the guess and repeat
 one year ago

mensanaBest ResponseYou've already chosen the best response.0
Thank bwCa and RcMorea for your help.
 one year ago
See more questions >>>
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.