Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

ultrapuggy Group Title

Hi, The solution to #2 for Problem set # 1 seems incomplete. I could be wrong, but it doesn't test for if the monthly payment needs to be reduced. Also I'm getting vastly different numbers from the answer key using the test case. I tested it in Excel and my program matches that though. Can anyone look at my code? Thanks a lot.

  • one year ago
  • one year ago

  • This Question is Closed
  1. ultrapuggy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    It's the uncommented portion of the attached file. I know I should clean my code up a bit, seems a bit redundant...but the logic is: I'm checking for the initial guess being larger vs smaller (bisection guessing). If it is too small, I go to the first chunk of code. If it is too large I go to the second. Note, I did make sure to add interest PRIOR to any deductions as the professor specified. Excel checks out as well. I will attach.

    • one year ago
    1 Attachment
  2. ultrapuggy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Attached Excel with the 1200 Balance, .18 example

    • one year ago
    1 Attachment
  3. ultrapuggy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I also noticed he didn't make it pay in increments of 10 in his attached answer sheet, or check for a payment that is too large.

    • one year ago
  4. ultrapuggy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Attached problem set for ease of use.

    • one year ago
  5. deerbane Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I'm not on that problem yet. I am having problems with a syntax error in the second one. Let me get there and then I will be able to give you a more informed guess.

    • one year ago
  6. medicrobosn Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Were you able to get the first portion of code to work properly before diving into the bisection search? I am getting ready to transform my working code into the faster bisection method today.

    • one year ago
  7. Hellvince Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    In fact, you dont use bisection search in your answer. You use upper and lower bound to make an educated guess at the beginning "MinPay = round((High + Low)/2.0, -1)" but after that you keep adding or substracting 10$ if the initial guess is too high/too low. Using bisection search means you make a guess using predetermined bounds, and you modify these upper/lower bound once you calculated the balance with the guess. If the guess is too high ( = balance is negative), you set the upper bound to be the current actual guess. Vice versa if the current guess is too low ( = balance is still positive) it becomes the lower bound. Then, the next time your loop is executed, the guess should be based on these new upper/lower bounds. It will allow you to progressively pinpoint a reliable guess. Now you just have to deal with guess precision : when do you think the guess is precise enough to be kept.

    • one year ago
  8. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    strategically placed print statements are a great way to 'debug' your code. http://dpaste.com/1324113/ the while loops that run thru 12 months of payments - you probably shouldn't round at each iteration. you could greatly simplify your code: if you just start with a minpay of $10 then you won't have to worry about decreasing it - this change would get rid of almost half your code and possibly make it easier to read and debug. your solution is definitely not working

    • one year ago
    • Attachments:

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.