%x

%x

%x

%x

%x

%x

%x

%x

%x

%x

x

xmax = 11.050869237730442
xmin = -11.121878681354275
x1 = -4
x2 = 5
nIntervals = 10 (slider from 1 to 10, step 1)
dx: (x2 - x1) / nIntervals
P31_sub = (-5.6117524589177155, 2.171501606395112)
f(x) = x^(3) / 3 - (3 * x) + 10
xscale: xmax - xmin
threshold = 0.03
xP31snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P31_sub) - x1) / dx))])
threshold_x: (threshold * xscale)
xP31snapped = If(x(P31_sub) > xmax, xmax, If[x(P31_sub)  <  xmin, xmin, If[abs(x(P31_sub) - xP31snapped_a)  <  threshold_x, xP31snapped_a, x(P31_sub)]])
ymax = 23.85266727917159
ymin = -5.486101588670623
yscale: ymax - ymin
threshold_y: (threshold * yscale)
P12_sub = (5.18809493705794, 0.6953371350571392)
xP12snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P12_sub) - x1) / dx))])
xP12snapped = If(x(P12_sub) > xmax, xmax, If[x(P12_sub)  <  xmin, xmin, If[abs(x(P12_sub) - xP12snapped_a)  <  threshold_x, xP12snapped_a, x(P12_sub)]])
P11_sub = (6.8190922988991645, 1.248898811808879)
xP11snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P11_sub) - x1) / dx))])
xP11snapped = If(x(P11_sub) > xmax, xmax, If[x(P11_sub)  <  xmin, xmin, If[abs(x(P11_sub) - xP11snapped_a)  <  threshold_x, xP11snapped_a, x(P11_sub)]])
LL = Corner(1)
UR = Corner(3)
P12 = DynamicCoordinates(P12_sub, xP12snapped, 0)
P11 = DynamicCoordinates(P11_sub, xP11snapped, If[y(P11_sub) > ymax, ymax, If[y(P11_sub)  <  ymin, ymin, If[abs(y(P11_sub) - f(xP11snapped))  <  threshold_y, f(xP11snapped), y(P11_sub)]]])
rect1, s1a, s1b, s1c, s1d = Polygon(P11, (x(P11), y(P12)), P12, (x(P12), y(P11)))
P21_sub = (-1.820785617881362, 1.8947207680192422)
xP21snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P21_sub) - x1) / dx))])
xP21snapped = If(x(P21_sub) > xmax, xmax, If[x(P21_sub)  <  xmin, xmin, If[abs(x(P21_sub) - xP21snapped_a)  <  threshold_x, xP21snapped_a, x(P21_sub)]])
P21 = DynamicCoordinates(P21_sub, xP21snapped, If[y(P21_sub) > ymax, ymax, If[y(P21_sub)  <  ymin, ymin, If[abs(y(P21_sub) - f(xP21snapped))  <  threshold_y, f(xP21snapped), y(P21_sub)]]])
P22_sub = (0.8240749688881869, 0.3262960172226458)
xP22snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P22_sub) - x1) / dx))])
xP22snapped = If(x(P22_sub) > xmax, xmax, If[x(P22_sub)  <  xmin, xmin, If[abs(x(P22_sub) - xP22snapped_a)  <  threshold_x, xP22snapped_a, x(P22_sub)]])
P22 = DynamicCoordinates(P22_sub, xP22snapped, 0)
rect2, s2d, s2a, s2b, s2c = Polygon(P21, (x(P21), y(P22)), P22, (x(P22), y(P21)))
P32_sub = (-8.52109910436422, 0.14177545830539917)
xP32snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P32_sub) - x1) / dx))])
xP32snapped = If(x(P32_sub) > xmax, xmax, If[x(P32_sub)  <  xmin, xmin, If[abs(x(P32_sub) - xP32snapped_a)  <  threshold_x, xP32snapped_a, x(P32_sub)]])
P31 = DynamicCoordinates(P31_sub, xP31snapped, If[y(P31_sub) > ymax, ymax, If[y(P31_sub)  <  ymin, ymin, If[abs(y(P31_sub) - f(xP31snapped))  <  threshold_y, f(xP31snapped), y(P31_sub)]]])
P32 = DynamicCoordinates(P32_sub, xP32snapped, 0)
rect3, s3c, s3a, s3d, s3b = Polygon(P31, (x(P31), y(P32)), P32, (x(P32), y(P31)))
P41_sub = (7.700712494489014, 13.334995420888534)
xP41snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P41_sub) - x1) / dx))])
xP41snapped = If(x(P41_sub) > xmax, xmax, If[x(P41_sub)  <  xmin, xmin, If[abs(x(P41_sub) - xP41snapped_a)  <  threshold_x, xP41snapped_a, x(P41_sub)]])
P41 = DynamicCoordinates(P41_sub, xP41snapped, If[y(P41_sub) > ymax, ymax, If[y(P41_sub)  <  ymin, ymin, If[abs(y(P41_sub) - f(xP41snapped))  <  threshold_y, f(xP41snapped), y(P41_sub)]]])
P42_sub = (6.8190922988991645, -0.780827336280834)
xP42snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P42_sub) - x1) / dx))])
xP42snapped = If(x(P42_sub) > xmax, xmax, If[x(P42_sub)  <  xmin, xmin, If[abs(x(P42_sub) - xP42snapped_a)  <  threshold_x, xP42snapped_a, x(P42_sub)]])
P42 = DynamicCoordinates(P42_sub, xP42snapped, 0)
rect4, s4c, s4a, s4d, s4b = Polygon(P41, (x(P41), y(P42)), P42, (x(P42), y(P41)))
P51_sub = (4.923608878380988, 8.076159491747005)
xP51snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P51_sub) - x1) / dx))])
xP51snapped = If(x(P51_sub) > xmax, xmax, If[x(P51_sub)  <  xmin, xmin, If[abs(x(P51_sub) - xP51snapped_a)  <  threshold_x, xP51snapped_a, x(P51_sub)]])
P51 = DynamicCoordinates(P51_sub, xP51snapped, If[y(P51_sub) > ymax, ymax, If[y(P51_sub)  <  ymin, ymin, If[abs(y(P51_sub) - f(xP51snapped))  <  threshold_y, f(xP51snapped), y(P51_sub)]]])
P52_sub = (4.350555751247586, -0.042745100611847484)
xP52snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P52_sub) - x1) / dx))])
xP52snapped = If(x(P52_sub) > xmax, xmax, If[x(P52_sub)  <  xmin, xmin, If[abs(x(P52_sub) - xP52snapped_a)  <  threshold_x, xP52snapped_a, x(P52_sub)]])
P52 = DynamicCoordinates(P52_sub, xP52snapped, 0)
rect5, s5c, s5a, s5d, s5b = Polygon(P51, (x(P51), y(P52)), P52, (x(P52), y(P51)))
P61_sub = (-2.922810862368674, 14.718899612767883)
xP61snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P61_sub) - x1) / dx))])
xP61snapped = If(x(P61_sub) > xmax, xmax, If[x(P61_sub)  <  xmin, xmin, If[abs(x(P61_sub) - xP61snapped_a)  <  threshold_x, xP61snapped_a, x(P61_sub)]])
P61 = DynamicCoordinates(P61_sub, xP61snapped, If[y(P61_sub) > ymax, ymax, If[y(P61_sub)  <  ymin, ymin, If[abs(y(P61_sub) - f(xP61snapped))  <  threshold_y, f(xP61snapped), y(P61_sub)]]])
P62_sub = (-2.3497577352352743, 0.32629601722264584)
xP62snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P62_sub) - x1) / dx))])
xP62snapped = If(x(P62_sub) > xmax, xmax, If[x(P62_sub)  <  xmin, xmin, If[abs(x(P62_sub) - xP62snapped_a)  <  threshold_x, xP62snapped_a, x(P62_sub)]])
P62 = DynamicCoordinates(P62_sub, xP62snapped, 0)
rect6, s6c, s6a, s6d, s6b = Polygon(P61, (x(P61), y(P62)), P62, (x(P62), y(P61)))
P71_sub = (0.4714268906522446, 8.260680050664252)
xP71snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P71_sub) - x1) / dx))])
xP71snapped = If(x(P71_sub) > xmax, xmax, If[x(P71_sub)  <  xmin, xmin, If[abs(x(P71_sub) - xP71snapped_a)  <  threshold_x, xP71snapped_a, x(P71_sub)]])
P71 = DynamicCoordinates(P71_sub, xP71snapped, If[y(P71_sub) > ymax, ymax, If[y(P71_sub)  <  ymin, ymin, If[abs(y(P71_sub) - f(xP71snapped))  <  threshold_y, f(xP71snapped), y(P71_sub)]]])
P72_sub = (1.1350187464722596, 0.7875974145157677)
xP72snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P72_sub) - x1) / dx))])
xP72snapped = If(x(P72_sub) > xmax, xmax, If[x(P72_sub)  <  xmin, xmin, If[abs(x(P72_sub) - xP72snapped_a)  <  threshold_x, xP72snapped_a, x(P72_sub)]])
P72 = DynamicCoordinates(P72_sub, xP72snapped, 0)
rect7, s7c, s7a, s7d, s7b = Polygon(P71, (x(P71), y(P72)), P72, (x(P72), y(P71)))
P81_sub = (2.3669103111704213, 6.969036138243526)
xP81snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P81_sub) - x1) / dx))])
xP81snapped = If(x(P81_sub) > xmax, xmax, If[x(P81_sub)  <  xmin, xmin, If[abs(x(P81_sub) - xP81snapped_a)  <  threshold_x, xP81snapped_a, x(P81_sub)]])
P81 = DynamicCoordinates(P81_sub, xP81snapped, If[y(P81_sub) > ymax, ymax, If[y(P81_sub)  <  ymin, ymin, If[abs(y(P81_sub) - f(xP81snapped))  <  threshold_y, f(xP81snapped), y(P81_sub)]]])
P82_sub = (3.2485305067602708, 0.2340357377640225)
xP82snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P82_sub) - x1) / dx))])
xP82snapped = If(x(P82_sub) > xmax, xmax, If[x(P82_sub)  <  xmin, xmin, If[abs(x(P82_sub) - xP82snapped_a)  <  threshold_x, xP82snapped_a, x(P82_sub)]])
P82 = DynamicCoordinates(P82_sub, xP82snapped, 0)
rect8, s8d, s8a, s8c, s8b = Polygon(P81, (x(P81), y(P82)), P82, (x(P82), y(P81)))
P91_sub = (-3.5665735753219328, 1.3411590912675075)
xP91snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P91_sub) - x1) / dx))])
xP91snapped = If(x(P91_sub) > xmax, xmax, If[x(P91_sub)  <  xmin, xmin, If[abs(x(P91_sub) - xP91snapped_a)  <  threshold_x, xP91snapped_a, x(P91_sub)]])
P91 = DynamicCoordinates(P91_sub, xP91snapped, If[y(P91_sub) > ymax, ymax, If[y(P91_sub)  <  ymin, ymin, If[abs(y(P91_sub) - f(xP91snapped))  <  threshold_y, f(xP91snapped), y(P91_sub)]]])
P92_sub = (-2.793285364500519, -0.13500538007046556)
xP92snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P92_sub) - x1) / dx))])
xP92snapped = If(x(P92_sub) > xmax, xmax, If[x(P92_sub)  <  xmin, xmin, If[abs(x(P92_sub) - xP92snapped_a)  <  threshold_x, xP92snapped_a, x(P92_sub)]])
P92 = DynamicCoordinates(P92_sub, xP92snapped, 0)
rect9, s9c, s9a, s9d, s9b = Polygon(P91, (x(P91), y(P92)), P92, (x(P92), y(P91)))
nRectangles = 1 (slider from 1 to 10, step 1)
side = 0
P91xind = If(x(P91) ≟ xP91snapped, (x(P91) - x1) / dx, -1)
P92xind = If(x(P92) ≟ xP92snapped, (x(P92) - x1) / dx, -1)
P81xind = If(x(P81) ≟ xP81snapped, (x(P81) - x1) / dx, -1)
P82xind = If(x(P82) ≟ xP82snapped, (x(P82) - x1) / dx, -1)
P71xind = If(x(P71) ≟ xP71snapped, (x(P71) - x1) / dx, -1)
P72xind = If(x(P72) ≟ xP72snapped, (x(P72) - x1) / dx, -1)
P61xind = If(x(P61) ≟ xP61snapped, (x(P61) - x1) / dx, -1)
P62xind = If(x(P62) ≟ xP62snapped, (x(P62) - x1) / dx, -1)
P51xind = If(x(P51) ≟ xP51snapped, (x(P51) - x1) / dx, -1)
P52xind = If(x(P52) ≟ xP52snapped, (x(P52) - x1) / dx, -1)
P41xind = If(x(P41) ≟ xP41snapped, (x(P41) - x1) / dx, -1)
P42xind = If(x(P42) ≟ xP42snapped, (x(P42) - x1) / dx, -1)
P31xind = If(x(P31) ≟ xP31snapped, (x(P31) - x1) / dx, -1)
P32xind = If(x(P32) ≟ xP32snapped, (x(P32) - x1) / dx, -1)
P21xind = If(x(P21) ≟ xP21snapped, (x(P21) - x1) / dx, -1)
P22xind = If(x(P22) ≟ xP22snapped, (x(P22) - x1) / dx, -1)
P11xind = If(x(P11) ≟ xP11snapped, (x(P11) - x1) / dx, -1)
P12xind = If(x(P12) ≟ xP12snapped, (x(P12) - x1) / dx, -1)
rect09ind = If((nRectangles ≥ 9) ∧ y(P91) ≟ f(x(P91)), If[side ≟ 1, If[P91xind ≟ P92xind + 1, P91xind, -1], If[P92xind ≟ P91xind + 1, P92xind, -1]], -1)
rect08ind = If((nRectangles ≥ 8) ∧ y(P81) ≟ f(x(P81)), If[side ≟ 1, If[P81xind ≟ P82xind + 1, P81xind, -1], If[P82xind ≟ P81xind + 1, P82xind, -1]], -1)
rect07ind = If((nRectangles ≥ 7) ∧ y(P71) ≟ f(x(P71)), If[side ≟ 1, If[P71xind ≟ P72xind + 1, P71xind, -1], If[P72xind ≟ P71xind + 1, P72xind, -1]], -1)
rect06ind = If((nRectangles ≥ 6) ∧ y(P61) ≟ f(x(P61)), If[side ≟ 1, If[P61xind ≟ P62xind + 1, P61xind, -1], If[P62xind ≟ P61xind + 1, P62xind, -1]], -1)
rect05ind = If((nRectangles ≥ 5) ∧ y(P51) ≟ f(x(P51)), If[side ≟ 1, If[P51xind ≟ P52xind + 1, P51xind, -1], If[P52xind ≟ P51xind + 1, P52xind, -1]], -1)
rect04ind = If((nRectangles ≥ 4) ∧ y(P41) ≟ f(x(P41)), If[side ≟ 1, If[P41xind ≟ P42xind + 1, P41xind, -1], If[P42xind ≟ P41xind + 1, P42xind, -1]], -1)
rect03ind = If((nRectangles ≥ 3) ∧ y(P31) ≟ f(x(P31)), If[side ≟ 1, If[P31xind ≟ P32xind + 1, P31xind, -1], If[P32xind ≟ P31xind + 1, P32xind, -1]], -1)
rect02ind = If((nRectangles ≥ 2) ∧ y(P21) ≟ f(x(P21)), If[side ≟ 1, If[P21xind ≟ P22xind + 1, P21xind, -1], If[P22xind ≟ P21xind + 1, P22xind, -1]], -1)
rect01ind = If((nRectangles ≥ 1) ∧ y(P11) ≟ f(x(P11)), If[side ≟ 1, If[P11xind ≟ P12xind + 1, P11xind, -1], If[P12xind ≟ P11xind + 1, P12xind, -1]], -1)
P01_sub = (9.552114905227699, 3.555405798274462)
P02_sub = (8.934980768314801, 0.32629601722264584)
xP01snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P01_sub) - x1) / dx))])
xP01snapped = If(x(P01_sub) > xmax, xmax, If[x(P01_sub)  <  xmin, xmin, If[abs(x(P01_sub) - xP01snapped_a)  <  threshold_x, xP01snapped_a, x(P01_sub)]])
xP02snapped_a = Max(xmin, Min[xmax, x1 + (dx * round((x(P02_sub) - x1) / dx))])
xP02snapped = If(x(P02_sub) > xmax, xmax, If[x(P02_sub)  <  xmin, xmin, If[abs(x(P02_sub) - xP02snapped_a)  <  threshold_x, xP02snapped_a, x(P02_sub)]])
P01 = DynamicCoordinates(P01_sub, xP01snapped, If[y(P01_sub) > ymax, ymax, If[y(P01_sub)  <  ymin, ymin, If[abs(y(P01_sub) - f(xP01snapped))  <  threshold_y, f(xP01snapped), y(P01_sub)]]])
P02 = DynamicCoordinates(P02_sub, xP02snapped, 0)
rect0, s0c, s0a, s0d, s0b = Polygon(P01, (x(P01), y(P02)), P02, (x(P02), y(P01)))
P01xind = If(x(P01) ≟ xP01snapped, (x(P01) - x1) / dx, -1)
P02xind = If(x(P02) ≟ xP02snapped, (x(P02) - x1) / dx, -1)
rect10ind = If((nRectangles ≥ 10) ∧ y(P01) ≟ f(x(P01)), If[side ≟ 1, If[P01xind ≟ P02xind + 1, P01xind, -1], If[P02xind ≟ P01xind + 1, P02xind, -1]], -1)
rectangle09Correct: rect01ind ≟ 9 ∨ rect02ind ≟ 9 ∨ rect03ind ≟ 9 ∨ rect04ind ≟ 9 ∨ rect05ind ≟ 9 ∨ rect06ind ≟ 9 ∨ rect07ind ≟ 9 ∨ rect08ind ≟ 9 ∨ rect09ind ≟ 9 ∨ rect10ind ≟ 9
rectangle08Correct: rect01ind ≟ 8 ∨ rect02ind ≟ 8 ∨ rect03ind ≟ 8 ∨ rect04ind ≟ 8 ∨ rect05ind ≟ 8 ∨ rect06ind ≟ 8 ∨ rect07ind ≟ 8 ∨ rect08ind ≟ 8 ∨ rect09ind ≟ 8 ∨ rect10ind ≟ 8
rectangle07Correct: rect01ind ≟ 7 ∨ rect02ind ≟ 7 ∨ rect03ind ≟ 7 ∨ rect04ind ≟ 7 ∨ rect05ind ≟ 7 ∨ rect06ind ≟ 7 ∨ rect07ind ≟ 7 ∨ rect08ind ≟ 7 ∨ rect09ind ≟ 7 ∨ rect10ind ≟ 7
rectangle06Correct: rect01ind ≟ 6 ∨ rect02ind ≟ 6 ∨ rect03ind ≟ 6 ∨ rect04ind ≟ 6 ∨ rect05ind ≟ 6 ∨ rect06ind ≟ 6 ∨ rect07ind ≟ 6 ∨ rect08ind ≟ 6 ∨ rect09ind ≟ 6 ∨ rect10ind ≟ 6
rectangle05Correct: rect01ind ≟ 5 ∨ rect02ind ≟ 5 ∨ rect03ind ≟ 5 ∨ rect04ind ≟ 5 ∨ rect05ind ≟ 5 ∨ rect06ind ≟ 5 ∨ rect07ind ≟ 5 ∨ rect08ind ≟ 5 ∨ rect09ind ≟ 5 ∨ rect10ind ≟ 5
rectangle04Correct: rect01ind ≟ 4 ∨ rect02ind ≟ 4 ∨ rect03ind ≟ 4 ∨ rect04ind ≟ 4 ∨ rect05ind ≟ 4 ∨ rect06ind ≟ 4 ∨ rect07ind ≟ 4 ∨ rect08ind ≟ 4 ∨ rect09ind ≟ 4 ∨ rect10ind ≟ 4
rectangle03Correct: rect01ind ≟ 3 ∨ rect02ind ≟ 3 ∨ rect03ind ≟ 3 ∨ rect04ind ≟ 3 ∨ rect05ind ≟ 3 ∨ rect06ind ≟ 3 ∨ rect07ind ≟ 3 ∨ rect08ind ≟ 3 ∨ rect09ind ≟ 3 ∨ rect10ind ≟ 3
rectangle02Correct: rect01ind ≟ 2 ∨ rect02ind ≟ 2 ∨ rect03ind ≟ 2 ∨ rect04ind ≟ 2 ∨ rect05ind ≟ 2 ∨ rect06ind ≟ 2 ∨ rect07ind ≟ 2 ∨ rect08ind ≟ 2 ∨ rect09ind ≟ 2 ∨ rect10ind ≟ 2
rectangle01Correct: rect01ind ≟ 1 ∨ rect02ind ≟ 1 ∨ rect03ind ≟ 1 ∨ rect04ind ≟ 1 ∨ rect05ind ≟ 1 ∨ rect06ind ≟ 1 ∨ rect07ind ≟ 1 ∨ rect08ind ≟ 1 ∨ rect09ind ≟ 1 ∨ rect10ind ≟ 1
rectangle10Correct: rect01ind ≟ 10 ∨ rect02ind ≟ 10 ∨ rect03ind ≟ 10 ∨ rect04ind ≟ 10 ∨ rect05ind ≟ 10 ∨ rect06ind ≟ 10 ∨ rect07ind ≟ 10 ∨ rect08ind ≟ 10 ∨ rect09ind ≟ 10 ∨ rect10ind ≟ 10