2
$\begingroup$

For a table of x,y,z data points:

{{0.9999, 0.9999, 1000}, {0.9999, 0.99991, 1000}, {0.9999, 0.99992, 
  1000},...., {1.0001, 1.00008, 50}, {1.0001, 1.00009, 50}, {1.0001, 1.0001, 
  1000}}

z=A006577(n) at x=y=1, has the same value for z in a rectangular pattern on x and y, where the rectangle is centered on x=y=1 (where n=startN=stopN). Is there a way to find the length and width for this rectangle? Or the number of x and y points that share the same z value for this rectangle? Here is the code that shows the central rectangle, with a length of 9 points and width of 5 points:

collatzStuffC = 
  Compile[{{c1, _Real}, {c2, _Real}, {nStart, _Integer}, {nStop, \
_Integer}, {maxStepsToCheck, _Integer}}, 
   Module[{stepsForEachN = Table[-1, {i, nStop - nStart}], 
     stepsForEachNIndex = Table[-1, {i, nStop - nStart}], n = -1, 
     m = -1}, Table[n = x;
     Table[
      If[n < 2 && i > 1, {-1, -1, -1}, 
       If[EvenQ[n], n = Round[(n/2)*c1], n = Round[(3*n + 1)*c2]];
       m = i;
       {x, m, n}], {i, maxStepsToCheck}], {x, nStart, nStop}]]];
Options[collatzData] = {"Coefficient1" -> 1, "Coefficient2" -> 1, 
   "Start" -> 1, "Stop" -> 10, "MaxIterations" -> 100};
collatzData[OptionsPattern[]] := 
  collatzStuffC @@ 
   OptionValue[{"Coefficient1", "Coefficient2", "Start", "Stop", 
     "MaxIterations"}];
collatzStuff[ops : OptionsPattern[]] := 
 With[{cd = 
    collatzData[
     ops]},(*this is just a bunch of vectorized junk to pull the last \
position before the {-1,-1,-1}*)
  Extract[cd, 
   Developer`ToPackedArray@
    Join[ArrayReshape[Range[Length@cd], {Length@cd, 1}], 
     Pick[ConstantArray[Range[Length@cd[[1]]], Length@cd], 
       UnitStep[cd[[All, All, 1]]], 1][[All, {-1}]], 2]]]

plots3Dlist = {};
startN = 2002;
stopN = 2002;
c1min = 0.9999;
c1max = 1.0001;
c2min = 0.9999;
c2max = 1.0001;
c1step = 0.00001;
c2step = 0.00001;
maxIterations = 1000;
For[abc = startN, abc <= stopN, abc++, 
 Print[StringForm["loop counter `` of ``", abc - startN, 
   stopN - startN]];
 thisIsATable = 
  Table[{c1, c2, 
     collatzStuff["Coefficient1" -> c1, "Coefficient2" -> c2, 
       "Start" -> abc, "Stop" -> abc, 
       "MaxIterations" -> maxIterations][[1, 2]]}, {c1, c1min, c1max, 
     c1step}, {c2, c2min, c2max, c2step}] // Flatten[#, 1] &;
 AppendTo[plots3Dlist, 
  ListPointPlot3D[thisIsATable, PlotRange -> All]]]
plots3Dlist
thisIsATable

This code is from the other question here:

solve for two variables for each n related to Collatz conjecture

I'd like to find the length and width of the rectangle for multiple graphs, and then compare the length and widths to see if there is a pattern.

Here is a picture of the rectangle from the above code with the outline marked.

enter image description here

$\endgroup$
4
  • $\begingroup$ Looking at the picture, I can't tell quite what you mean by length and width. Is it the length and width of the bounding box of the points? $\endgroup$
    – C. E.
    Sep 16 '19 at 21:24
  • $\begingroup$ Hi, yes and the point distance is given by c1step and c2step which in this case are the same = 0.00001, so for a 9 by 5 point bounding box it would be (0.00001*(5-1)) for the length of one side and (0.00001*(9-1)) for the length of the long side of the rectangle. I'm not sure how to find the 5 and 9 values. $\endgroup$
    – Jamie M
    Sep 17 '19 at 0:12
  • $\begingroup$ Hi, I was thinking about that question a bit more and I guess the most accurate size of the rectangle would maybe use solve or some other technique to find accurate values where the corners are, given by where the value of z changes. $\endgroup$
    – Jamie M
    Sep 17 '19 at 5:45
  • $\begingroup$ Some of the graphs appear to have rectangles with infinite length, but I think all graphs have bounded width of the rectangles, so the width might be the only number that is needed, but identifying the numbers that have infinite length rectangles would be good too. $\endgroup$
    – Jamie M
    Sep 17 '19 at 6:55

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.