Talk:Railway circuit: Difference between revisions

m
no edit summary
mNo edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 47:
 
--[[User:G.Brougnard|G.Brougnard]] ([[User talk:G.Brougnard|talk]]) 08:33, 5 April 2016 (UTC)
 
 
 
: Thank you. I didn't have the two first ones, with the overlapping tracks. So now I do have 35 for C24 based on i + 6 symmetry. I've found 5 additional solutions, however, based on a 3-way symmetry of i + 4. They look valid to me, unless I've misunderstood the criteria:
Line 206 ⟶ 208:
::: Why eliminate a mirror image if it is not identical to its other-handed version? --[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 17:17, 5 July 2022 (UTC)
:::: Because the task specifically requires it: "Duplicates, either by symmetry, translation, '''reflexion,''' or rotation must be eliminated." --[[User:Katzenbaer|Katzenbaer]] ([[User talk:Katzenbaer|talk]]) 21:50, 5 July 2022 (UTC)
 
::::: Interesting. I would usually say that this is a duplicate by reflection:
<pre>
###
#
###
#
###
 
###
#
###
#
###
</pre>
::::: but this is not:
<pre>
###
#
###
#
##
 
###
#
###
#
##
</pre>
::::: because the two are different on the plane (not in 3D). I wonder what the task author meant. --[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 22:03, 5 July 2022 (UTC)
:::::: I would think duplicate by reflection is pretty unambiguous. In your examples, the first pair are already identical under rotation, so if the second pair were not considered duplicates by reflection, then why do we even have that term at all? --[[User:Katzenbaer|Katzenbaer]] ([[User talk:Katzenbaer|talk]]) 22:50, 5 July 2022 (UTC)
::::::: A right handed fur-lined glove can have a duplicate by rotation that is an exact duplicate. But it is not an exact duplicate of a left handed fur-lined glove, is it? I do understand your reading.--[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 23:13, 5 July 2022 (UTC)
:::::::: You are confusing "A becomes the same as B after reflection" with "A remains the same after reflection". A left handed glove looks like a right handed one in a mirror, no? You seem to suggest the task wants us to remove each solution that's its own mirror image, otherwise what's the distinction between "reflexion" and "rotation" in the wording in your opinion? --[[User:Katzenbaer|Katzenbaer]]
::::::::: I also eliminated reflections that way (negation) in my much older code version, but today I wondered if we should; my `simulation intuitions` today tell me that in the model railroading world a reflection is probably considered a different layout if the links along the tracks are directed, so that since right and left curved sections are not interchangeable different numbers of components would be required. But ok, the task specifies it.
 
([[User talk:Katzenbaer|talk]]) 04:24, 6 July 2022 (UTC)
 
Minimum example code showing the correct math for validity check. This code doesn't filter out duplicates and is of course horribly slow.
<lang python>from itertools import product, accumulate
from cmath import pi, exp
 
N = 12 # defines size of each turn; 12 means 30 degrees, but other turn angles work, too
ANGLE = 2*pi/N
 
# 1: right; 0: straight; -1: left. Generates all combinations of them at given length.
sequences = lambda n: product(*([(1, 0, -1)]*n))
 
# Check the track combination is valid.
# This treatment requires the straight segment length equal the chord lengths of the arcs,
# otherwise the math is MUCH more complicated.
def valid(s):
# a is the right turn count after each step
a = tuple(accumulate(s))
# "< 1e-6" really should have been "== 0" but for numerical precision
return a[-1]%N == 0 and abs(sum(exp(x*1j*ANGLE) for x in a)) < 1e-6
 
for n in [12, 14]:
print(f'{n} tracks:')
for s in sequences(n):
if valid(s):
print(s)</lang>
4,102

edits