7
$\begingroup$

I want to accurately discretize the implicit equation $x^2+x+y^2+\sin(4xy)+\sin(3xy)=3.9$.

To get the whole discretized shape, I'm forced to use oversized bounds {x,-70,80} and {y,-70,80}

curve = DiscretizeRegion[
  ImplicitRegion[
   x^2 + x + y^2 + Sin[4*x*y] + Sin[3*x* y] == 
    3.9, {{x, -80, 70}, {y, -80, 70}}]]

enter image description here

If I reasonable bounds such as {x,-3,3} and {y,-3,3}, I get the following.

enter image description here

What adjustments can be made and how will this improve the accuracy?

$\endgroup$
4
  • 1
    $\begingroup$ {{x, -5, 5}, {y, -5, 5}} $\endgroup$ Dec 27, 2017 at 20:04
  • $\begingroup$ @DavidG.Stork How come this works but the others don't. $\endgroup$
    – Arbuja
    Dec 27, 2017 at 20:12
  • $\begingroup$ (I'm new to Mathematica; sorry if this is a silly question.) Why do you have x^2 + x + y^2 in your code but just $x^2 + y^2$ in the equation at the top of your answer? Why the extra x term? $\endgroup$ Dec 28, 2017 at 1:55
  • 1
    $\begingroup$ @Nodon'tshownmyrealname Because I'm careless! I edited the question. $\endgroup$
    – Arbuja
    Dec 28, 2017 at 2:04

3 Answers 3

5
$\begingroup$

Give DiscretizeRegion a second argument specifying bounds:

DiscretizeRegion[
    ImplicitRegion[
        x^2+x+y^2+Sin[4*x*y]+Sin[3*x*y]==3.9,
        {{x,-3,3},{y,-3,3}}
    ],
    {{-3,3},{-3,3}}
]

enter image description here

$\endgroup$
1
  • $\begingroup$ ah.. note if you do RegionBounds on the intermediate ImplicitRegion it returns an incorrect result. $\endgroup$
    – george2079
    Dec 27, 2017 at 22:02
5
$\begingroup$

making that parameter exact seems to fix things:

curve = DiscretizeRegion[
  ImplicitRegion[
   x^2 + x + y^2 + Sin[4*x*y] + Sin[3*x*y] == 
    39/10, {{x, -3, 3}, {y, -3, 3}}]]

enter image description here

note with the exact parameter and your origial "oversize" bounds you get a poor discretisation:

enter image description here

( remedied with MaxElementSize , etc )

$\endgroup$
3
  • $\begingroup$ I tried your code but I doesn't give the full picture. $\endgroup$
    – Arbuja
    Dec 27, 2017 at 20:56
  • $\begingroup$ For some reason only entering {x,-5,5} and {y,-5,-5} works. $\endgroup$
    – Arbuja
    Dec 27, 2017 at 21:00
  • 1
    $\begingroup$ there seems to be a version issue. Works for me with 10.1 , not with 11.1. $\endgroup$
    – george2079
    Dec 27, 2017 at 21:15
3
$\begingroup$
DiscretizeRegion[
  ImplicitRegion[
  x^2 + x + y^2 + Sin[4 x y] + Sin[3 x y] == 3.9, 
  {{x, -5, 5}, {y, -5, 5}}],
  AccuracyGoal -> 8]

enter image description here

$\endgroup$
1
  • $\begingroup$ How come {x,-5,5} and {x,-5,5} works but not {-4,3} and {-3,3} does not work. $\endgroup$
    – Arbuja
    Dec 27, 2017 at 20:11

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.