Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
research

Dream Scatter chakravala

😎
research
View GitHub Profile
View test_grassmann.jl
using Grassmann;
@basis D"1,1,1,0";
P = [ rand()*v124 + rand()*v134 + rand()*v234 + v123 for i=1:1000 ];
L = [ rand()*v12 + rand()*v13 + rand()*v14 + rand()*v23 + rand()*v24 + rand()*v34 for i=1:1000 ];
A = [ rand() for i=1:1000];
test2(L,A,P) = (LA = exp.(L.*A); LA.*P.*.~LA);
R = test2(L,A,P);
f(L,A,P,i) = (LA = exp(L[i]*A[i]); LA*P[i]*~LA);
function test(L,A,P,R)
for k 1:1000
@chakravala
chakravala / grove-iterator.jl
Created Oct 22, 2017
Creates iterable function object for Dendriform.Grove
View grove-iterator.jl
using Dendriform, ResumableFunctions
@resumable function trees(g::Union{Grove,PBTree})
typeof(g) == PBTree && return ResumableFunctions.@yield g
for i 1:g.size-1
ResumableFunctions.@yield PBTree(g.Y[i,:])
end
return PBTree(g.Y[end,:])
end
import Base.convert
convert(::Type{Array{PBTree,1}},g::Grove) = [trees(g)...]
@chakravala
chakravala / tamari-grove-commutativity.jl
Last active Oct 22, 2017
Visualize dendriform grove sum commutativity using Tamari associahedron
View tamari-grove-commutativity.jl
using Dendriform, LightGraphs, GraphPlot, Colors
function highlight_sum(a::Grove,b::Grove)
d = a.degr + b.degr
g = DiGraph(Int(Cn(d)))
for i = 1:Int(Cn(d))
u = Dendriform.posetnext(PBTree(d,i))
for t in u
add_edge!(g,i,treeindex(t))
end
end
@chakravala
chakravala / jones-prime-formula.jl
Created Sep 15, 2017
Jones formula for n-th prime
View jones-prime-formula.jl
g(y::BigInt,x::BigInt) = BigInt((abs(y-x) + y-x)//2)
r(y::BigInt,x::BigInt)::BigInt = (x==0) ? y : mod(y,x)
p(n::Int) = sum(i->g(BigInt(1),g(sum(j->r((factorial(g(BigInt(j),BigInt(1))))^2,BigInt(j)),0:i),BigInt(n))),0:n^2)
map(p,1:17)
@chakravala
chakravala / ramanujan-tau.png
Last active Nov 30, 2019
Ramanujan's tau function (100 years of) -> a python script