NumPy linspace specifies how many evenly spaced values to place between two endpoints
A numerical sequence can be described by its boundaries and its entry count. NumPy linspace takes that approach: it generates a requested number of evenly spaced samples over an interval. Instead of supplying the spacing directly, the reader supplies how many values the result should contain.
Academia Master Trader presents this explanation in English for readers in The Gambia. The examples concern numerical arrays only. They are not prices, trading signals or financial results. The aim is to distinguish the number of samples from the number of spaces between them, then explain how including or excluding the endpoint changes the spacing.
Five samples create four spaces when both ends are included
The expression np.linspace(0,8,num=5) produces [0.,2.,4.,6.,8.]. There are five samples, including the start at zero and the stop at eight. The gap between adjacent samples is two.
Five values have four gaps between them. The spacing is therefore eight divided across four gaps, not five. That distinction explains why the sample count and the interval count must be read separately.

The argument num requests the number of values. It is not a step size. A reader who interprets five as a spacing would be describing a different sequence from the one requested by this expression.
Endpoint inclusion is the default
The official reference lists endpoint as True by default. In the opening example, eight is therefore the last sample. It is both the upper boundary and a value present in the output.
This differs from reading a boundary as automatically excluded. The function's endpoint setting is part of the request and must be considered before describing the result. An explanation should name that setting rather than importing a boundary rule from a different constructor.
With a sample count greater than one and both ends included, the values divide the interval between the start and stop into one fewer gaps than samples. This simple picture is useful for ordinary scalar endpoints such as zero and eight.
Excluding the endpoint changes the spacing
The expression np.linspace(0,8,num=4,endpoint=False) produces [0.,2.,4.,6.]. There are four samples, and eight is not included. In this case, the interval is divided into four equal steps before the excluded endpoint.
Compare that with np.linspace(0,8,num=4), which includes both endpoints by default. The sample count is still four, but the spacing differs because three gaps must cover the whole interval from zero to eight.
Endpoint False is not simply an instruction to create the ordinary four-sample result and delete its last value. NumPy still generates the requested four samples. The reference explains that excluding the endpoint changes the step size as well as the presence of the stop value.
Ask for the spacing when it helps the explanation
With retstep set to True, linspace returns both the samples and their spacing. For the opening example, np.linspace(0,8,num=5,retstep=True) returns the sample array together with a step of two.
That return value contains two parts. It is not a longer sample array with the spacing appended as an extra sixth sample. A program should distinguish the numerical sequence from the separate spacing information.
This option is useful when a lesson needs to show the count and the resulting gap side by side. It makes the relationship explicit without asking a reader to infer the step solely by subtracting neighbouring printed values.
The default count is not inferred from the interval length
The reference lists fifty as the default num value. A call that omits num therefore does not automatically choose one sample per integer or one sample for each unit of distance between the endpoints.
State num explicitly in an introductory example. A small count makes it possible to read every sample and count the spaces directly. Once the relationship is clear, a larger sequence follows the same distinction between values and gaps.
The requested number of samples must be non-negative. This lesson focuses on small counts greater than one so that the equal-gap picture can be shown directly with both endpoints present.
Representation is a separate choice
When dtype is omitted, linspace infers a type from the endpoint arguments, but the reference states that the inferred type is never an integer. Even integer endpoint arguments can therefore produce floating-point values such as the ones in the opening example.
An explicitly requested integer dtype needs separate attention. The reference states that values are rounded towards negative infinity for that case. Choosing an integer representation is not merely a way to hide decimal punctuation while preserving every fractional sample unchanged.
For a first explanation, use the floating-point output and keep the examples easy to inspect. Describe type conversion separately from the choice of sample count and endpoint policy. Those choices answer different questions about the resulting array.
Read count and endpoint policy together
Continue learning with Academia Master Trader at academiamastertrader.com.br. Aprenda provides access to educational material. Name the start, stop and sample count, then say whether the endpoint is included. Counting values and gaps separately gives a clear account of why the output has its particular spacing.