1
$\begingroup$

I has implicit function and square region. I need to check this region for presence of part of curve, with interval arithmetic only.

My attempt:

ClearAll["Global`*"];
f[a_Interval, b_Interval] := Sin[a + b] - Cos[a*b] + 1;
s = 1.1;(*Square size*)
cx = -3.9; (*Square center x*)
cy = -1.2; (*Square center y*)

x = Interval[{cx - s/2, cx + s/2}];
y = Interval[{cy - s/2, cy + s/2}];

IntervalMemberQ[f[x, y], 0]

Does this code are correctly solve the problem?

Update: I need to get a false if the curve is guaranteed not in the specified square(include inner area). But true value cannot guaranteed the opposite

$\endgroup$
5
  • $\begingroup$ BTW, AroundReplace[ Sin[a + b] - Cos[a*b] + 1, {a -> Around[-3.9, 0.55], b -> Around[-1.2, 0.55]}] performs a worser result Around[2,2.5]. $\endgroup$
    – user64494
    Commented Nov 22, 2019 at 20:19
  • $\begingroup$ The implicit curve is given by f[a,b]==0? And you want to determine whether f[square1,square2] hits zero? $\endgroup$ Commented Nov 23, 2019 at 16:17
  • $\begingroup$ The above code giving False is sufficient but not necessary condition for the square in question to contain no zero. Changing s to 2.0, for example, will give a result of True when in fact this larger square still contains no zero. $\endgroup$ Commented Nov 24, 2019 at 16:55
  • $\begingroup$ @DanielLichtblau I need to get a false if the curve is guaranteed not in the specified square(include inner area). But true value cannot guaranteed the opposite. $\endgroup$
    – PavelDev
    Commented Nov 24, 2019 at 17:02
  • 1
    $\begingroup$ A False is a guarantee of no intersection. So if that is all you require, the code is fine for that purpose. $\endgroup$ Commented Nov 24, 2019 at 17:04

2 Answers 2

1
$\begingroup$

Likely correctly in view of

NMinimize[{Sin[a + b] - Cos[a*b] + 1, a >= -3.9 - 0.55&& a <= -3.9 + 0.55 && b >= -1.2 - 0.55 &&   
 b <= -1.2 + 0.55}, {a, b}]

{0.38735,{a->-4.45,b->-1.4593}}

$\endgroup$
1
$\begingroup$

The function does not achieve a zero within the square (as is supported byNMinimize.

reg = ImplicitRegion[Abs[x + 3.9] < 0.55 &&Abs[y + 1.2] < 0.55, {{x, -5, 0}, {y, -2, 0}}];
Show[ContourPlot[f[x, y] == 0, {x, -5, 0}, {y, -5, 0}],RegionPlot[reg]]

enter image description here

Or it can be seen by plotting region and plane z=0:

{m, w} = NMinimize[f[x, y], {x, y} \[Element] reg];
pnt = {Sequence[x, y], m} /. w;
Show[Plot3D[{f[x, y], 0}, {x, y} \[Element] reg, Mesh -> None], 
 Graphics3D[{Red, PointSize[0.02], Point[{-3.9, -1.2, f[-3.9, -1.2]}],
    Green, Point[pnt]}]]

enter image description here

$\endgroup$
1
  • $\begingroup$ I updated my question, please take a look $\endgroup$
    – PavelDev
    Commented Nov 24, 2019 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.