# Plotting a function that depends on a parameter

I wish to plot the function $f(x)=\sin(\omega x).$ One property of this function is that it is periodic in $x$ with period $\frac{2 \pi}{\omega}$.

I wish to plot $f(x)$ in the region $x\in (-\frac{2\pi}{\omega},\frac{2\pi}{\omega})$, with ticks on $$-\frac{2\pi}{\omega},-\frac{3}{2}\frac{\pi}{\omega},-\frac{\pi}{\omega},-\frac{1}{2}\frac{\pi}{\omega}, 0,\frac{1}{2}\frac{\pi}{\omega},\frac{\pi}{\omega},\frac{3}{2}\frac{\pi}{\omega},\frac{2\pi}{\omega}$$

which means quarter-steps of the periodicity in $x$.

When I define this function in Mathematica I do the following:

f[x_] := Sin[ω x]


Since I want to plot it, the only command line(s) that really plots something is

ω = 5
Plot[f[x], {x, -((2 π)/ω), (2 π)/ω}]


This advances me a bit but is not exactly what I want to get.

I want to keep $\omega$ unset, and to see the axis labels with ticks on multiplies of $\frac{2\pi}{\omega}$ and not just numbers appearing there.

I know I can manage all this using Ticks, but I wonder whether Mathematica can do it automatically.

For now it is all simple but it becomes much more complicated when plotting, for example, 2 variables scalar-function where each variable has its corresponding period, as in this solution to Laplace equation, with certain boundary conditions:

$$V(x,y)=\frac{4V_0}{\pi}\sum_{n=1,3,5} \frac{1}{n} \frac{\cosh(n\,\pi\,x/a)}{\cosh(n\,\pi\,b/a)}\sin(n\,\pi\,y/a)$$

You will need to use Ticks. Doing the kind the thing you are looking is why the Ticks option is available. The trick is include ω as a text character.

With[{ω = 5},
Plot[Sin[ω x], {x, -2 π/ω, 2 π/ω},
Ticks -> {Table[{w, w ω/"ω"}, {w, Subdivide[-2 π/ω, 2 π/ω, 8]}], Automatic}]]


However, I think the plot will look better and be more readable with a frame and frame ticks.

With[{ω = 2},
Plot[Sin[ω x], {x, -2 π/ω, 2 π/ω},
Frame -> True,
FrameTicks ->
{Automatic, {Table[{w, w ω/"ω"}, {w, Subdivide[-2 π/ω, 2 π/ω, 8]}], None}}]]


• Are you familiar with any other way of doing this without setting $\omega$ to any value? – E Be Aug 21 '16 at 16:22
• @UdiBehar. You can not plot anything symbolic. Everything that shows up in a plot must eventually be reduced to lists of pairs of real numbers. – m_goldberg Aug 21 '16 at 16:34
• @UdiBehar. Besides, the plot will look exactly the same no matter what value ω is given. – m_goldberg Aug 21 '16 at 16:40