Mathematica: Plot using abstract variables instead of set values

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 5K views
rynlee
Messages
44
Reaction score
0
Hi All,

Does anyone know of a way to make plots in mathematica in terms of variables?

For example, suppose you had a function sin(a*x), and you wanted to plot it but did not want to set a to a specific value, the purpose being to have the graph report multiples of a, not specific numbers.

Usually I just throw in reasonable dummy values for whatever function, but it would be nice to be able to show nice clean fractions on a plot.

Thanks for any ideas!
 
Physics news on Phys.org
You just have to rescale the x-axis. So plot Sin[x], but label the plot sin(a x) and the x-axis in units of x/a.

Try
Code:
Plot[Sin[x], {x, -4, 4}, AxesLabel -> {x/a, y == Sin[a x]}, 
                         Ticks -> {{-Pi, -Pi/2, 0, Pi/2, Pi}, {-1, 0, 1}}]
See the attached image.
 

Attachments

  • Sin(a x).png
    Sin(a x).png
    3.1 KB · Views: 753