I am having an issue with the calculation of dEdb, getting answers that are almost but not quite the same as the expected output. For the two test cases with (m, b) given as (0, 0) and (1, 5), I get 5.151434834260726e-16 and 5.000000000000001, respectively. According to the exercise, I should get 5.098005351200641e-16 and 5.000000000000002. These are very small differences, and it passes the unit tests, but in exercise 6 I get very different results and I suspect this is why. But I can’t see any error in the calculation based on the problem as I understand it.
Hello @Kyle_Paterson
Could it be that you are using floating-point arithmetic? they may also introduce slight rounding errors
Well, yes, of course I am using floating point arithmetic. How else do you do calculations with floating point numbers? I need to calculate an average, which involves dividing resulting in a floating point number.
EDIT: I used numpy’s built in average function.