0

I want to do calculation on timescales of nanoseconds.

>>> N=10
>>> A=10
>>> t = np.linspace(0,A*1e-9,N)
array([0.        , 0.        , 0.        , 0.        , 0.        ,
   0.00000001, 0.00000001, 0.00000001, 0.00000001, 0.00000001])

But the array is being rounded off, how can I keep the desired precision of

A*1e-9/N
PhysicsMan
  • 71
  • 1
  • 5

1 Answers1

1

When running your code on my machine I get:

[0.00000000e+00 1.11111111e-09 2.22222222e-09 3.33333333e-09
 4.44444444e-09 5.55555556e-09 6.66666667e-09 7.77777778e-09
 8.88888889e-09 1.00000000e-08]

The problem is with your print options, it seems to not use scientific notation. See this page in the manual on how to change that.

In short, your code is fine, your printing of numpy arrays are probably not optimal for your use case.

Jurgen Strydom
  • 3,540
  • 1
  • 23
  • 30