Skip to content

Commit 5632cad

Browse files
committed
a struct and recipe for rays, simple convergence for spiders, and beginnings of orbit portraits
1 parent e179893 commit 5632cad

File tree

6 files changed

+82
-20
lines changed

6 files changed

+82
-20
lines changed

parameters/DynamicRays.jl

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,48 @@
1-
using GLMakie
2-
using ColorSchemes
31
include("../sequences/AngleDoubling.jl")
42
include("../spiders/SpiderFuncs.jl")
53

6-
## Conjecture: if the collection of rays is a sequence of rays, we will not need this function
4+
struct ExternalRays
5+
orb::Sequence{Rational}
6+
rays::Dict{Rational,Vector{ComplexF64}}
7+
parameter::Complex
8+
end
9+
10+
## Conjecture: if the collection of rays is a sequence of rays, we will not need this function.
11+
## Question: Is it possible to update the rays in a mutating and not problematic way?
712
function goesto(seq::Sequence)
813
l = seq.preperiod
914
k = period(seq)
1015
idx = append!(collect(1:l).+1,circshift(l+1:l+k,-1))
1116
return [(seq.items[x],seq.items[y]) for (x,y) in enumerate(idx)]
1217
end
1318

14-
### DANGER ###
15-
#copy and pasted from HubbardTrees.jl
16-
#similar to above function?
17-
#=
18-
function forwardimages(htree::Dict)
19-
return Dict([Pair(key,[shift(key)]) for key in keys(htree)])
20-
end
21-
=#
19+
function standardrays(theta::Rational,c::Complex,R::Real,res::Int)
20+
orb = orbit(theta)
21+
radii = collect(LinRange(R,sqrt(R),res))
22+
rays = Dict([Pair(phi,exp(2im*pi*phi).*radii) for phi in orb.items])
23+
return ExternalRays(orb,rays,c)
24+
end
25+
26+
function extend!(Ext::ExternalRays)
27+
for (target,source) in goesto(rays)
28+
z = source[end-res+1]
29+
a = sqrt(-c + z)
30+
b = -sqrt(-c + z)
31+
32+
da = abs2(target[end]-a)
33+
db = abs2(target[end]-b)
34+
35+
if da < db
36+
append!(target,path_sqrt(-c .+ source[end-res+1:end]))
37+
elseif db < da
38+
append!(target,-1 .* path_sqrt(-c .+ source[end-res+1:end]))
39+
else
40+
return error("can't decide what to glue")
41+
end
42+
end
43+
return Ext
44+
end
45+
2246

2347
function dynamicrays(c::Complex,angle::Rational,R::Real,res::Int,depth::Int)
2448
orb = orbit(angle)

parameters/ShowRays.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using GLMakie
2+
using ColorSchemes
3+
include("DynamicRays.jl")
4+
5+
@recipe(RayPlot,ExtRays) do scene
6+
Theme()
7+
end
8+
9+
function Makie.plot!(myplot::RayPlot)
10+
rays = collect(values(myplot.ExtRays[].rays))
11+
n = length(rays)
12+
for (j ,ray) in enumerate(rays)
13+
lines!(myplot,real(ray),imag(ray),color = get(ColorSchemes.rainbow, float(j)/float(n)))
14+
end
15+
return myplot
16+
end

spiders/Spiders.jl

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,21 @@ function spideriterates(S0::Spider,n_iter::Int)
180180
end
181181

182182
#TODO modify below to have tolerance-based convergence behavior
183-
function parameter(S0::Spider,n_iter::Int)
183+
function parameter(S0::Spider,max_iter::Int)
184184
S = deepcopy(S0)
185-
for ii in 1:n_iter
185+
c_last = S.legs[2][end]/2
186+
for ii in 1:max_iter
186187
mapspider!(S)
188+
c = S.legs[2][end]/2
189+
println(repr(c)*" delta "*repr(abs(c-c_last)))
190+
if abs(c-c_last)<(1e-15)
191+
return c
192+
end
193+
c_last = c
187194
end
188-
return S.legs[2][end]/2
195+
return S.legs[2][end]/2
196+
end
197+
198+
function parameter(theta::Rational,max_iter::Int)
199+
return parameter(standardspider(theta),max_iter)
189200
end

trees/EmbedTrees.jl

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function EmbeddedHubbardTree(OHT::OrientedHubbardTree)
2323

2424
theta = angleof(first(criticalanglesof(OZ,OHT)))
2525
c = parameter(standardspider(theta),250)
26-
print(c)
26+
println(c)
2727

2828
#critical orbit
2929
rays = Dict()
@@ -37,8 +37,8 @@ function EmbeddedHubbardTree(OHT::OrientedHubbardTree)
3737
for node in keys(OHT.adj)
3838
for angle in anglelist[node]
3939
if !(angle in keys(rays))
40-
theta = angleof(angle)
41-
push!(rays,Pair(theta,dynamicrays(c,theta,100,10,20)[theta]))
40+
phi = angleof(angle)
41+
push!(rays,Pair(phi,dynamicrays(c,phi,100,10,20)[phi]))
4242
end
4343
end
4444
end
@@ -48,9 +48,11 @@ function EmbeddedHubbardTree(OHT::OrientedHubbardTree)
4848

4949
paramorbit = [0.0+0.0im]
5050
n = period(theta)
51+
#println(n)
5152
for ii in 1:n-1
5253
push!(paramorbit,paramorbit[end]^2+c)
5354
end
55+
#println(paramorbit)
5456

5557
zvalues = Dict{Sequence,ComplexF64}()
5658
for node in keys(OHT.adj)
@@ -62,11 +64,14 @@ function EmbeddedHubbardTree(OHT::OrientedHubbardTree)
6264
push!(zvalues,Pair(node,sum(list)/length(list)))
6365
end
6466
end
65-
6667
E = standardedges(OHT.adj,OHT.zero,zvalues)
6768
return EmbeddedHubbardTree(OHT.zero,OHT.adj,OHT.boundary,OZ,theta,rays,c,zvalues,E)
6869
end
6970

71+
function Base.show(io::IO,H::EmbeddedHubbardTree)
72+
return println(io,"Embedded Hubbard tree of "*repr(H.angle)*" with "*repr(length(keys(H.adj)))*" vertices")
73+
end
74+
7075
function standardedges(adj,zero,zvalues)
7176
edges = edgeset(adj)
7277

@@ -196,4 +201,9 @@ function showtree(angle::Rational)
196201
end
197202

198203

199-
204+
function angleclusters(H::OrientedHubbardTree)
205+
charset = characteristicset(H)
206+
allangles = allanglesof(H)
207+
anglegroups = [allangles[branch] for branch in charset]
208+
return anglegroups
209+
end

trees/OrientTrees.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include("HubbardTrees.jl")
1+
include("HubbardTrees.jl")
22

33
struct OrientedHubbardTree <: AbstractHubbardTree
44
zero::Sequence

trees/ShowTree.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using GLMakie
2+
using ColorSchemes
23
include("EmbedTrees.jl")
34
include("../spiders/Spiders.jl")
45
include("../parameters/DynamicRays.jl")

0 commit comments

Comments
 (0)