Skip to content

Commit f255bf4

Browse files
committed
Update circular.jl
1 parent 794fb77 commit f255bf4

File tree

1 file changed

+42
-63
lines changed

1 file changed

+42
-63
lines changed

notebooks/circular.jl

Lines changed: 42 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ macro bind(def, element)
1515
end
1616

1717
# ╔═╡ 6486e004-c95b-4fcd-936e-6508a0e0283c
18-
using LinearAlgebra, StatsBase, PlutoUI, GenericLinearAlgebra
18+
using LinearAlgebra, StatsBase, PlutoUI, SpecialFunctions
1919

2020
# ╔═╡ fab8681e-0be3-4d97-a0cb-2ad57472282a
2121
using Plots
@@ -114,6 +114,12 @@ let
114114
end
115115
╠═╡ =#
116116

117+
# ╔═╡ d426a597-d198-4d16-9ca1-4600c84d968f
118+
Z = circular4q(3)
119+
120+
# ╔═╡ b17edbda-3a23-48a1-8413-2a5350a29e86
121+
eigvals(ℍ2ℂ(Z))
122+
117123
# ╔═╡ 686fae20-6ed7-444c-9085-0f97d8432303
118124
function circularm(n,β)
119125
e = eigvals(circular(n,β))
@@ -129,18 +135,20 @@ end
129135
let
130136
n = 3
131137
t = 10000
132-
β = 5 #-4/5
133-
# β = 1 # -1
134-
# β = 2 # -1
138+
β = 1
139+
135140
v = [ circularm(n,β) for i=1:t]
136-
# m2 = mean(first.(v))
137-
# m11 = mean(last.(v))
138-
# mean( first.(v) .* conj.(last.(v)))
139-
# 3/mean(abs.(last.(v)).^2) - 1 # 3/|m11|²-1 = β
140-
141-
mean(first.(v).*conj(last.(v))) , -6β/(+1)*+2))
141+
m2 = first.(v)
142+
m11 = last.(v)
143+
144+
# 3/mean(abs.(m11).^2) - 1 , β # 3/|m11|²-1 = β
145+
# mean(m2.*conj(m11)) , -2β/(β+2), -6β/( (β+1)*(β+2)) # n = 2, 3
146+
mean(abs.(m2).^2), (2π)^(-n)*/4+.5)^2 * gamma(1+n*β/2)/gamma(1+β/2)^n
142147
end
143148

149+
# ╔═╡ 6666dce5-8772-4436-a116-fc9b6173bc28
150+
10/7
151+
144152
# ╔═╡ dd7e4afa-323e-4287-a8a0-f1448fb669ac
145153
5/7
146154

@@ -169,31 +177,10 @@ end
169177
# ╔═╡ 2443d72e-42f4-4f66-8170-04633f9b9031
170178
M = circular4(2)
171179

172-
# ╔═╡ 662e1079-13d9-4c26-b359-96556bbf75ee
173-
ℍ2ℂ(q::Quaternion) = [q.s+im*q.v1 q.v2+im*q.v3
174-
-q.v2+im*q.v3 q.s-im*q.v1 ]
175-
176-
# ╔═╡ b11d81bd-b6d7-4325-9012-c65efb859d02
177-
ℍ2ℂ(M::Matrix) = hvcat(size(M,1),ℍ2ℂ.(M)...)
178-
179-
# ╔═╡ a173bcd2-c02a-4897-9fbe-b7bde52f354b
180-
negatej(q::Quaternion) = Quaternion(q.s,q.v1,-q.v2,q.v3)
181-
182-
# ╔═╡ 61e9b1b5-95c5-4974-83b6-53387e93ded6
183-
function jdual(M)
184-
negatej.(transpose(M))
185-
end
186-
187-
# ╔═╡ b58a06f2-ad63-4742-abf8-bf491842b1f2
188-
function circular4q(n) #β=4
189-
A = quat.( randn(n,n), randn(n,n), randn(n,n), randn(n,n))
190-
U = quat(0,0,1,0) * Matrix(qr(A).Q) * quat(0,0,1,0) * jdual(Matrix(qr(A).Q)) #<-- this might be right
191-
end
192-
193180
# ╔═╡ 5e4d9a97-db38-445e-8982-7813b9656546
194181
let
195182
n = 5
196-
t = 5000
183+
t = 15000
197184
m = [ smallabs(circular4(n)) for i=1:t]
198185

199186
stephist(m,normalize=true,label="dense")
@@ -204,33 +191,21 @@ let
204191
stephist!(mq,normalize=true,label="Quaternionic Way")
205192
end
206193

207-
# ╔═╡ d426a597-d198-4d16-9ca1-4600c84d968f
208-
Z = circular4q(3)
209-
210-
# ╔═╡ b17edbda-3a23-48a1-8413-2a5350a29e86
211-
eigvals(ℍ2ℂ(Z))
212-
213-
# ╔═╡ 228f2a0c-2a52-432d-9dda-45f22dda4a4a
214-
A = [quat( [rand(1:5) for i=1:4]...) for i=1:2,j=1:2]
215-
216-
# ╔═╡ bc6bb958-7b18-4324-bc1d-644d543f9842
217-
jdual(A)
218-
219194
# ╔═╡ 00000000-0000-0000-0000-000000000001
220195
PLUTO_PROJECT_TOML_CONTENTS = """
221196
[deps]
222-
GenericLinearAlgebra = "14197337-ba66-59df-a3e3-ca00e7dcff7a"
223197
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
224198
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
225199
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
226200
Quaternions = "94ee1d12-ae83-5a48-8b1c-48b8ff168ae0"
201+
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
227202
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
228203
229204
[compat]
230-
GenericLinearAlgebra = "~0.3.13"
231205
Plots = "~1.40.8"
232206
PlutoUI = "~0.7.60"
233207
Quaternions = "~0.7.5"
208+
SpecialFunctions = "~2.4.0"
234209
StatsBase = "~0.34.3"
235210
"""
236211

