I have a function f[t,x,y]= x^2 y^2 t^(-2) Exp[(y/t)]^-1
and I want a data list of the variables x vs. y that satisfy f[t,x,y]>1
, so that I can draw a boundary line that distinguishes between those two regions (f[t,x,y]>1
and f[t,x,y]<1
). The first variable t can be chosen arbitrarily. How shall I proceed?
3 Answers
Clear[f, t];
f[t_, x_, y_] = x^2 y^2 t^(-2) Exp[(y/t)]^-1;
t = 1;
ContourPlot[f[t, x, y], {x, -5, 5}, {y, -5, 5}, Contours -> {1},
ContourStyle -> {AbsoluteThickness[2], Red},
ContourShading -> {LightGreen, LightBlue}, PlotPoints -> 50,
MaxRecursion -> 2, PlotRange -> All, PlotLegends -> Automatic]
As t
can be chosen arbitrarily, we set it simply to one. Then the function simplifies to:
f[x_, y_] = x^2 y^2 Exp[(y)]^-1
The boundary between f>1 and f<1 can be obtained by:
ContourPlot[f[x, y] == 1, {x, -1, 1}, {y, -5, 0}]
Or using RegionPlot
:
RegionPlot[
{f[x, y] < 1, f[x, y] == 1, f[x, y] > 1},
{x, -1, 1}, {y, -5, 0}, MaxRecursion -> 7
]
-
$\begingroup$ If I have to vary
t
then how should I do it? $\endgroup$ Jul 13, 2022 at 4:35 -
$\begingroup$ Simply introduce t again as a parameter. $\endgroup$ Jul 13, 2022 at 7:53
-
$\begingroup$ But a function with three variables in either
ContourPlot
orRegionPlot
do't work. $\endgroup$ Jul 13, 2022 at 8:33 -
$\begingroup$ I said "as parameter", not as argument. To plot t must have a numerical value that you can insert in the definition of f. $\endgroup$ Jul 13, 2022 at 8:35
-
$\begingroup$ I tried to generate random numbers for each vairables and then solved the function. Then I used
ListContourPlot
withRegionFunction -> Function[{x, y, z}, z > 1]
. I does look a bit somthing I wanted earlier. $\endgroup$ Jul 13, 2022 at 8:36