콘텐츠로 건너뛰기

NumPy Linspace: 이해하기 쉽게 사용 및 수정 방법

[

np.linspace(): numpy linspace

Creating Ranges of Numbers With Even Spacing

  • Using np.linspace()
    • 예시:
    >>> import numpy as np
    >>> np.linspace(1, 10)
    array([ 1. , 1.18367347, 1.36734694, 1.55102041, 1.73469388,
    1.91836735, 2.10204082, 2.28571429, 2.46938776, 2.65306122,
    2.83673469, 3.02040816, 3.20408163, 3.3877551 , 3.57142857,
    3.75510204, 3.93877551, 4.1224489, ...])
  • Using range() and List Comprehensions
  • Using np.arange()

Customizing the Output From np.linspace()

  • The start, stop, and num Parameters
  • The dtype Parameter for Changing Output Type
  • The endpoint and retstep Parameters
  • Nonscalar Values for Higher-Dimensional Arrays
  • Summary of Input Parameters and Return Values
  • Example: A Food Production Conveyor Belt

Representing Mathematical Functions

  • Mathematical Functions With np.linspace()
  • Example: Superimposing Traveling Waves
  • Two-Dimensional Mathematical Functions

Creating Ranges of Numbers With Uneven Spacing

  • Logarithmic Spaces
  • Other Nonlinear Ranges
  • Example: Simulation of an Orbiting Planet

Conclusion