Skip to content

$.linespace()

Arthur Guiot edited this page Jul 11, 2017 · 1 revision

How does it work?

If you come from Python 🐍, and that you know numpy, you're probably thinking 🤔 that the Math / array manipulation group of functions are comming from Python 🐍. And you're right because I love ❤️ Python 🐍 and I think it's an amazing 😉 language. That's why I'm importing some concpers from Python 🐍 because they're useful.
But that's not the point. This function is made to create a list of value with the same interval between two value that you choose (it will return evenly spaced numbers over a specified interval). So if you want to create ten values between 0 and e, you'll use the $.linespace() function. That's what it will return:

[ 0,
  0.27182818285,
  0.5436563657,
  0.81548454855,
  1.0873127314,
  1.35914091425,
  1.6309690971,
  1.90279727995,
  2.1746254628,
  2.44645364565,
  2.7182818285 ]

How to use it?

Well, it pretty simple. This function will only require 3 arguments:

  • start, the smallest value
  • end, the largest value
  • n, the number of value between the start and the end values. ⚠️ If you're dealing with float numbers, use . instead of ,.

Example

Let's say you want to have the result that I showed you before (10 value between 0 and e):

JS:

$.linespace(0, Math.E, 10) // simple as that 😊

⚠️ Questions?

Don't hesitate to ask your questions ⁉️ in the issue part 😁

Clone this wiki locally