Increasing the phase by π/2 in a trigonometric expression

### 10.2.3 Increasing the phase by π/2 in a trigonometric expression

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

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

#### Examples

shift_phase(x+sin(x))

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

shift_phase(x+cos(x))

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

shift_phase(x+tan(x))

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

Quoting the argument will prevent the automatic simplification.

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

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

With an unquoted sine, you get:

shift_phase(sin(x+pi/2))

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).