Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
|
|
@ -0,0 +1,7 @@
|
|||
# Create a table with the data together with a sequence number
|
||||
CREATE OR REPLACE TABLE t AS
|
||||
SELECT generate_subscripts(l, 1) as id, unnest(l)::DOUBLE as x,
|
||||
from (values ([2,4,4,4,5,5,7,9])) tbl(l) ;
|
||||
|
||||
# Compute the rolling standard deviations without the Bessel adjustment:
|
||||
SELECT *, stddev_pop(x) OVER (ORDER BY id) as 'cumulative stddev' FROM t;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn main() !void {
|
||||
const stdout = std.io.getStdOut().writer();
|
||||
const arr = [_]f32{ 2, 4, 4, 4, 5, 5, 7, 9 };
|
||||
|
||||
var sum: f32 = 0;
|
||||
var sum2: f32 = 0;
|
||||
var count: f32 = 0;
|
||||
|
||||
for (arr) |n| {
|
||||
sum += n;
|
||||
sum2 += std.math.pow(f32, n, 2);
|
||||
count += 1;
|
||||
|
||||
const cumulative: f32 = count * sum2 - std.math.pow(f32, sum, 2);
|
||||
const running_sd: f32 = std.math.sqrt(cumulative) / count;
|
||||
|
||||
try stdout.print("{d} {d}\n", .{n, running_sd});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue