2
$\begingroup$

I have two following functions:

g21n = √(253349/60000 - g1^2 + 14801/(9375000 2^(2/3) (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (605441173 2^(1/3))/(9375 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (75490236 2^(1/3)g1^2)/(625 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (1/(768 2^(1/3)))((170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)))
g22n = √(253349/60000 - g1^2 - 2088267/(6250000 2^(2/3) (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) - (302719024 2^(1/3))/(9375 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (299124874 I 2^(1/3))/(3125 Sqrt[3] (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (2088267 I Sqrt[3])/(6250000 2^(2/3) (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (47922 I 2^(1/3)Sqrt[3])/(125 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) - (37745118 2^(1/3)g1^2)/(625 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (37745118 I 2^(1/3) Sqrt[3]g1^2)/(625 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) - (1/(1536 2^(1/3)))((170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + Sqrt[4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2])^(1/3)) - (1/(512 2^(1/3) Sqrt[3]))I (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + Sqrt[4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2])^(1/3))

Plotting both g21n and g22n as a function of g1 with the Filling command:

Plot[{g21n, g22n}, {g1, 0, 10}, FrameLabel -> {"\!\(\*SubscriptBox[\(g\), \(1\)]\)", "\!\(\*SubscriptBox[\(g\), \(2\)]\)"}, PlotRange -> {{0, 3}, {0, 6}}, PlotStyle -> {Directive[Blue], Directive[Orange]}, ImageSize -> Medium, LabelStyle -> {20, Black, Bold}, AspectRatio -> 1, WorkingPrecision -> 20, Frame -> True, FrameStyle -> Directive[Black], FrameLabel -> {Style["\!\(\*SubscriptBox[\(g\), \(2\)]\)", Italic, Bold, Black, 12], Style["\!\(\*SubscriptBox[\(g\), \(1\)]\)", Italic, Bold, Black, 12]}, FrameTicksStyle -> Directive[Thick, Black, Bold], Filling -> {1 -> {Axis, Green}, 2 -> {Axis, White}} AspectRatio -> 1, PlotRangePadding -> None, PlotPoints -> 100, WorkingPrecision -> 20, Exclusions -> None]

Gives enter image description here

I want the region bounded by the two curves to be shaded but it remains unshaded even with the Filling command. How should I go about filling the region between the two curves?

Edit: Fixed the brackets for g21n

$\endgroup$
  • $\begingroup$ some parentheses are missing in the definition of g21n. $\endgroup$ – kglr Oct 31 '18 at 20:54
  • $\begingroup$ Try Filling -> {1 -> {2}} $\endgroup$ – Carl Woll Oct 31 '18 at 21:41
  • $\begingroup$ @kglr Fixed the parentheses. Sorry about that. $\endgroup$ – kowalski Oct 31 '18 at 21:59
  • $\begingroup$ @CarlWoll There are some leftover, unfilled white spaces when I do Filling -> {1 -> {2}} $\endgroup$ – kowalski Oct 31 '18 at 22:01
2
$\begingroup$

Use {g21n, Max[0, Re@g22n]} as the first argument of Plot with the option Filling -> {1 -> {{2}, Green}}:

enter image description here

$\endgroup$
  • $\begingroup$ That's great! But there's a tail end coming out of the cusp and I don't want to show that. What should I do to get rid of it ? $\endgroup$ – kowalski Oct 31 '18 at 22:13
  • $\begingroup$ @kowalski, i will update with a fix. $\endgroup$ – kglr Oct 31 '18 at 22:32
2
$\begingroup$

I had an epiphany, keep the argument of Plot as {g21n, g22n} and just do Filling -> {{1 -> {Axis, Gray}}, {2 -> {Axis, White}}} enter image description here

$\endgroup$
  • $\begingroup$ This won't work if the background is not white. For example, if you wanted to overlay this graphic on top of an image, you would have to use something like @kglr's answer. $\endgroup$ – Carl Woll Oct 31 '18 at 22:36
  • $\begingroup$ I will just do {2 -> {Axis, "Background color"}} assuming I know the color that I'm overlaying on. Either way, @kglr works just as well, but I need a cusp to be evident between the blue and orange curve. But still, thanks! $\endgroup$ – kowalski Oct 31 '18 at 22:54

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.