1
$\begingroup$

I've been working with physics and I want to plot the potential such that I can have multiple lines that represent multiple potentials. The equation is: enter image description here

where V(r) is the potential, and I want to plot many lines so I can see the turning points of the graph. I'm pretty new to Mathematica, so I'm quite clueless. I tried using DSolve by differentiating V(r) and asking it to solve, and ContourPlot (though I suppose I'd have to turn it into a vector field first, which I don't know how and that was a bit of a random thing I tried). I also tried the normal Plot. I got blank graphs. Is it because I have undefined constants that are treated as variables, like l, M, ε? I'd really appreciate some help on what code I should use / what to do to have it plot out multiple lines for V(r) that represent the many possible solutions.

$\endgroup$
1
  • 1
    $\begingroup$ There are many plotting functions in Mathematica, so it depends what you're looking for. I recommend going through the documentation, finding a plot that looks like what you want, and playing around with the "Basic Examples" to understand how they work. Yes, some constants will probably have to be defined. If I have $y = a x^2$, then it cannot be plotted in 2 "dimensions" (colour or other visual cues often act as a "3rd" dimension). However, specific a values are easy: Plot[{1 x^2, 2 x^2, 3 x^2}, {x, 0, 5}]. Higher-Dl plots can have more unknowns. What should the axes be here? Just V vs r? $\endgroup$ – MassDefect Feb 11 at 4:35
1
$\begingroup$

You need give some number for your constants, I think that mathematica don´t plot with undefined constants. In this example I did $M=l=\epsilon=1$

Plot[{1/(2 r^2), -(1/r^3), -(1/r) + 1/2}, {r, 0, 10}, PlotLegends -> "Expressions"]

enter image description here

Or you can put

M = 1; \[Epsilon] = 1; l = 1
Plot[{l^2/(2 r^2), -((M*l^2)/r^3), -((M*\[Epsilon])/r) + \[Epsilon]/2}, {r,0,10}, PlotLegends -> "Expressions"]

And put the values of the constants that you want in the equalities of the first line

enter image description here

$\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.