@@ -240,7 +215,7 @@ PLUTO_MANIFEST_TOML_CONTENTS = """
240215
241216
julia_version = "1.10.4"
242217
manifest_format = "2.0"
243-
project_hash = "d5477210c2247950b3cde5a6471f10197fb68f21"
218+
project_hash = "4aadc0bfa083dbcc0fec18591f4522480020ff68"
244219
245220
[[deps.AbstractPlutoDingetjes]]
246221
deps = ["Pkg"]
@@ -298,13 +273,11 @@ deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statist
298273
git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249"
299274
uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4"
300275
version = "0.10.0"
276+
weakdeps = ["SpecialFunctions"]
301277
302278
[deps.ColorVectorSpace.extensions]
303279
SpecialFunctionsExt = "SpecialFunctions"
304280
305-
[deps.ColorVectorSpace.weakdeps]
306-
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
307-
308281
[[deps.Colors]]
309282
deps = ["ColorTypes", "FixedPointNumbers", "Reexport"]
310283
git-tree-sha1 = "362a287c3aa50601b0bc359053d5c2468f0e7ce0"
@@ -455,12 +428,6 @@ git-tree-sha1 = "a8863b69c2a0859f2c2c87ebdc4c6712e88bdf0d"
455428
uuid = "d2c73de3-f751-5644-a686-071e5b155ba9"
456429
version = "0.73.7+0"
457430
458-
[[deps.GenericLinearAlgebra]]
459-
deps = ["LinearAlgebra", "Printf", "Random", "libblastrampoline_jll"]
460-
git-tree-sha1 = "f47136cac29a9b7a8a88dbce1195394978091edb"
461-
uuid = "14197337-ba66-59df-a3e3-ca00e7dcff7a"
462-
version = "0.3.13"
463-
464431
[[deps.Gettext_jll]]
465432
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "XML2_jll"]
466433
git-tree-sha1 = "9b02998aba7bf074d14de89f9d37ca24a1a0b046"
@@ -778,6 +745,12 @@ git-tree-sha1 = "7493f61f55a6cce7325f197443aa80d32554ba10"
778745
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
779746
version = "3.0.15+1"
780747
748+
[[deps.OpenSpecFun_jll]]
749+
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"]
750+
git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1"
751+
uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e"
752+
version = "0.5.5+0"
753+
781754
[[deps.Opus_jll]]
782755
deps = ["Artifacts", "JLLWrappers", "Libdl"]
783756
git-tree-sha1 = "6703a85cb3781bd5909d48730a67205f3f31a575"
@@ -987,6 +960,18 @@ deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
987960
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
988961
version = "1.10.0"
989962
963+
[[deps.SpecialFunctions]]
964+
deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"]
965+
git-tree-sha1 = "2f5d4697f21388cbe1ff299430dd169ef97d7e14"
966+
uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
967+
version = "2.4.0"
968+
969+
[deps.SpecialFunctions.extensions]
970+
SpecialFunctionsChainRulesCoreExt = "ChainRulesCore"
971+
972+
[deps.SpecialFunctions.weakdeps]
973+
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
974+
990975
[[deps.Statistics]]
991976
deps = ["LinearAlgebra", "SparseArrays"]
992977
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
@@ -1400,16 +1385,10 @@ version = "1.4.1+1"
14001385
# ╠═686fae20-6ed7-444c-9085-0f97d8432303
14011386
# ╠═5ede4dd3-c432-4108-b22d-ab72200f91f1
14021387
# ╠═aaa6835c-7d8f-4208-ab5d-0b06de61dbb8
1388+
# ╠═6666dce5-8772-4436-a116-fc9b6173bc28
14031389
# ╠═dd7e4afa-323e-4287-a8a0-f1448fb669ac
14041390
# ╠═5fcb9846-0a0d-4517-8eff-90f580172b82
14051391
# ╠═fb3ec55c-db9f-4897-b4d0-3a07a3ba859c
14061392
# ╠═37236855-5f7d-4d4a-8046-116a51dbae7f
1407-
# ╠═662e1079-13d9-4c26-b359-96556bbf75ee
1408-
# ╠═b11d81bd-b6d7-4325-9012-c65efb859d02
1409-
# ╠═a173bcd2-c02a-4897-9fbe-b7bde52f354b
1410-
# ╠═61e9b1b5-95c5-4974-83b6-53387e93ded6
1411-
# ╠═b58a06f2-ad63-4742-abf8-bf491842b1f2
1412-
# ╠═228f2a0c-2a52-432d-9dda-45f22dda4a4a
1413-
# ╠═bc6bb958-7b18-4324-bc1d-644d543f9842
14141393
# ╟─00000000-0000-0000-0000-000000000001
14151394
# ╟─00000000-0000-0000-0000-000000000002

0 commit comments

Comments
 (0)