HW6 questions

When I trying to create a vector x = {10, 9.9, …, -9.9, -10} using vector operations, I didn’t get evenly divided decimals. I got something like this:

Can someone explain this?

Not sure what you did to get that. Maybe you can try np.linspace?

This might be caused by “floating point round error”. Try np.arrange(0.0, 1.0, 0.1) rather than np.arrange(0, 1, 0.1).

Welcome to the world of numerical analysis. This is precisely why having enough of a mantissa matters. And why not everyone has switched to FP16 by default yet. Plenty of exciting research to be done.