local data1 = gdt.read_string [[
x	y
0	0
0.523598775598299	0.5
1.0471975511966	0.866025403784439
1.5707963267949	1
2.0943951023932	0.866025403784439
2.61799387799149	0.5
3.14159265358979	0
]]

local data2 = gdt.read_string [[
x	s	c
0	0	1
0.261799387799149	0.258819045102521	0.965925826289068
0.523598775598299	0.5	0.866025403784439
0.785398163397448	0.707106781186547	0.707106781186548
1.0471975511966	0.866025403784439	0.5
1.30899693899575	0.965925826289068	0.258819045102521
1.5707963267949	1	2.83276944882399E-16
1.83259571459405	0.965925826289068	-0.25881904510252
2.0943951023932	0.866025403784439	-0.5
2.35619449019234	0.707106781186548	-0.707106781186547
2.61799387799149	0.5	-0.866025403784439
2.87979326579064	0.258819045102521	-0.965925826289068
3.14159265358979	-3.21624529935327E-16	-1
3.40339204138894	-0.258819045102521	-0.965925826289068
3.66519142918809	-0.500000000000001	-0.866025403784438
3.92699081698724	-0.707106781186548	-0.707106781186547
4.18879020478639	-0.866025403784439	-0.5
4.45058959258554	-0.965925826289068	-0.258819045102521
4.71238898038469	-1	-1.83697019872103E-16
4.97418836818384	-0.965925826289068	0.25881904510252
5.23598775598299	-0.866025403784439	0.499999999999999
5.49778714378214	-0.707106781186548	0.707106781186547
5.75958653158129	-0.500000000000001	0.866025403784438
6.02138591938044	-0.258819045102522	0.965925826289068
6.28318530717958	-2.02128619922972E-15	1
]]

local dx = 3.0
local data3 = gdt.create(|i| {x = i / 256 * dx, xs = (i / 256 * dx)^2, xc = (i / 256 * dx)^3}, 0, 256)

print(data3)

print(gdt.integrate(data1, "y ~ x"))
print(gdt.integrate(data2, "s, c, s^2, c^2 ~ x"))


print(gdt.integrate(data3, "x, xs, xc ~ x"))
print(dx^2/2, dx^3/3, dx^4/4)

print(gdt.integrate(data3, "x", "xs"), dx^3/3)

