Home  >  Article  >  Backend Development  >  Example tutorial of arithmetic sequence creation function

Example tutorial of arithmetic sequence creation function

PHP中文网
PHP中文网Original
2017-06-20 15:05:243421browse

linspace function is a function that creates an arithmetic sequence. It is best to see this function in the Matlab language. I have been learning Numpy in Python recently and found that this function also exists. Here are some summaries of my learning process. .

(1) Specify the starting point and ending point.

The default number of arithmetic series is 50.

(2) Specify the number of arithmetic sequence

(3) If the number of elements in the sequence is specified , you can set the end point status.

endpoint : bool, optional

If True, stop is the last sample. Otherwise, it is not included . Default is True.

(4) If the number of elements in the array is specified, you can set the interval attribute status.

retstep : bool, optional

If True, return (samples, step), where step is the spacing between samples.

As you can see from the above results, the setting The x returned by the step difference is output as a tuple, and the second element of the tuple is the step difference 1.0.

The above is the detailed content of Example tutorial of arithmetic sequence creation function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn