1
$\begingroup$

I would like to know, how to plot a graph, for example of this function:

$f(t)=-\frac{4 \sin \left(\frac{\gamma t}{2}\right)}{\gamma ^2 t}-\frac{4 \sin ^2\left(\frac{\gamma t}{4}\right)}{\gamma }-\frac{2 \cos \left(\frac{\gamma t}{2}\right)}{\gamma }+\frac{\pi t}{2}$ where $t$ is a variable and $\gamma$ is some constant parameter. Is there a possibility to plot it with x axis being in units of notjust $t$, but in units of $\gamma t$?

I was thinking it could be done something like this, but it does not work:

Plot[f(t), {\[Gamma]*t, 0, 40}]
$\endgroup$
  • $\begingroup$ Would ParametricPlot[{\[Gamma]*t, f[t]}, {t, 0, 40}] do what you want? $\endgroup$ – MarcoB May 20 '20 at 0:30
  • $\begingroup$ It kinda seems to work, but for \Gamma values less than 1 it gives seemingly correct, but really weird scaled plot. Thanks! Seems, that @Vitaliy Kaurov answer works as well! $\endgroup$ – Andris Erglis May 20 '20 at 6:20
  • $\begingroup$ Welcome to the forum. Thanks for accepting the answer. You should give it an upvote too if you fin dit useful :-) please see the intro for newcomers. $\endgroup$ – Vitaliy Kaurov May 20 '20 at 12:12
2
$\begingroup$

This is your function:

f[g_,t_]:=-4Sin[g t/2]/g^2/t-4Sin[g t/4]^2/g-2Cos[g t/2]/g+Pi t/2

With transformed variable $z=g*t$ you get a new function:

h[g_,z_]=f[g,t]/.t->z/g

$$\frac{\pi z}{2 g}-\frac{4 \sin ^2\left(\frac{z}{4}\right)}{g}-\frac{4 \sin \left(\frac{z}{2}\right)}{g z}-\frac{2 \cos \left(\frac{z}{2}\right)}{g}$$

which you plot (with, for example, $g=1$) as

Plot[h[1, z], {z, 0, 10}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.