Hi Udo,
thank you. This comes already pretty close to what I am looking
for. I tried 60 times
rosebrockShot[10]
without getting one example. It might need too long time (years) to
find examples with 22 crossings or more.
Best wishes
Stephan
Quoting Udo und Susanne Krause <su.krause@XXXXXXX.ch>:
Hello Stephan,
this
a shot into the wild
In[8]:= TimeConstrained[ DrawPD[DTCode[2 RandomInteger[{1, 32},
{36}]], {Gap -> 0.025}], 180]
is bullshit, because DT codes are permutations, not just
RandomIntegers[]; something like that does a structural correct -
but still wildly uneducated - guess
In[75]:= messageHandler = If[Last[#], Abort[]] &
Internal`AddHandler["Message", messageHandler]
Out[75]= If[Last[#1], Abort[]] &
In[92]:= Clear[rosebrockShot]
rosebrockShot[o_Integer?Positive] :=
Block[{l0 = Flatten @@ RandomPermutation[o], l1},
l0 = Join[Complement[Range[o], l0], l0];
l1 = 2 (((RandomInteger[{-1, 0}, o]) /. 0 -> 1) l0);
Print[l1];
TimeConstrained[DrawPD[DTCode[l1, {Gap -> 0.025}]], 180]
]
In[94]:= rosebrockShot[36]
During evaluation of In[94]:=
{44,2,16,-4,-68,72,32,10,-30,-22,62,34,28,18,-52,56,-36,-38,-12,-40,6,14,46,54,26,-20,-66,-60,-8,58,24,-64,42,-70,-48,50}
During evaluation of In[94]:= System`Part::partw: Part 2 of
GaussCode[DTCode[44,2,16,-4,-68,72,32,10,-30,-22,62,34,28,18,-52,56,-36,-38,-12,-40,6,14,46,54,26,-20,-66,-60,-8,58,24,-64,42,-70,-48,50,Gap->0.025]] does not exist.
>>
Out[94]= $Aborted
the idea how to Abort[] on the very first message came from
https://mathematica.stackexchange.com/questions/1512/how-to-abort-on-any-message-generated
and for minimal efficency one should store unsuccessful input
(e.g. as a list of their SHA hashes)
In[101]:= Hash[{44, 2, 16, -4, -68, 72, 32, 10, -30, -22, 62, 34, 28,
18, -52, 56, -36, -38, -12, -40, 6, 14, 46, 54,
26, -20, -66, -60, -8, 58, 24, -64, 42, -70, -48, 50}, "SHA"]
Out[101]= 49040125303340877648603157613185174793122282112
to avoid these in further tests.
Regards
Udo.
*********************************************************
Dr. Stephan Rosebrock
Paedagogische Hochschule Karlsruhe
Bismarckstr. 10
76133 Karlsruhe
Deutschland / Germany
e-mail: rosebrock@XXXXXXX.de
Homepage: http://www.rosebrock.ph-karlsruhe.de/
Tel: 0721-925-4275
Fax: 0721-925-4249
*********************************************************
_______________________________________________
DMUG Deutschsprachiges Mathematica-Forum demug@XXXXXXX.ch
http://www.mathematica.ch/mailman/listinfo/demug
Archiv: http://www.mathematica.ch/archiv.html