English 中文(简体)
naive LFSR,将节目语言翻译成数学
原标题:naive LFSR, translate programming language to mathematics

存在数学问题,是产生独一无二的随机数量顺序的问题(单位数是N{0, ......, n },(如下调,但不使用记忆)

最近的一提问题解决了这一问题,我确实取得了一些成果(读了下文,没有使用正式数学,而只是通过方案拟订)。

看来,这个问题过去通过Galois或其他一些数学学家建造低地轨道(线性反馈转换登记册)而已经彻底解决。 (一) 表面上首先从欧洲原子能共同体中找到,而不是建立我的“那种”肥胖症,因为一味不理解欧洲原子能共同体关于维系的条款,而只是想照抄源代码......)

不要理解正式数学的字句,而要学习,比较一下我的解决办法,就是指:

我们可以比较一下我做些什么,而有些情况则将其转化为正式数学,反之亦然。 这样一来,人们就可以理解我做些什么,以及正式数学学家做了什么(为什么他们需要)?

remember my language is that of programming i only understand memory and its adressing, memory states, strings of zero and ones, etc. , and i don t understand primitive polynomials, field theory, and other math words.

事先非常感谢你,如果你能够帮助我,在看到你的时候,我会买你。

这里是我的代码表low(我可以把它放在浏览器上,而不用说是正确的,但一生的想法应当结束,即缺乏解决该问题的任何其他想法):

<html>
<head>
<script>

//-------------------------------------------------

function getPlacement( num ){ //; knuth permutations
  var places = [];

  for( var i = 0; i < num; ++i )
     places.push( i );

  var last_index = num-1;
  for( var i = num; i > 0; --i ){
    var rnd_index = Random( i );
    places = swap( places, rnd_index, last_index );
    last_index--;
  }

  return places;
}

function readNum( num, placement ){
   var numstr = num.toString(2);            
   numstr = zeroextend( numstr, placement.length ); 
   var numarr = numstr.split(  );           

   var ret = [];
   for( var i = 0; i < placement.length; ++i ){
      ret.push( numarr[ placement[i] ] );      
   }
   return ret.join(  );
}

function UniqRndSeq( maxLength, output ){

   var placesNeeded = maxLength.toString(2).length;
   var randomPlacement = getPlacement( placesNeeded );

   var initPosition = Random( maxLength );
   var cnt = initPosition;

   var rndn;
   var numret = [];

   do{
     rndn = parseInt( readNum( cnt, randomPlacement ), 2);
     output( rndn );

     if( Containz( numret, rndn ) ) alert(rndn); 
     numret.push(rndn);     

     ++cnt;
     cnt = cnt % maxLength;

   } while( cnt != initPosition );  

}

//-------------------------------------------------
//; helper funs
var outp = [];

function display( num ){
   outp.push( num + "<br>" );
}

function Random( x ){
   return Math.floor(Math.random()*x);
}

function Containz( arr, num ){
   for( var i = 0; i < arr.length; ++i ){
      if( arr[i] == num ) return true;
   }
   return false;
}

function swap( list, a, b ){
   var tmp = list[a];
   list[a] = list[b];
   list[b] = tmp;
   return list;
}

function zeroextend( num_bin_str, length ){
   while( num_bin_str.length != length ){
      num_bin_str = "0" + num_bin_str;
   } 
   return num_bin_str;
}

//-------------------------------------------------

function init(){
   UniqRndSeq( 256, display);
   document.body.innerHTML = outp.join(  );
}


</script>
</head>
<body onload="init();">

</body>
</html>
问题回答

在线反馈转换登记册(LFSR)是决定性的,即它没有使用任何类型的随机编号功能。 因此,您的法典不可能模仿低轨汇率。 如果你不了解有关多功能环形或有限实地理论的任何情况,那么很难解释低纬度线背后的数学。 然而,适当的低频辐射计会产生所谓的低频数字字数,即低频辐射计的阶段数。 序列长度为2^n,1字(零字不按顺序排列)。 总的说来,我们只关切按顺序的字句。 (在Galois LFSR中,这通常是公约规定的0轨,但所有轨道实际上都有相同的特性。) 从每一字中提取的单一轨道构成2^n-1年限序列,具有以下与随机有关的著名数学特性:

<>Balance Property: 1人按顺序排列,人数为0人,是序列方法的长度。 按顺序排列的1个数字实际上总是大于0个。 请注意,顺序长短不一,因此第1和0号不能相同。

<>Runs Property: 长度+1的长度为长度的一半。 长度等于或等于0分之一。

Correlation Property: The auto-correlation of the sequence approaches zero* as the length of the sequence approaches infinity [* more precisely, a Kronecker delta function]. That is, if one takes the sequence and compares it to itself shifed in time by t number of bits, where t is not equal to the sequence length, the number of bit positions where the comparison is equal is roughly equal to the number of positions where the comparison is unequal. What this means, essentially, is that sequence is devoid of periodic subsequences.

您可以比较贵法典的成果和这些特性,并就结果如何接近于算法独立作出自己的结论。





相关问题
How to add/merge several Big O s into one

If I have an algorithm which is comprised of (let s say) three sub-algorithms, all with different O() characteristics, e.g.: algorithm A: O(n) algorithm B: O(log(n)) algorithm C: O(n log(n)) How do ...

Grokking Timsort

There s a (relatively) new sort on the block called Timsort. It s been used as Python s list.sort, and is now going to be the new Array.sort in Java 7. There s some documentation and a tiny Wikipedia ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Enumerating All Minimal Directed Cycles Of A Directed Graph

I have a directed graph and my problem is to enumerate all the minimal (cycles that cannot be constructed as the union of other cycles) directed cycles of this graph. This is different from what the ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签