- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
周期序列是在 n 项后重复自身的序列,例如以下是周期序列:
1, 2, 3, 1, 2, 3, 1, 2, 3, ...
我们将该序列的周期定义为每个子序列中的项数(上面的子序列是 1、2、3)。所以上述序列的周期是 3。
在 R 中,我可以定义上述序列(尽管不是无穷大),使用:
sequence <- rep(c(1,2,3),n) #n is a predefined variable
n = 50
,
sequence
将是序列 1, 2, 3, 1, 2, 3, ... , 1, 2, 3,其中每个数字都以明显的方式出现了 50 次。
sequence
的周期.伪代码如下:
period <- function(sequence){
subsequence <- subsequence(sequence) #identify the subsequence
len.subsequence <- length(subsequence) #calculate its length
return(len.subsequence) #return it
}
rep
函数,这样我传入一个序列并传出初始向量的长度。
最佳答案
如果周期始终相同,即序列永远不会改变,那么您可以在 lag
上使用循环查看何时发生匹配。
对于完全偏差,我还建议使用 seqle
(猜猜那个函数是谁写的 :-) ),就像 rle
但找到序列。 detect intervals of the consequent integer sequences
我不是唯一一个以这种方式编辑“rle”源代码的人。
关于r - 测量数字序列的周期性 [R],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12824931/
我已经完成了创建和启动计时器的手册页。 http://man7.org/linux/man-pages/man2/timerfd_create.2.html 但是,除了 arm(start) 和 di
我正在用 opengl 编写新的代码库,很早就遇到了一个奇怪的错误。这是帧速率的明显波动,具有重复性和可预测性。 我知道它肯定与渲染的对象成正比。它也与屏幕大小成正比(不是视口(viewport)大小
我知道如何使用计算数组中点之间的欧几里得距离 scipy.spatial.distance.cdist 类似于这个问题的答案: Calculate Distances Between One Poin
我想使用 CGAL 构造周期性 3D Delaunay 三角剖分和信息(在本例中为整数)。对于 2D,如果我构造一个 vector 对(点,信息)并将其传递给三角测量函数,则效果很好。然而,非常类似的
每隔几天,我们就会收到少量 MySql 超时错误,这些错误与我们的 MySQL RDS 实例上的 CPU 和数据库连接出现大量峰值相对应。这些查询通常非常快(<5 毫秒),但突然超时。 此时,数据库操
我是一名优秀的程序员,十分优秀!