3
$\begingroup$

I have an equation as a function of $a$ and $\theta$ and would like to visualise the intersection between this graph and a flat plane at a height of 1 unit. I tried using the RegionPlot@ImplicitRegion method:

ClearAll["Global`*"]

m[θ_] := √Abs[Sin[θ]]; 
F2[a_, θ_] := -15 m [θ] a Cot[m[θ] a]^3 + 
  15 Cot[m[θ] a ]^2 - 9 m [θ] a Cot[m[θ] a] + 
  4; (*-pi<theta<0*)
G2[a_, θ_] := -2 (m[θ] a Cot[m[θ] a] - 
    1);(*-pi<theta<0*)
U = 1
Q2[a_, θ_] := -(Cos[θ]/(9 m[θ]^4)) F2[
    a, θ] + U/m[θ]^2 G2[a, θ];(*-pi<theta<0*)

RegionPlot@
  ImplicitRegion[
   Q2[a, θ] == 
    1, {{a, 1, 8}, {θ, -π + 0.001, -0.001}}]

Why is Mathematica taking so long to plot the graph? Is it due to the complexity of the equation or other reasons? How should I modify the code? Thank you very much.

$\endgroup$
1
  • $\begingroup$ RegionPlot@DiscretizeRegion@ImplicitRegion[...] $\endgroup$
    – cvgmt
    Dec 2 '21 at 6:55
3
$\begingroup$
ClearAll["Global`*"]

m[θ_] := √Abs[Sin[θ]];
F2[a_, θ_] := -15 m[θ] a Cot[m[θ] a]^3 + 
   15 Cot[m[θ] a]^2 - 9 m[θ] a Cot[m[θ] a] + 4;
(*-pi<theta<0*)

G2[a_, θ_] := -2 (m[θ] a Cot[m[θ] a] - 
    1);(*-pi<theta<0*)
U = 1;
Q2[a_, θ_] := -(Cos[θ]/(9 m[θ]^4)) F2[a, θ] + 
   U/m[θ]^2 G2[a, θ];
(*-pi<theta<0*)

You appear to be confusing Region and RegionPlot. A region is the input to Region. The argument to RegionPlot is a predicate that must evaluate to True or False. In either case it is easier to evaluate when Q2[a,θ] <= 1 rather than Q2[a,θ] == 1

Region[ImplicitRegion[
  Q2[a, θ] <= 1, {{a, 1, 8}, {θ, -π + 0.001, -0.001}}],
 Frame -> True,
 AspectRatio -> 1]

enter image description here

RegionPlot[Q2[a, θ] <= 1 && 1 <= a <= 8 && -Pi < θ < 0,
 {a, 1, 8}, {θ, -π + 0.001, -0.001},
 PlotPoints -> 50,
 MaxRecursion -> 5]

enter image description here

$\endgroup$
3
$\begingroup$
ContourPlot[
 Q2[a, θ] == 1, {a, 1, 8}, {θ, -π + 0.001, -0.001}]

enter image description here

Since RegionPlot not always auto discretize the region, so we need to add DiscretizeRegion by hand.

RegionPlot@
 DiscretizeRegion@
  ImplicitRegion[
   Q2[a, θ] == 
    1, {{a, 1, 8}, {θ, -π + 0.001, -0.001}}]

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.