70174779

Date: 2021-11-30 19:14:45
Score: 4.5
Natty:
Report link

I still have a problem:

For example (using smaller numbers as @hpaulj suggested) in t=np.linspace(0,1,6) the stepsize should be exactly h=0.2. Since 0.2 = 1/5 = 1/(2^2+1) no truncation error should appear in the list.

But print([ti for ti in t]) results in [0.0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0].

On the other side print(np.diff(t)) yields [0.2 0.2 0.2 0.2 0.2].

Are there any good explanations for this behavior?

Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • User mentioned (1): @hpaulj
  • Looks like a comment (1):
  • Low reputation (1):
Posted by: BerndJ