A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 5 years ago
In ps 4.4 (function testFindMaxExpenses) why is my answer 1229.95297872 and not 1229.95548986?
Help greatly appreciated!
http://dpaste.com/533442/
anonymous
 5 years ago
In ps 4.4 (function testFindMaxExpenses) why is my answer 1229.95297872 and not 1229.95548986? Help greatly appreciated! http://dpaste.com/533442/

This Question is Closed

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Hi, As far as I can tell the problem specifies that your answer should be *close* to 1229.95548986, so your numbers look ok. The reason *why* your answer is not the same stems from the fact that floating point representation of numbers (and that's what you get if you use decimaldot notation in Python) cannot express any number with full precision. As a consequence small errors can accumulate over multiple operations and the final result can be different depending on the number of operations, their order, relative magnitude of numbers and so on. Numerical analysis deals with this kind of problems. That's why floating point numbers are not used for any serious calculations involving money.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Thanks for your response!

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Hello, Changing the line in user mmapplebeck code: while test[1] < 0 or test[1] > epsilon: To this: while abs(test[1]) > epsilon: Gave me exact answer as stated in ps4.py: 1229.95548986.
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.