C
Christopher Barrington-Leigh
The following code:
from pylab import arange
nSegments=5.0
print arange(0,1.0+1.0/nSegments,1.0/nSegments)
nSegments=6.0
print arange(0,1.0+1.0/nSegments,1.0/nSegments)
nSegments=8.0
print arange(0,1.0+1.0/nSegments,1.0/nSegments)
nSegments=10.0
print arange(0,1.0+1.0/nSegments,1.0/nSegments)
gives an output of:
[ 0. 0.2 0.4 0.6 0.8 1. ]
[ 0. 0.16666667 0.33333333 0.5 0.66666667
0.83333333 1. 1.16666667]
[ 0. 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1. ]
[ 0. 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1. ]
These arrays have lengths, 6, 8, 9, and 11, in stead of 6, 7, 9, and
11.
What is going on for the case of n=6?
from pylab import arange
nSegments=5.0
print arange(0,1.0+1.0/nSegments,1.0/nSegments)
nSegments=6.0
print arange(0,1.0+1.0/nSegments,1.0/nSegments)
nSegments=8.0
print arange(0,1.0+1.0/nSegments,1.0/nSegments)
nSegments=10.0
print arange(0,1.0+1.0/nSegments,1.0/nSegments)
gives an output of:
[ 0. 0.2 0.4 0.6 0.8 1. ]
[ 0. 0.16666667 0.33333333 0.5 0.66666667
0.83333333 1. 1.16666667]
[ 0. 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1. ]
[ 0. 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1. ]
These arrays have lengths, 6, 8, 9, and 11, in stead of 6, 7, 9, and
11.
What is going on for the case of n=6?