Skip to main content

Timeline for answer to Circular values with Mathematica by Craig Carter

Current License: CC BY-SA 4.0

Post Revisions

4 events
when toggle format what by license comment
Jun 9, 2025 at 8:00 comment added Ulrich Neumann @CraigCarter I think midpoint[{t1_, t2_}] := With[{dist = Abs[t1 - t2]}, Which[dist <= 1 - dist, {dist, Mean[{t1, t2}]}, True, {1 - dist, Mean[{t1, t2}] + 1/2}]] is the correct way. It fullfills Last@midpoint[{0.9,0.1}]==1 as lesobrod mentions.
Jun 9, 2025 at 7:32 comment added lesobrod Thank you, but Last@midpoint[{0.9,0.1}] is 0.9, but it's obviously 0 or 1
Jun 9, 2025 at 6:40 comment added Craig Carter Note: Compile optimizes code, so this circDist = Compile[{{t1, _Real}, {t2, _Real}}, With[{d = Abs[t1 - t2]}, Min[{d, 1 - d}]]] is a little faster.
Jun 9, 2025 at 6:35 history answered Craig Carter CC BY-SA 4.0