Skip to contents

This is a soft wrap around the base::seq() function.

Usage

linspace(x1, x2, n = 100L)

Arguments

x1

start point

x2

end point

n

length of output

Value

A numeric vector of n numbers between x1 and x2.

Author

Waldir Leoncio

Examples

linspace(-5, 4)
#>   [1] -5.00000000 -4.90909091 -4.81818182 -4.72727273 -4.63636364 -4.54545455
#>   [7] -4.45454545 -4.36363636 -4.27272727 -4.18181818 -4.09090909 -4.00000000
#>  [13] -3.90909091 -3.81818182 -3.72727273 -3.63636364 -3.54545455 -3.45454545
#>  [19] -3.36363636 -3.27272727 -3.18181818 -3.09090909 -3.00000000 -2.90909091
#>  [25] -2.81818182 -2.72727273 -2.63636364 -2.54545455 -2.45454545 -2.36363636
#>  [31] -2.27272727 -2.18181818 -2.09090909 -2.00000000 -1.90909091 -1.81818182
#>  [37] -1.72727273 -1.63636364 -1.54545455 -1.45454545 -1.36363636 -1.27272727
#>  [43] -1.18181818 -1.09090909 -1.00000000 -0.90909091 -0.81818182 -0.72727273
#>  [49] -0.63636364 -0.54545455 -0.45454545 -0.36363636 -0.27272727 -0.18181818
#>  [55] -0.09090909  0.00000000  0.09090909  0.18181818  0.27272727  0.36363636
#>  [61]  0.45454545  0.54545455  0.63636364  0.72727273  0.81818182  0.90909091
#>  [67]  1.00000000  1.09090909  1.18181818  1.27272727  1.36363636  1.45454545
#>  [73]  1.54545455  1.63636364  1.72727273  1.81818182  1.90909091  2.00000000
#>  [79]  2.09090909  2.18181818  2.27272727  2.36363636  2.45454545  2.54545455
#>  [85]  2.63636364  2.72727273  2.81818182  2.90909091  3.00000000  3.09090909
#>  [91]  3.18181818  3.27272727  3.36363636  3.45454545  3.54545455  3.63636364
#>  [97]  3.72727273  3.81818182  3.90909091  4.00000000
linspace(1 + 2i, 9 + 9i, 5)
#> [1] 1+2.00i 3+3.75i 5+5.50i 7+7.25i 9+9.00i