-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrianglesPlot.jl
71 lines (57 loc) · 1.71 KB
/
TrianglesPlot.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# This file is part of IntegerTriangles.jl.
# Copyright Peter Luschny. License is MIT.
(@__DIR__) ∉ LOAD_PATH && push!(LOAD_PATH, (@__DIR__))
module TrianglesPlot
"""
Plotting triangles.
"""
const ModuleTrianglesPlot = ""
using TrianglesBase, TrianglesExamples
using Plots; gr()
function PolyPlot(F, title)
x = -2.0:0.05:1.0
plot(x, F[1], c="black", linewidth=1)
plot!(x, F[2], c="green", line=:dash)
plot!(x, F[3], c="blue", linewidth=1)
plot!(x, F[4], c="red", line=:dash)
plot!(x, F[5], c="orange", linewidth=1)
plot!(x, F[6], c="blue", line=:dash)
plot!(x, F[7], c="black", linewidth=1)
title!(title)
xlabel!("x")
ylabel!("p(x)")
# axis limit
P = plot!(xlims=(-2.0, 1.0), ylims=(-5.0, 5.0))
display(P)
end
# START-TEST-########################################################
function test()
end
function demo()
# P = PolynomialFunction(LahTriangle(7))
# PolyPlot(P, "Lah polynomials")
# P = PolynomialFunction(EulerianTriangle(7))
# PolyPlot(P, "Eulerian polynomials")
# P = PolynomialFunction(LaguerreTriangle(7))
# PolyPlot(P, "Laguerre polynomials")
# P = PolynomialFunction(CatalanTriangle(7))
# PolyPlot(P, "Catalan polynomials")
# P = PolynomialFunction(MotzkinTriangle(7))
# PolyPlot(P, "Motzkin polynomials")
P = PolynomialFunction(NarayanaTriangle(7))
PolyPlot(P, "Narayana polynomials")
# P = PolynomialFunction(JacobsthalTriangle(7))
# PolyPlot(P, "Jacobsthal polynomials")
# P = PolynomialFunction(FibonacciTriangle(7))
# PolyPlot(P, "Fibonacci polynomials")
end
function perf()
end
function main()
test()
# this might take a while
demo()
perf()
end
main()
end # module