I'm trying to solve the bisection problem from PS 1, what is wrong with my code:

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

I'm trying to solve the bisection problem from PS 1, what is wrong with my code:

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

1 Attachment
why are you declaring NB so early why not just put x there instead of NB? Feels very Redundant(feels like more bytes for no reason) i would only set nb = to x*(1+MIR) -MMP I would personally say that should be your only reference but that is just my preference
also would your high be calculated like so? (x*((1.0+(y/12.0))**12))/12.0

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Shouldnt it be that so it doesnt end up becoming a negative even if you are taking the abs of the value MMP = (low+high)/2.0
I declared NB early because I thought NB had to be defined before I could start my loop. I'm going to implement your edits and see if it works, thank you
Did you solve it already? I would really appreciate if you could attach your answer.
One thing I'd recommend is examining what happens in your `for` loop with both the `month` variable and what happens to `high` and `low` when `NB` goes from positive to negative. Perhaps use a debug print statement like `print high == low`. Afterward I would recommend thinking about whether, if the payment is able to be made in 11 months rather than 12, will your program ever recognize that fact? Consider using a conditional and the `break` statement.

Not the answer you are looking for?

Search for more explanations.

Ask your own question