Hello, BP,
what are the rules for a sequence?
seq1:= 1, 2, 3
seq1 / a => 1,2,3,a
seq1+a => a+6
seq1!=> 1,2,6
rules for a sequence
Modérateur : xcasadmin
-
- Messages : 562
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: rules for a sequence
Don't use sequences unless you want to have object containers that are automatically concatenated.
-
- Messages : 562
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: rules for a sequence
but the concatenation is not always done.
(1,2,3)*a [enter] 1*2*3*a => 6*a
seq1:=(1,2,3) [enter] 1,2,3
seq1*a [enter] 6*a
(1,2,3)/a [enter] 1,2,3,a // a is added to the end, Why?
seq1/a [enter] 1,2,3,a
(1,2,3)-a [enter] 1*2*3*-a => 6-a
seq1-a [enter] 6-a
(4,5,6)! [enter] 24,120,720 // operates on each element
seq2:=(4,5,6)
seq2! [enter] 24,120,720
neg(seq2) [enter] -4,-5,-6
(y:=1),y+2, y-2 [enter] 1,3,-1
I think that the comma operator must act from left to right and a sequence of objects separated by commas affected by an operator, operate on each element
(1,2,3)*a [enter] 1*2*3*a => 6*a
seq1:=(1,2,3) [enter] 1,2,3
seq1*a [enter] 6*a
(1,2,3)/a [enter] 1,2,3,a // a is added to the end, Why?
seq1/a [enter] 1,2,3,a
(1,2,3)-a [enter] 1*2*3*-a => 6-a
seq1-a [enter] 6-a
(4,5,6)! [enter] 24,120,720 // operates on each element
seq2:=(4,5,6)
seq2! [enter] 24,120,720
neg(seq2) [enter] -4,-5,-6
(y:=1),y+2, y-2 [enter] 1,3,-1
I think that the comma operator must act from left to right and a sequence of objects separated by commas affected by an operator, operate on each element
Re: rules for a sequence
It is always concatenated even in the examples you took. If you type 1,2,3*a this is in fact * applied to 1,2,3 and a, i.e. * applied to the sequence (1,2,3),a -> 1,2,3,a.