-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SEQ operator + stirling aprox. for Catalan numbers + partitions and c…
…ompositions + partitions with restricted summand + test unit using problem from page 43
- Loading branch information
Showing
10 changed files
with
81 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ authors = ["fargolo <[email protected]> and contributors"] | |
version = "1.0.0-DEV" | ||
|
||
[deps] | ||
Reexport = "189a3867-3050-52da-a836-e630ba90ab69" | ||
SymPy = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6" | ||
|
||
[compat] | ||
|
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 |
---|---|---|
@@ -1,14 +1,20 @@ | ||
module AnalyticComb | ||
|
||
using SymPy | ||
#using TaylorSeries | ||
#using DynamicalSystems | ||
#using SymPy | ||
using Reexport | ||
|
||
@reexport using SymPy | ||
|
||
export | ||
stirling_factorial, partitions, primes_composition, | ||
SEQ, | ||
stirling_factorial, stirling_catalan, | ||
partitions, primes_composition, restricted_sum_part_gf, restricted_sum_part, | ||
p_binary_words_runl | ||
|
||
include("binary_words.jl") | ||
include("operators.jl") | ||
include("asymptotics.jl") | ||
include("parts_comps.jl") | ||
include("binary_words.jl") | ||
|
||
|
||
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
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 |
---|---|---|
|
@@ -36,5 +36,3 @@ function p_binary_words_runl(k,n) | |
return(Float64(result_sym)) | ||
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
SEQ(z) | ||
Sequence operator | ||
""" | ||
SEQ(z) = 1/(1-z) |
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,37 @@ | ||
""" | ||
partitions(n) | ||
Asymptotics for partition of integers by Hardy and Ramanujan, later improved by Rademache | ||
""" | ||
partitions(n) = (1/(4*n*sqrt(3)))*exp(pi*sqrt(2n/3)) | ||
|
||
|
||
""" | ||
primes_composition(n) | ||
Asymptotics for composition of primes. | ||
""" | ||
primes_composition(n) = 0.30365 * 1.47622^n | ||
|
||
""" | ||
restricted_sum_part_gf(r) | ||
Generating function for partition with restricted summand. | ||
""" | ||
function restricted_sum_part_gf(r) | ||
z = SymPy.symbols("z") | ||
return(prod([SEQ(z^i) for i in r])) | ||
end | ||
|
||
""" | ||
restricted_sum_part(n,r) | ||
Number of partitions with components in r with restricted summand n. | ||
n must be an integer and r must be a set of integers, like in r = [1,5,10,25] , n = 99. | ||
""" | ||
function restricted_sum_part(n,r) | ||
z = SymPy.symbols("z") | ||
coefs = collect(series(restricted_sum_part_gf(r),z,0,n+1),z) | ||
return(coefs.coeff(z,n)) | ||
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