Plotting arbitrary constants in mathematica

In summary, to plot arbitrary constants in Mathematica, you can use a Manipulate function and define dimensionless variables for the constants to be absorbed into. In the example given, the dimensionless variable s is defined as r/a, but e cannot be absorbed and must be input separately.
  • #1
kraigandrews
108
0
How do you plot arbitrary constants in mathematica? for example r(psi)=a(1-eCos(psi)), where a and e are some constant.

Thanks in advance for the help.
 
Physics news on Phys.org
  • #2
Well, you cannot plot a function with arbitrary constants. Where would the computer draw the line? However, what you can do is do a Plot inside a Manipulate, like this:

Manipulate[Plot[a (1 - e Cos[psi]), {psi, -1, 1}], {{a, 1}, -2, 2}, {{e, 1}, -2, 2}]
 
  • #3
OK thanks.
 
  • #4
Some constants can be absorbed into variables by defining dimensionless variables.
This basically treats the constant as the "natural scale" for that dimension.

In your example, you can define the dimensionless, s = r/a
But e is dimensionless and can't really be absorbed anywhere.

So

Manipulate[ Plot[ 1 - e Cos[psi], {psi, -1, 1}, AxesLabel->{"psi","s=r/a"}], {{e,1}, -2, 2}]
 
  • #5


To plot arbitrary constants in Mathematica, you can use the Plot function and specify the values of the constants a and e in the formula. For example, using the formula r(psi) = a(1-eCos(psi)), you can plot the function for different values of a and e by using the following code:

Plot[a*(1 - e*Cos[psi]), {psi, 0, 2*Pi}, PlotRange -> All]

This will generate a plot of the function with the specified values of a and e. You can also use the Manipulate function to create an interactive plot where you can adjust the values of a and e using sliders. For example:

Manipulate[Plot[a*(1 - e*Cos[psi]), {psi, 0, 2*Pi}, PlotRange -> All], {a, 1, 10}, {e, 0, 1}]

This will create a plot where you can adjust the values of a and e and see the resulting changes in the plot. You can also use the Show function to combine multiple plots with different values of a and e into one plot for comparison. For more complex functions involving arbitrary constants, you may need to use the ParametricPlot function. Overall, Mathematica offers a variety of tools and functions for plotting arbitrary constants and visualizing mathematical equations.
 

Related to Plotting arbitrary constants in mathematica

1. How do I plot an arbitrary constant in Mathematica?

To plot an arbitrary constant in Mathematica, you can use the Plot function and specify the constant as a function of the independent variable. For example, if your constant is represented by the variable c and your independent variable is x, you can use the syntax Plot[c, {x, xmin, xmax}] to plot the constant.

2. Can I plot multiple arbitrary constants in the same graph?

Yes, you can plot multiple arbitrary constants in the same graph by using the Plot function with a list of functions. For example, if you have two constants represented by c1 and c2, you can use the syntax Plot[{c1, c2}, {x, xmin, xmax}] to plot both constants in the same graph.

3. How do I add labels and legends to my plot of arbitrary constants?

To add labels and legends to your plot of arbitrary constants, you can use the PlotLegends option in the Plot function. This allows you to specify the labels for each constant and add a legend to the graph. Alternatively, you can use the PlotLabel option to add a label to the entire graph.

4. Can I customize the style and appearance of my plot of arbitrary constants?

Yes, you can customize the style and appearance of your plot of arbitrary constants by using various options in the Plot function. Some options include PlotStyle to change the color and style of the lines, AxesLabel to add labels to the axes, and PlotRange to specify the range of the plot.

5. Is it possible to manipulate and interact with a plot of arbitrary constants?

Yes, it is possible to manipulate and interact with a plot of arbitrary constants by using the Manipulate function. This allows you to change the values of the constants and see the corresponding changes in the graph. You can also use Dynamic variables to update the plot in real-time based on user inputs.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
376
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
808
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
554
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
Back
Top