3
$\begingroup$

I have a parametric curve described by $(x(s,t), y(s,t))$ where I would like to consider $-1\leqslant s,t \leqslant 1$ subject to some additional constraint, say $f(s,t) = 0$. I know I could solve for $s$ in terms of $t$ and plot for the specified $t$ values, but $f(s,t)$ is itself an implicit function of $s$ and $t$ and solving for $s$ would involve splitting into many different cases. Is there anyway to do this directly in Mathematica?

I tried

ParametricPlot[{x,y},{s,-1,1},{t,-1,1},
    RegionFunction->Function[{x,y,s,t}, f[s,t]==0]
]

But this returns an empty plot and I'm not confident my syntax is correct as I'm quite new to Mathematica.

$\endgroup$
1
$\begingroup$

Since you didn't define x[s, t], y[s, t] and ff[s, t], I will contrive a simple example by defining

x[s_, t_] := Cos[π s] Cos[π t]
y[s_, t_] := Sin[π s] Cos[π t]
f[s_, t_] := Sin[π (s + t)] - Cos[π s t]

With these definitions

p1 =
  ParametricPlot[{x[s, t], y[s, t]}, {s, -1, 1}, {t, -1, 1},
    PlotStyle -> Lighter[Red, .5]]

region

gives a circular region, but when the option RegionFunction -> (f[#3, #4] == 0 &), the plot is empty because the righthand side of the rule is a contour line, not a region.

However, when I make the righthand side of the rule a real region specification, something which is perhaps interesting is plotted.

p2 = 
  ParametricPlot[{x[s, t], y[s, t]}, {s, -1, 1}, {t, -1, 1},
    PlotPoints -> 200,
    PlotRange -> {{-1, 1}, {-1, 1}},
    RegionFunction -> (Abs @ f[#3, #4] < .003 &)];

Show[p1, p2]

plot

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