Increasing the phase by π/2 in a trigonometric expression: shift_phase

### 5.23.3 Increasing the phase by π/2 in a trigonometric expression: shift_phase

The shift_phase command increases the phase of a trigonometric expression by π/2.

- shift_phase takes one argument:
  expr, a trigonometric expression.
- shift_phase(expr) returns expr with the phase increased by π/2 (after automatic simplification).

#### Examples

- Input:
  shift_phase(x + sin(x))
  Output:

  x−cos | ⎛ ⎜ ⎜ ⎝ |
  π +2 x
  2
  | ⎞ ⎟ ⎟ ⎠

- Input:
  shift_phase(x + cos(x))
  Output:

  x+sin | ⎛ ⎜ ⎜ ⎝ |
  π +2 x
  2
  | ⎞ ⎟ ⎟ ⎠

- Input:
  shift_phase(x + tan(x))
  Output:

  x− |
  1
  tan | ⎛ ⎜ ⎜ ⎝ |
  π +2 x
  2
  | ⎞ ⎟ ⎟ ⎠

Quoting the argument will prevent the automatic simplification.

#### Example

Input:

shift_phase(’sin(x + pi/2)’)

Output:

−cos | ⎛ ⎜ ⎜ ⎝ |
π +2 x+2 |
π
2
2
| ⎞ ⎟ ⎟ ⎠

With an unquoted sine, you get:
Input:

shift_phase(sin(x + pi/2))

Output:

sin | ⎛ ⎜ ⎜ ⎝ |
π +2 x
2
| ⎞ ⎟ ⎟ ⎠

since sin(x+pi/2) is evaluated (in this case simplified) before shift_phase is called, and shift_phase(cos(x)) returns sin((pi+2*x)/2).