Special Xcas operators

### 7.1.1 Special Xcas operators

##### Sequences.

$ is the infixed version of seq (see Section 5.1.2). For example (do not forget to put parenthesis around the arguments):

(2^k)$(k=0..3)

or:

seq(2^k,k=0..3)

1,2,4,8 |  |  |  |  |  |  |  |  |  |

##### Modular numbers.

mod or % defines a modular number; a mod n is the equivalence class of a in ℤ/nℤ. For example:

5 % 7

or:

5 mod 7

| ⎛ ⎝ | −2 | ⎞ ⎠ | %7

##### Function composition.

@ is used to compose functions; (f@g)(x)=f(g(x)). For example:

(sin@exp)(x)

sin | ⎛ ⎝ | ex | ⎞ ⎠

@@ is used to compose a function with itself several times (like a power, replacing multiplication by composition), e.g. (f@@3)(x)=f(f(f(x))). For example:

(sin@@4)(x)

sin | ⎛ ⎝ | sin | ⎛ ⎝ | sin | ⎛ ⎝ | sinx | ⎞ ⎠ | ⎞ ⎠ | ⎞ ⎠

##### Set operations.

minus, union and intersect return the difference, the union and the intersection of two sets, respectively. (See Section 3.2.2). For example:

A:=set[1,2,3,4]:; B:=set[3,4,5,6]:;

A minus B

⟦ 1,2⟧ |  |  |  |  |  |  |  |  |  |

A union B

⟦ 1,2,3,4,5,6⟧ |  |  |  |  |  |  |  |  |  |

A intersect B

⟦ 3,4⟧ |  |  |  |  |  |  |  |  |  |

##### Defining functions.

-> is used to define a function, which can be assigned a name. For example:

(x->x^2)(3)

9 |  |  |  |  |  |  |  |  |  |

f:=x->x^2:; f(3)

9 |  |  |  |  |  |  |  |  |  |

##### Assignment.

=> is the infixed version of sto (see Section 3.3.2) and so is used to store an expression in a variable. For example:

2=>a

2 |  |  |  |  |  |  |  |  |  |

:= is used to store an expression in a variable, but the variable comes first (the argument order is switched from =>). For example:

a:=2

2 |  |  |  |  |  |  |  |  |  |

=< to store an expression in a variable, but the storage is done by reference if the target is a matrix element or a list element. This is faster if you modify objects inside an existing list or matrix of large size, because no copy is made, the change is done in place. Use with care, all objects pointing to this matrix or list will be modified. For example:

L:=[2,3]:; L2:=L:;

then:

L[0]=<5:;

L, L2

| ⎡ ⎣ | 5,3 | ⎤ ⎦ | , | ⎡ ⎣ | 5,3 | ⎤ ⎦