# Xcas operators: $ %

### 5.14.1 Xcas operators: $ %

- $ is the infixed version of seq (see Section 5.39.2).
  Example.
  Input:
  (2^k)$(k=0..3)
  (do not forget to put parenthesis around the arguments)
  or:
  seq(2^k,k=0..3)
  Output:

  1,2,4,8

- mod or % defines a modular number; a mod n is the equivalence class of a in ℤ/nℤ.
  Example.
  Input:
  5 % 7
  or:
  5 mod 7
  Output:

  ⎛ ⎝ | −2 | ⎞ ⎠ | %7

- @ is used to compose functions; (f@g)(x)=f(g(x)).
  Example.
  Input:
  (sin@exp)(x)
  Output:

  sin | ⎛ ⎝ | ex | ⎞ ⎠

- @@ is used to compose a function with itself many times (like a power, replacing multiplication by composition); for example, (f@@3)(x)=f(f(f(x))).
  Example.
  Input:
  (sin@@4)(x)
  Output:

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

- minus, union and intersect return the difference, the union and the intersection of two sets, respectively. (See Section 4.3.2).
  Example.
  Input:

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

  then:
  A minus B
  Output:

  ⟦ 1,2⟧

  Input:
  A union B
  Output:

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

  then:
  A intersect B
  Output:

  ⟦ 3,4⟧

- -> is used to define a function, which can be assigned a name.
  Example.
  Input:
  (x->x^2)(3)
  Output:

  9

  Input:
  f := x -> x^2
  then:
  f(3)
  Output:

  9

- => is the infixed version of sto (see Section 4.4.2) and so is used to store an expression in a variable.
  Example.
  Input:
  2 => a
  then:
  a
  Output:

  2

- := is used to store an expression in a variable, but the variable comes first (the argument order is switched from =>).
  Example.
  Input:
  a := 2
  then:
  a
  Output:

  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.
  Example.
  Input:

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

  then:
  L[0] =< 5
  and:
  L
  Output:

  ⎡ ⎣ | 5,3 | ⎤ ⎦

  Input:
  L2
  Output:

  ⎡ ⎣ | 5,3 | ⎤ ⎦