Question: Vector Definition Using Initial and Final Values

A simple question:

Can I define a Vector using:

a) Initial Value (a), Final Value (b) and the number of elements (N) (assuming linear spacing)
For example: Starts at 1, finishes at 12 with 5 elements:

[ 1 , 3.75 , 6.5 , 9.25 , 12 ]

b) Initial Value (a), Final Value (b) and step (s)
For example: Starts at 2, finishes at 6 with a step of 0.5

[ 2 , 2.5 , 3 , 3.5 , 4 , 4.5 , 5 , 5.5 , 6]

but using only a,b and N ; or a,b and s directly?



I know this can be done using the seq command and some basic definitions:

In the first case:
Vector([ seq(a+(b-a)/N*i,i=0..N) ]); should do the trick

And the second case is even easier:

PS. I know for the second case that using any arbitrary step can result in loosing the final value "b" of the sequence because you won't step on b using that arbitrary step value.

As I said above. I just want to know if there is a direct way to define these cases.

Please Wait...