I need to show the intersection area of two curves, using the manipulate function in Mathematica. Here's a fully working example, and a preview below it :
EffPot[r_, Energy_, AngMom_] := -Energy/r + (AngMom^2 - 1)/(2 r^2)
PotCurve[Energy_, AngMom_] := Plot[EffPot[r, Energy, AngMom], {r, 0, 10},
PlotRange -> All,
PlotPoints -> Automatic,
PerformanceGoal -> "Quality",
PlotStyle -> {Thick, RGBColor[0.60, 0.20, 0.40]}]
TotEnergy[Energy_] := Plot[(Energy^2 - 1)/2, {r, 0, 10},
PlotStyle -> {Thick, RGBColor[0.20, 0.20, 0.80]}]
Manipulate[Show[PotCurve[Energy, AngMom], TotEnergy[Energy],
PlotRange -> {{0, 10}, {-2, 2}},
AspectRatio -> 1,
Frame -> True,
Axes -> True,
AxesOrigin -> {0, 0},
AxesStyle -> GrayLevel[0.7],
Ticks -> True,
GridLines -> Automatic,
GridLinesStyle -> Directive[LightGray, Dashed],
FrameLabel -> {
Style["m r / k", 16, Italic],
Style[Subscript["\[Phi]", "eff"], 16]
},
ImageSize -> 500],
{{Energy, 1, "E"}, -Sqrt[5], Sqrt[5], 0.01, Appearance -> {"Labeled", "Closed"}},
{{AngMom, 0, "J"}, 0.0, 5, 0.01, Appearance -> {"Labeled", "Closed"}}
]
Preview (with the intersection area added by hand) :
So my question is how to colorize the intersection area between both curves ? Please, take note that I'm using Mathematica 7.
E
andJ
. However, you should look at theFilling
option forPlot
. $\endgroup$