0
$\begingroup$

So I have been using ContourPlot to plot the zero set of a fairly unwieldy function, with many intersecting components. There's really only one of these components that I want to look at, so I realized there's an inequality constraint that will let me plot only the component I want. Now, I know that this calls for RegionFunction but, I'm either implementing it very incorrectly, or my functions are so ugly that it won't work. Regardless, I was hoping I could maybe get some tips to get this running. My code is:

M = 1; tau = (0.5) + (0.5)*I; w1 = Pi/2; w2 = Pi*(tau)/2; inv = N[WeierstrassInvariants[{w1, w2}]]; E2[t_] := 1 - 24*Sum[(n*Exp[2*Pi*I*(t)*n])/(1 - Exp[2*Pi*I*(t)*n]), {n, 1, 300}]; z[u_?NumericQ] := (I* M/2)*(WeierstrassZeta[u, inv] - ((1/3)*N[E2[tau], 50]*(u))); WP[x_, y_] := WeierstrassP[w1*x + w2*y, inv]; L = -(1/3)*N[E2[tau], 50]; f[x_, y_] := Re[WP[x, y] - L]; g[x_, y_] := Im[WP[x, y] - L]; V1 = Quiet[ FindRoot[{f[x, y] == 0, g[x, y] == 0}, {x, 0.8}, {y, 0.5}, WorkingPrecision -> 50]]; V2 = Quiet[ FindRoot[{f[x, y] == 0, g[x, y] == 0}, {x, 1.2}, {y, 1.5}, WorkingPrecision -> 50]]; V3 = Quiet[ FindRoot[{f[x, y] == 0, g[x, y] == 0}, {x, 0.8}, {y, -1.5}, WorkingPrecision -> 50]]; V4 = Quiet[ FindRoot[{f[x, y] == 0, g[x, y] == 0}, {x, 1.2}, {y, -0.5}, WorkingPrecision -> 50]]; A1 = x /. V1; B1 = y /. V1; A2 = x /. V2; B2 = y /. V2; A3 = x /. V3; B3 = y /. V3; A4 = x /. V4; B4 = y /. V4; Z1 = Quiet[N[z[w1*A1 + w2*B1], 50]] Z2 = Quiet[N[z[w1*A2 + w2*B2], 50]] Z3 = Quiet[N[z[w1*A3 + w2*B3], 50]] Z4 = Quiet[N[z[w1*A4 + w2*B4], 50]] m = (Im[Z1] - Im[Z2])/((Re[Z1] - Re[Z2])); Zed[x_?NumericQ, y_?NumericQ] := z[w1*x + w2*y]; Quiet[ContourPlot[{Im[ N[Zed[x, y]]] - (m*(Re[N[Zed[x, y]]] - Re[(M/2)]) - Im[M/2]) == 0}, {x, 0, 2}, {y, -4, 4}, MeshFunctions -> {#3 &}, MeshStyle -> {{Thick, Blue}}, Mesh -> {{0}}, PlotStyle -> Directive[Orange, Opacity[0.1], Specularity[White, 30]], PlotPoints -> 75, WorkingPrecision -> 50, ClippingStyle -> None], RegionFunction -> Function[{x, y}, Abs[Zed[x, y] - M/2] <= Abs[Z2 - M/2]]]

The last part of the script is where I attempt to use RegionFunction in ContourPlot. The error I get is something to the effect of "Argument 2 of....should be All, None, a message name, or a list of message names."

Can anyone see where I'm going so wrong here? Thanks in advance!

$\endgroup$
  • $\begingroup$ Why did you feed RegionFunction to Quiet[]? $\endgroup$ – J. M. will be back soon Jul 26 '16 at 2:27
  • $\begingroup$ @J.M. I had the Quiet there before as I thought it's only purpose was to suppress any tolerable error messages. I just removed the Quiet and got a single, but different error this time; it says: "...is incomplete, more input it needed." In addition, my entry of PlotStyle is highlighted red. Any idea what input I'm missing here? $\endgroup$ – Benighted Jul 26 '16 at 2:32
  • 1
    $\begingroup$ Here's a quick way of checking: triple-click the symbol ContourPlot in your notebook to check if you're passing options to the right function. $\endgroup$ – J. M. will be back soon Jul 26 '16 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.