Previous Up Next

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

The shift_phase command takes as argument a trigonometric expression.
shift_phase returns the expression with phase increased by π/2 (after the automatic simplification).
Input:

shift_phase(x + sin(x))

Output:

x-cos((pi+2*x)/2)

Input:

shift_phase(x + cos(x))

Output:

x+sin((pi+2*x)/2)

Input:

shift_phase(x + tan(x))

Output:

x-1/tan((pi+2*x)/2)

Quoting the argument will prevent the automatic simplification.
Input:

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

Output:

-cos((pi+2*x+2*pi/2)/2)

With an unquoted sine, we get:
Input

shift_phase(sin(x + pi/2))

Output:

sin((pi+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)


Previous Up Next