Mathematica: Plot using abstract variables instead of set values

Click For Summary
SUMMARY

This discussion focuses on plotting functions in Mathematica using abstract variables instead of fixed values. The user seeks a method to plot a function like sin(a*x) without assigning a specific value to 'a'. The solution provided involves using the Plot function with appropriate axis labeling and rescaling. Specifically, the command Plot[Sin[x], {x, -4, 4}, AxesLabel -> {x/a, y == Sin[a x]}, Ticks -> {{-Pi, -Pi/2, 0, Pi/2, Pi}, {-1, 0, 1}}] allows for the desired representation.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of mathematical functions and their graphical representations
  • Knowledge of axis scaling and labeling in plots
  • Basic experience with variable manipulation in programming
NEXT STEPS
  • Explore advanced plotting techniques in Mathematica
  • Learn about dynamic visualizations using Manipulate in Mathematica
  • Investigate the use of parameters in Mathematica plots
  • Study the implications of variable scaling in mathematical modeling
USEFUL FOR

Mathematica users, mathematicians, educators, and anyone interested in creating flexible and parameterized plots for mathematical functions.

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: 743

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 8 ·
Replies
8
Views
10K