Page 1 sur 1

seq() => sequence object

Publié : dim. janv. 27, 2019 7:14 pm
par compsystems
Hi, BP, why does the SEQ command sometimes return a vector?

1: seq( 1..10 ) [↵] 1,2,3,4,5,6,7,8,9,10

2: seq( 1..10, 0.1 ) [↵] 0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0

3: seq( 20..10, -2 ) ] [↵] 20,18,16,14,12,10

5: seq( -1, 5 ) [↵] [ -1,-1,-1,-1,-1 ]

6: seq( t, 3 ) [↵] [ t, t, t ]

7: seq( k, k=1..10 ) [↵] 1,2,3,4,5,6,7,8,9,10

8: seq( k, k=0..1, 0.1 ) [↵] [ 0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0 ]



session Xcas

Re: seq() => sequence object

Publié : lun. janv. 28, 2019 7:08 am
par parisse
seq has some Maple compatibility, in that case it returns a sequence. Other syntaxes return a vector.

Re: seq() => sequence object

Publié : jeu. mars 07, 2019 9:50 pm
par compsystems
^ OK, But I do not understand why in the case of 7 and 8, when the step is specified it changes from seq to vector, another case why does not show the following sequence

seq( 1..4, 1 ) [enter] nop
seq( 1..4, 0.9 ) [enter] (1, 1.9, 2.8, 3.7)
seq(4..1, -1) [enter] 4,3,2,1