-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
transitioned to Requires for PyPlot and ImageInTerminal
- Loading branch information
1 parent
c06a828
commit 86e2c37
Showing
9 changed files
with
122 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
julia 1.0.1 | ||
SyntaxTree | ||
Reduce | ||
PyPlot | ||
Requires | ||
LaTeXStrings | ||
ColorSchemes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This file is part of Fatou.jl. It is licensed under the MIT license | ||
# Copyright (C) 2019 Michael Reed | ||
|
||
using PyPlot | ||
import PyPlot: plot | ||
|
||
function plot(K::FilledSet;c::String="",bare::Bool=false) | ||
# plot figure using imshow based in input preferences | ||
figure() | ||
isempty(c) && (c = K.meta.cmap) | ||
isempty(c) ? PyPlot.imshow(K.meta.iter ? K.iter : K.mix, extent=K.meta.∂) : | ||
PyPlot.imshow(K.meta.iter ? K.iter : K.mix, cmap=c, extent=K.meta.∂) | ||
tight_layout() | ||
if !bare | ||
# determine if plot is Iteration, Roots, or Limit | ||
typeof(K.meta.iter ? K.iter : K.mix) == Matrix{UInt8} ? t = L"iter. " : | ||
K.meta.m==1 ? t = L"roots" : t = L"limit" | ||
# annotate title using LaTeX | ||
ttext = "f:z\\mapsto $(rdpm(Algebra.latex(K.meta.E))),\\," | ||
if K.meta.newt | ||
title(latexstring("$ttext m = $(K.meta.m), ")*t) | ||
# annotate y-axis with Newton's method | ||
ylabel(L"Fatou\,set:\,"*L"z\,↦\,z-m\,×\,f(z)\,/\,f\,'(z)") | ||
else | ||
title(latexstring(ttext)*t) | ||
end | ||
tight_layout() | ||
colorbar() | ||
end | ||
end | ||
|
||
include("orbitplot.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# This file is part of Fatou.jl. It is licensed under the MIT license | ||
# Copyright (C) 2019 Michael Reed | ||
|
||
using ImageInTerminal, ColorSchemes | ||
|
||
function Base.show(io::IO,K::FilledSet;c::String="",bare::Bool=false) | ||
# plot figure using imshow based in input preferences | ||
isempty(c) && (c = K.meta.cmap) | ||
S = size(K.iter) | ||
H = zeros(ColorSchemes.RGB{Float64},S...) | ||
C = getproperty(ColorSchemes, isempty(c) ? :balance : Symbol(c)) | ||
if K.meta.iter | ||
for x ∈ 1:S[1], y ∈ 1:S[2] | ||
H[x,y] = C[K.iter[x,y]] | ||
end | ||
else | ||
for x ∈ 1:S[1], y ∈ 1:S[2] | ||
H[x,y] = get(C,K.mix[x,y]) | ||
end | ||
end | ||
display(H) | ||
if !bare | ||
# determine if plot is Iteration, Roots, or Limit | ||
typeof(K.meta.iter ? K.iter : K.mix) == Matrix{UInt8} ? t = "iter. " : | ||
K.meta.m==1 ? t = "roots" : t = "limit" | ||
# annotate title using LaTeX | ||
ttext = "f : z ↦ $(K.meta.E), " | ||
if K.meta.newt | ||
print("$ttext m = $(K.meta.m), ",t) | ||
else | ||
print(ttext,t) | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
using Reduce,Fatou | ||
using Fatou | ||
using SyntaxTree | ||
using LaTeXStrings | ||
using PyPlot | ||
using Test | ||
|
||
load_package(:rlfi) | ||
@test orbit(newton(:(z^3-1))) == nothing | ||
@test orbit(:(1*x),x->x, [-1.7 2π -1.2],17,3,147) == nothing | ||
@test orbit(:(1*x),x->x, [-1.7 2π -1.2],0,1) == nothing | ||
Fatou.Reduce.load_package(:rlfi) | ||
@test newton(:(z^3-1)) |> typeof <: Fatou.Define | ||
#@test orbit(:(1*x),x->x, [-1.7 2π -1.2],17,3,147) == nothing | ||
#@test orbit(:(1*x),x->x, [-1.7 2π -1.2],0,1) == nothing | ||
@test basin(juliafill(:(z^3-1)),1) |> typeof == LaTeXStrings.LaTeXString | ||
@test basin(newton(:(z^3-1)),1) |> typeof == LaTeXStrings.LaTeXString | ||
@test (f=newton(:(z^3-1))|>fatou; plot(f) |> typeof == PyPlot.PyObject) | ||
@test (f=mandelbrot(:(z^2+c))|>fatou ; plot(f) |> typeof == PyPlot.PyObject) | ||
@test (f=juliafill(:(z^2-0.06+0.67im))|>fatou ; plot(f) |> typeof == PyPlot.PyObject) | ||
@test (η = Fatou.newton_raphson(:(z^3-1),1); ξ = genfun(η,[:z,:c]); ζ = 2.1; [ξ(ζ,0), [Fatou.recomp(η,ζ,k) for k ∈ 2:3]...]) |> typeof <: Array | ||
@test newton(:(z^3-1)) |> fatou |> typeof <: Fatou.FilledSet | ||
@test mandelbrot(:(z^2+c)) |> fatou |> typeof <: Fatou.FilledSet | ||
@test juliafill(:(z^2-0.06+0.67im)) |> fatou |> typeof <: Fatou.FilledSet | ||
#@test (η = Fatou.newton_raphson(:(z^3-1),1); ξ = genfun(η,[:z,:c]); ζ = 2.1; [ξ(ζ,0), [Fatou.recomp(η,ζ,k) for k ∈ 2:3]...]) |> typeof <: Array | ||
# fix for case k ∈ 2:4+ |