modular_forms 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2b8536ed2846f289afd967456cdd892858ad3af312acffab3e312c57b367a38
4
- data.tar.gz: ea900a9133578ce1278141bda388d85fc222419ac2de207c50a10c243176166f
3
+ metadata.gz: f9b49161da093d436c9afd089b0d2935a43fafb71d1b1eece1af75cc3ef08833
4
+ data.tar.gz: 54672d7ef27bc439d12747a919a024e9c9fa58d76a3d4b3ae1fa3f807226be6b
5
5
  SHA512:
6
- metadata.gz: 7542e5fa3105f3008bdf192c2471e950898567aca9c133ebb50c7e0d65ec1bd0c3b1765c944257c59782bd26f2f849f15d7653652d14844d844a91ab1174b7b9
7
- data.tar.gz: 6878c24ff277884ff52aeb3ad54073ae50001b3f0f792b317b1d4ed7caf40151a867124a394eef0731846f1d3732b096f741e4e8c6e2473f9b172eddaed0d237
6
+ metadata.gz: d8ad361a6edc83f140ac815bb4b04a6a627100204f523e2192edfaa4cdc8e7b1022cd1c4e6651526582d287818231193d546dd2fb99b859d39401cb5002b3861
7
+ data.tar.gz: 2a7223689108395ebc2f389d1e1ae9b6e61a5165e9da9885624b7758500131ca01f983c433dc045928c433608d773b6ea22410d2196b43b2261cb88c40933b27
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Edgar Armando Delgado Vega
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -2,44 +2,56 @@
2
2
 
3
3
  A creative toolkit for exploring modular forms and elliptic curves through [Sonic Pi](https://sonic-pi.net/).
4
4
 
5
- ![Modular Forms - Image](modular_forms.png)
5
+ <p align="center">
6
+ <img src="https://img.shields.io/gem/v/modular_forms" alt="Gem Version">
7
+ <img src="https://img.shields.io/gem/dt/modular_forms" alt="Gem Total Downloads">
8
+ <img src="https://img.shields.io/github/stars/edelveart/modular_forms" alt="GitHub Repo stars">
9
+ <img src="https://img.shields.io/github/license/edelveart/modular_forms" alt="GitHub License">
10
+ </p>
6
11
 
7
- ## Project Status
12
+ [![Modular Forms - Image](https://raw.githubusercontent.com/edelveart/modular_forms/main/modular_forms.png)](https://rubygems.org/gems/modular_forms)
13
+
14
+ ## ⚙️ Project Status
8
15
 
9
16
  This is a pre-alpha release of `modular_forms`. At this stage, only a subset of core mathematical definitions and operations is implemented.
10
- Future updates might include a DSL, depending on how the library is used and the interest from the community.
11
17
 
12
- Contributions are welcome! Feel free to fork, make changes, and submit a pull request.
18
+ Future updates might include a DSL, depending on how the library is used and the interest from the community. A key challenge lies in creating musical mappings that stay true to the underlying mathematics while also sounding intentional, expressive, and naturally fitting within a musical structure.
13
19
 
14
- ## Features
20
+ ## 🧊 Features
15
21
 
16
22
  - **Accessible to both musicians and coders**: No math expertise required. Create musical patterns, rhythms, timbres, and harmonies by experimenting with mathematical ideas and turning them into sound and effects intuitively.
17
23
  - **Interactive Educational Resource**: Use **Sonic Pi** to discover introductory number theory in a hands-on, immersive way, gaining insights into abstract concepts through math in action.
18
24
 
19
- ## Purpose and Scope
25
+ ## 💡 Purpose and Scope
26
+
27
+ ### Overview
20
28
 
21
- Given the vastness of the field, this tool intentionally focuses on a limited subset of definitions, without covering all aspects of each. Below is a list of the implemented modules:
29
+ Given the vastness of the field, this tool intentionally focuses on a limited subset of definitions, without covering all aspects of each.
22
30
 
23
- - [Eisenstein Series](#eisenstein-series)
24
- - [Eta Functions and Eta Quotients](#eta-functions-and-eta-quotients)
25
- - [Theta functions](#theta-functions)
26
- - [Ramanujan Tau Function](#ramanujan-tau-function)
27
- - [J-Function](#j-function)
28
- - [Hecke Operators](#hecke-operators)
29
- - [SL(2,Z) Group](#sl2z-group)
30
- - [Dirichlet Characters](#dirichlet-characters)
31
- - [Elliptic Curves over Rationals](#elliptic-curves-over-rationals)
32
- - [Elliptic Curves over Finite Fields](#elliptic-curves-over-finite-fields)
33
- - [Newforms Invariants](#newforms-invariants)
31
+ - 🧩 List of implemented modules:
32
+ - [Eisenstein Series](#eisenstein-series)
33
+ - [Eta Functions and Eta Quotients](#eta-functions-and-eta-quotients)
34
+ - [Theta Functions](#theta-functions)
35
+ - [Ramanujan Tau Function](#ramanujan-tau-function)
36
+ - [J-Function](#j-function)
37
+ - [Hecke Operators](#hecke-operators)
38
+ - [SL(2,Z) Group](#sl2z-group)
39
+ - [Dirichlet Characters](#dirichlet-characters)
40
+ - [Elliptic Curves over Rationals](#elliptic-curves-over-rationals)
41
+ - [Elliptic Curves over Finite Fields](#elliptic-curves-over-finite-fields)
42
+ - [Newform Invariants](#newform-invariants)
43
+ - [L-functions](#l-functions)
44
+ - [p-adic Fields](#p-adic-fields)
34
45
 
35
46
  ### Not Optimized for Computational Efficiency
36
47
 
37
- This library is designed for creative exploration rather than maximum computational efficiency. It is not intended to replace advanced mathematical software. Instead, it draws inspiration from tools like SageMath, Pari/GP, and the LMFDB database.
48
+ This library is designed for creative exploration rather than maximum computational efficiency. It is **not intended** to replace specialized mathematical software optimized for heavy or large-scale computations. Instead, it draws inspiration from tools like **SageMath**, **Pari/GP**, and the **LMFDB database**.
38
49
 
39
50
  ### Goal
51
+
40
52
  The goal is simple: to provide an accessible and creative starting point for those who wish to explore, learn, and uncover new ideas, regardless of their mathematical background.
41
53
 
42
- ## Installation
54
+ ## 💎 Installation
43
55
 
44
56
  You can install the `modular_forms` gem directly from **RubyGems** or clone it from GitHub.
45
57
 
@@ -47,31 +59,100 @@ You can install the `modular_forms` gem directly from **RubyGems** or clone it f
47
59
  gem install modular_forms
48
60
  ```
49
61
 
50
- ## How to use?
62
+ If you are **use Ruby**, then import via
63
+ ```rb
64
+ require 'modular_forms'
65
+ ```
51
66
 
52
- You can dive into the beauty of math, both in Ruby and Sonic Pi, creating music in real-time. Here is a simple example of how to use **modular_forms** to generate a basic musical pattern:
67
+ If you are **using Sonic Pi**, replace `<PATH>` with the directory path to the `modular_forms.rb` file inside the gem installation on your system. You can find the full path by running:
68
+
69
+ ```bash
70
+ gem which modular_forms
71
+ ```
72
+
73
+ Then require the file like this:
53
74
 
54
75
  ```rb
55
- # If you are using Ruby, simply load the gem with its name
56
- # after installing it via 'gem install modular_forms'.
57
- require 'modular_forms'
76
+ require "<PATH>/modular_forms.rb"
77
+ ```
78
+
79
+ ## 🧰 How to use?
80
+
81
+ ### 🎶 Explore Fermat’s Last Theorem in Sonic Pi
82
+
83
+ The Taniyama–Shimura Conjecture (now the Modularity Theorem), proven for semistable cases by Andrew Wiles, connects elliptic curves over the rationals to modular forms. This profound result was crucial in proving **Fermat’s Last Theorem**.
84
+
85
+ For example, we can explore the relationship between the elliptic curve `144.a3` and the newform orbit `144.2.a.a` through their L-function,
86
+ `L(E, s) = L(f, s)`, in a musical sense.
58
87
 
59
- # If you are using Sonic Pi, replace <PATH>
60
- # with the full path to the 'modular_forms.rb' file
61
- # inside the gem installation on your system.
88
+ ```rb
62
89
  require "<PATH>/modular_forms.rb"
63
90
 
64
- # Calculate the Eisenstein series of weight k = 4
65
- eisenstein_melody = ModularForms.eisenstein_serie(4)
91
+ # Set precision for the Fourier q-expansion
92
+ prec = 20
93
+
94
+ # Construct a weight 2 newform as an eta quotient
95
+ n = ModularForms.dedekind_eta_pow(12, prec, 12)
96
+ d1 = ModularForms.dedekind_eta_pow(4, prec, 6)
97
+ d2 = ModularForms.dedekind_eta_pow(4, prec, 24)
98
+ eta_prod = ModularForms.eta_product(d1, d2)
99
+
100
+ newform = ModularForms.eta_quotient(n, eta_prod, prec)
101
+
102
+ # Define the elliptic curve E over F_p
103
+ p = 13
104
+ ellc = ModularForms.elliptic_curve_fp(p, [0, -1]) # y^2 = x^3 - 1
105
+ points = ModularForms.cardinality_fp(ellc) # count points on E mod p
106
+
107
+ # Compute the modular coefficient a_p of L-function(E, s)
108
+ a_p = ModularForms.a_p(p, points)
66
109
 
67
- # Play the melody in a loop with a mathematical transformation
68
- 120.times do
69
- play eisenstein_melody.next % 12 * 7
70
- sleep 0.5
110
+ # Sonify the modular relationship
111
+ live_loop :modularity_music do
112
+ play (chord (:a3 + a_p), :m11)[newform.ring.tick],
113
+ amp: a_p, release: 0.125
114
+ sleep 0.125
71
115
  end
72
116
  ```
73
117
 
74
- ## Implemented Modular Forms, Elliptic Curves, and Related Definitions
118
+ ### 🎶 Merging Machine and Organism - Warp Up
119
+
120
+ Unlike the structured Fermat example, this finite loop explores more abstract territory, using multiple concepts to create a sonic landscape that, while grounded in mathematical principles, goes beyond conventional musical forms.
121
+
122
+ ```rb
123
+ require "<PATH>/modular_forms.rb"
124
+
125
+ eisenstein_melody = ModularForms.eisenstein_series(8)
126
+ p = 3
127
+ ellc = ModularForms.elliptic_curve_q([2, 5])
128
+ disc = ModularForms.discriminant_q(ellc)
129
+ e8 = eisenstein_melody.take(58)
130
+ hecke_op = ModularForms.hecke_operator_prime_non_cusp(e8, p, 8, 20)
131
+ j_func = ModularForms.j_function(40)
132
+ newform_ac = ModularForms.analytic_conductor(15, 2)
133
+ pol = ModularForms.def_pol_2deg(41)
134
+
135
+ (disc * -1).times do
136
+ synth :subpulse, note: ModularForms.padic_valuation(eisenstein_melody.next, p) % 7 + 70,
137
+ release: 0.25 if (spread (disc % 6), 7).tick(:d)
138
+
139
+ synth :chiplead, note: hecke_op.tick(:tp) % 7 + 50,
140
+ release: newform_ac, attack: newform_ac
141
+
142
+ synth :fm, note: ModularForms.gauss_sum_triv(5, j_func.tick(:j)) + 51,
143
+ release: 0.25, attack: 0.012,
144
+ pan: ModularForms.analytic_conductor(j_func.look % 15, 4) * rrand_i(-1, 1) if
145
+ spread(ModularForms.gamma1_index(p), 11).tick(:g)
146
+
147
+ sample 90, release: 0.125 if pol.tick == 'x'
148
+ sample :ambi_drone, beat_stretch: 0.7 if pol.look == '*'
149
+ sample :bass_drop_c, release: 0.125 if pol.look == '6'
150
+
151
+ sleep ModularForms.padic_norm(p, p)
152
+ end
153
+ ```
154
+
155
+ ## 🧩 Implemented Modular Forms, Elliptic Curves, and Related Definitions
75
156
 
76
157
  ### Eisenstein Series
77
158
 
@@ -87,7 +168,7 @@ end
87
168
  7. `ModularForms.eta_product(eta1, eta2, prec = nil)`
88
169
  8. `ModularForms.eta_quotient(num_eta, den_eta, prec)`
89
170
 
90
- ### Theta functions
171
+ ### Theta Functions
91
172
 
92
173
  9. `ModularForms.jacobi_theta_function(jacobi_index = 3, square_coefs = false)`
93
174
  10. `ModularForms.jacobi_theta_function_pow(jacobi_index, power, prec)`
@@ -147,6 +228,32 @@ end
147
228
  43. `ModularForms.cardinality_fp(curve)`
148
229
  44. `ModularForms.quadratic_twist_fp(curve)`
149
230
 
150
- ### Newforms Invariants
231
+ ### Newform Invariants
232
+
151
233
  45. `ModularForms.analytic_conductor(level_n, weight_k)`
152
234
 
235
+ ### L-functions
236
+
237
+ 46. `ModularForms.a_p(p, cardinality)`
238
+
239
+ ### p-adic Fields
240
+
241
+ 47. `ModularForms.padic_valuation(num_b10, p)`
242
+ 48. `ModularForms.padic_norm(num_b10, p)`
243
+ 49. `ModularForms.padic_expansion(num_b10, p, prec = 11, reverse_trim = false)`
244
+ 50. `ModularForms.def_pol_2deg(p = 2, c = 0, num = 1)`
245
+
246
+ ## 🧪 Testing
247
+
248
+ Install dependencies first:
249
+
250
+ ```bash
251
+ bundle install
252
+ ```
253
+
254
+ This project features a comprehensive Minitest suite covering core functionality across modules. While not all edge cases are tested, the main mathematical functions are well validated to ensure correctness and stability.
255
+
256
+ Run tests with:
257
+ ```bash
258
+ rake test
259
+ ```
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../core/numeric_helpers/numeric_helpers'
4
- require 'bigdecimal'
5
4
 
6
5
  module ModularForms
7
6
  module Core
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ModularForms
4
+ module Core
5
+ # ModularForms::Core::LFunctions
6
+ #
7
+ # The LFunctions module provides methods related to L-functions,
8
+ # particularly those associated with modular forms and elliptic curves.
9
+ module LFunctions
10
+ def self.a_p(p, cardinality)
11
+ p + 1 - cardinality
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'prime'
4
+ require_relative './padic_pol/padic_pol'
5
+
6
+ module ModularForms
7
+ module Core
8
+ # ModularForms::Core::PAdicFields
9
+ #
10
+ # This module provides concepts and functionality related to p-adic fields.
11
+ module PAdicFields
12
+ def self.padic_valuation(num_b10, p)
13
+ raise "#{p} is not a prime number" unless Prime.prime?(p)
14
+
15
+ index = 0
16
+ return index if num_b10 < 1
17
+
18
+ index += 1 while num_b10 % (p**index) == 0 # rubocop:disable Style/NumericPredicate
19
+ index - 1
20
+ end
21
+
22
+ def self.padic_norm(num_b10, p)
23
+ return 0 if num_b10 == 0 # rubocop:disable Style/NumericPredicate
24
+
25
+ power = padic_valuation(num_b10, p)
26
+ 1.0 / p**power
27
+ end
28
+
29
+ def self.padic_expansion(num_b10, p, prec = 11, reverse_trim = false) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Style/OptionalBooleanParameter
30
+ inverse_limit_arr = []
31
+ (1...prec).each do |index|
32
+ power = p**index
33
+ inverse_limits = ((num_b10 % power) + power) % power
34
+ inverse_limit_arr << inverse_limits
35
+ end
36
+ p_adic_expansion_array = [inverse_limit_arr[0]]
37
+
38
+ (0...(prec - 2)).each do |index|
39
+ a1 = inverse_limit_arr[index + 1]
40
+ a0 = inverse_limit_arr[index]
41
+ power = p**(index + 1)
42
+ digits = (a1 - a0) / power
43
+ p_adic_expansion_array << digits
44
+ end
45
+
46
+ if reverse_trim
47
+ reversed = p_adic_expansion_array.reverse
48
+ first_nonzero_index = reversed.index { |digit| digit != 0 } || 0
49
+ reversed[first_nonzero_index..-1] # rubocop:disable Style/SlicingWithRange
50
+ else
51
+ p_adic_expansion_array
52
+ end
53
+ end
54
+
55
+ def self.def_pol_2deg(p = 2, c = 0, num = 1)
56
+ raise ArgumentError, "Residue field characteristic #{p} must be a prime number" unless Prime.prime?(p)
57
+
58
+ unless (0..3).include?(c)
59
+ raise ArgumentError,
60
+ "The specified discriminant exponent (#{c}) is invalid. Must be in range (0..3)."
61
+ end
62
+ raise ArgumentError, "Invalid value: #{num}. Must be in range (1..4)." unless (1..4).include?(num)
63
+
64
+ PAdicPol.get_defining_polynomial(PAdicPol::DEF_POL_HASH_2DEG, p, c, num)
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,152 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ModularForms
4
+ module Core
5
+ module PAdicFields
6
+ module PAdicPol # rubocop:disable Metrics/ModuleLength
7
+ DATA_POL_2DEG = { '2.2.0.1' => [1, 1, 1],
8
+ '2.2.2.1' => [2, 2, 1],
9
+ '2.2.2.2' => [6, 2, 1],
10
+ '2.2.3.1' => [2, 4, 1],
11
+ '2.2.3.2' => [10, 4, 1],
12
+ '2.2.3.3' => [2, 0, 1],
13
+ '2.2.3.4' => [10, 0, 1],
14
+ '3.2.0.1' => [2, 2, 1],
15
+ '3.2.1.1' => [6, 0, 1],
16
+ '3.2.1.2' => [3, 0, 1],
17
+ '5.2.0.1' => [2, 4, 1],
18
+ '5.2.1.1' => [5, 0, 1],
19
+ '5.2.1.2' => [10, 0, 1],
20
+ '7.2.0.1' => [3, 6, 1],
21
+ '7.2.1.1' => [21, 0, 1],
22
+ '7.2.1.2' => [7, 0, 1],
23
+ '11.2.0.1' => [2, 7, 1],
24
+ '11.2.1.1' => [22, 0, 1],
25
+ '11.2.1.2' => [11, 0, 1],
26
+ '13.2.0.1' => [2, 12, 1],
27
+ '13.2.1.1' => [13, 0, 1],
28
+ '13.2.1.2' => [26, 0, 1],
29
+ '17.2.0.1' => [3, 16, 1],
30
+ '17.2.1.1' => [17, 0, 1],
31
+ '17.2.1.2' => [51, 0, 1],
32
+ '19.2.0.1' => [2, 18, 1],
33
+ '19.2.1.1' => [38, 0, 1],
34
+ '19.2.1.2' => [19, 0, 1],
35
+ '23.2.0.1' => [5, 21, 1],
36
+ '23.2.1.1' => [115, 0, 1],
37
+ '23.2.1.2' => [23, 0, 1],
38
+ '29.2.0.1' => [2, 24, 1],
39
+ '29.2.1.1' => [29, 0, 1],
40
+ '29.2.1.2' => [58, 0, 1],
41
+ '31.2.0.1' => [3, 29, 1],
42
+ '31.2.1.1' => [93, 0, 1],
43
+ '31.2.1.2' => [31, 0, 1],
44
+ '37.2.0.1' => [2, 33, 1],
45
+ '37.2.1.1' => [37, 0, 1],
46
+ '37.2.1.2' => [74, 0, 1],
47
+ '41.2.0.1' => [6, 38, 1],
48
+ '41.2.1.1' => [41, 0, 1],
49
+ '41.2.1.2' => [123, 0, 1],
50
+ '43.2.0.1' => [3, 42, 1],
51
+ '43.2.1.1' => [86, 0, 1],
52
+ '43.2.1.2' => [43, 0, 1],
53
+ '47.2.0.1' => [5, 45, 1],
54
+ '47.2.1.1' => [235, 0, 1],
55
+ '47.2.1.2' => [47, 0, 1],
56
+ '53.2.0.1' => [2, 49, 1],
57
+ '53.2.1.1' => [53, 0, 1],
58
+ '53.2.1.2' => [106, 0, 1],
59
+ '59.2.0.1' => [2, 58, 1],
60
+ '59.2.1.1' => [118, 0, 1],
61
+ '59.2.1.2' => [59, 0, 1],
62
+ '61.2.0.1' => [2, 60, 1],
63
+ '61.2.1.1' => [61, 0, 1],
64
+ '61.2.1.2' => [122, 0, 1],
65
+ '67.2.0.1' => [2, 63, 1],
66
+ '67.2.1.1' => [134, 0, 1],
67
+ '67.2.1.2' => [67, 0, 1],
68
+ '71.2.0.1' => [7, 69, 1],
69
+ '71.2.1.1' => [497, 0, 1],
70
+ '71.2.1.2' => [71, 0, 1],
71
+ '73.2.0.1' => [5, 70, 1],
72
+ '73.2.1.1' => [73, 0, 1],
73
+ '73.2.1.2' => [365, 0, 1],
74
+ '79.2.0.1' => [3, 78, 1],
75
+ '79.2.1.1' => [237, 0, 1],
76
+ '79.2.1.2' => [79, 0, 1],
77
+ '83.2.0.1' => [2, 82, 1],
78
+ '83.2.1.1' => [166, 0, 1],
79
+ '83.2.1.2' => [83, 0, 1],
80
+ '89.2.0.1' => [3, 82, 1],
81
+ '89.2.1.1' => [89, 0, 1],
82
+ '89.2.1.2' => [267, 0, 1],
83
+ '97.2.0.1' => [5, 96, 1],
84
+ '97.2.1.1' => [97, 0, 1],
85
+ '97.2.1.2' => [485, 0, 1],
86
+ '101.2.0.1' => [2, 97, 1],
87
+ '101.2.1.1' => [101, 0, 1],
88
+ '101.2.1.2' => [202, 0, 1],
89
+ '103.2.0.1' => [5, 102, 1],
90
+ '103.2.1.1' => [309, 0, 1],
91
+ '103.2.1.2' => [103, 0, 1],
92
+ '107.2.0.1' => [2, 103, 1],
93
+ '107.2.1.1' => [214, 0, 1],
94
+ '107.2.1.2' => [107, 0, 1],
95
+ '109.2.0.1' => [6, 108, 1],
96
+ '109.2.1.1' => [109, 0, 1],
97
+ '109.2.1.2' => [218, 0, 1],
98
+ '113.2.0.1' => [3, 101, 1],
99
+ '113.2.1.1' => [113, 0, 1],
100
+ '113.2.1.2' => [339, 0, 1],
101
+ '127.2.0.1' => [3, 126, 1],
102
+ '127.2.1.1' => [381, 0, 1],
103
+ '127.2.1.2' => [127, 0, 1],
104
+ '131.2.0.1' => [2, 127, 1],
105
+ '131.2.1.1' => [262, 0, 1],
106
+ '131.2.1.2' => [131, 0, 1],
107
+ '137.2.0.1' => [3, 131, 1],
108
+ '137.2.1.1' => [137, 0, 1],
109
+ '137.2.1.2' => [411, 0, 1],
110
+ '139.2.0.1' => [2, 138, 1],
111
+ '139.2.1.1' => [278, 0, 1],
112
+ '139.2.1.2' => [139, 0, 1],
113
+ '149.2.0.1' => [2, 145, 1],
114
+ '149.2.1.1' => [149, 0, 1],
115
+ '149.2.1.2' => [298, 0, 1],
116
+ '151.2.0.1' => [6, 149, 1],
117
+ '151.2.1.1' => [453, 0, 1],
118
+ '151.2.1.2' => [151, 0, 1],
119
+ '157.2.0.1' => [5, 152, 1],
120
+ '157.2.1.1' => [157, 0, 1],
121
+ '157.2.1.2' => [314, 0, 1],
122
+ '163.2.0.1' => [2, 159, 1],
123
+ '163.2.1.1' => [326, 0, 1],
124
+ '163.2.1.2' => [163, 0, 1],
125
+ '167.2.0.1' => [5, 166, 1],
126
+ '167.2.1.1' => [835, 0, 1],
127
+ '167.2.1.2' => [167, 0, 1],
128
+ '173.2.0.1' => [2, 169, 1],
129
+ '173.2.1.1' => [173, 0, 1],
130
+ '173.2.1.2' => [346, 0, 1],
131
+ '179.2.0.1' => [2, 172, 1],
132
+ '179.2.1.1' => [358, 0, 1],
133
+ '179.2.1.2' => [179, 0, 1],
134
+ '181.2.0.1' => [2, 177, 1],
135
+ '181.2.1.1' => [181, 0, 1],
136
+ '181.2.1.2' => [362, 0, 1],
137
+ '191.2.0.1' => [19, 190, 1],
138
+ '191.2.1.1' => [1337, 0, 1],
139
+ '191.2.1.2' => [191, 0, 1],
140
+ '193.2.0.1' => [5, 192, 1],
141
+ '193.2.1.1' => [193, 0, 1],
142
+ '193.2.1.2' => [965, 0, 1],
143
+ '197.2.0.1' => [2, 192, 1],
144
+ '197.2.1.1' => [197, 0, 1],
145
+ '197.2.1.2' => [394, 0, 1],
146
+ '199.2.0.1' => [3, 193, 1],
147
+ '199.2.1.1' => [597, 0, 1],
148
+ '199.2.1.2' => [199, 0, 1] }.freeze
149
+ end
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './data_pol_2deg'
4
+
5
+ module ModularForms
6
+ module Core
7
+ module PAdicFields
8
+ # ModularForms::Core::PAdicPol
9
+ #
10
+ # Provides a constructor for a hash of defining polynomials of finite extensions of p-adic fields.
11
+ module PAdicPol
12
+ def self.build_padic_label_hash(data_padic)
13
+ padic_coefs_by_label = {}
14
+ data_padic.each do |label, coefs|
15
+ p, _y, z, w = label.split('.').map(&:to_i)
16
+
17
+ padic_coefs_by_label[p] ||= {}
18
+ padic_coefs_by_label[p][z] ||= {}
19
+ padic_coefs_by_label[p][z][w] = coefs
20
+ end
21
+ padic_coefs_by_label
22
+ end
23
+
24
+ def self.gen_quadratic_pol_string(coefs)
25
+ c, b, = coefs
26
+ terms = []
27
+ terms << 'x**2'
28
+
29
+ if (b != 0) && (b == 1)
30
+ terms << '+ x'
31
+ elsif b > 1
32
+ terms << "+ #{b}*x"
33
+ end
34
+
35
+ terms << "+ #{c}"
36
+
37
+ terms.join(' ')
38
+ end
39
+
40
+ def self.get_defining_polynomial(hash, p, z, w)
41
+ gen_quadratic_pol_string(hash.dig(p, z, w))
42
+ end
43
+
44
+ DEF_POL_HASH_2DEG = build_padic_label_hash(DATA_POL_2DEG)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -11,3 +11,5 @@ require_relative 'core/sl2z_groups'
11
11
  require_relative 'core/elliptic_curves_fp'
12
12
  require_relative 'core/dirichlet_characters'
13
13
  require_relative 'core/newform_invariants'
14
+ require_relative 'core/l_functions'
15
+ require_relative 'core/padic_fields'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ModularForms
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.3'
5
5
  end
data/lib/modular_forms.rb CHANGED
@@ -192,4 +192,24 @@ module ModularForms # rubocop:disable Metrics/ModuleLength
192
192
  def analytic_conductor(level_n, weight_k)
193
193
  Core::NewFormInvariants.analytic_conductor(level_n, weight_k)
194
194
  end
195
+
196
+ def a_p(p, cardinality)
197
+ Core::LFunctions.a_p(p, cardinality)
198
+ end
199
+
200
+ def padic_valuation(num_b10, p)
201
+ Core::PAdicFields.padic_valuation(num_b10, p)
202
+ end
203
+
204
+ def padic_norm(num_b10, p)
205
+ Core::PAdicFields.padic_norm(num_b10, p)
206
+ end
207
+
208
+ def padic_expansion(num_b10, p, prec = 11, reverse_trim = false) # rubocop:disable Style/OptionalBooleanParameter
209
+ Core::PAdicFields.padic_expansion(num_b10, p, prec, reverse_trim)
210
+ end
211
+
212
+ def def_pol_2deg(p = 2, c = 0, num = 1)
213
+ Core::PAdicFields.def_pol_2deg(p, c, num)
214
+ end
195
215
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modular_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgar Armando Delgado Vega
@@ -17,8 +17,10 @@ email:
17
17
  executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files:
20
+ - LICENSE
20
21
  - README.md
21
22
  files:
23
+ - LICENSE
22
24
  - README.md
23
25
  - lib/modular_forms.rb
24
26
  - lib/modular_forms/core.rb
@@ -29,8 +31,12 @@ files:
29
31
  - lib/modular_forms/core/elliptic_curves_q.rb
30
32
  - lib/modular_forms/core/hecke_operators.rb
31
33
  - lib/modular_forms/core/klein_j_invariant.rb
34
+ - lib/modular_forms/core/l_functions.rb
32
35
  - lib/modular_forms/core/newform_invariants.rb
33
36
  - lib/modular_forms/core/numeric_helpers/numeric_helpers.rb
37
+ - lib/modular_forms/core/padic_fields.rb
38
+ - lib/modular_forms/core/padic_pol/data_pol_2deg.rb
39
+ - lib/modular_forms/core/padic_pol/padic_pol.rb
34
40
  - lib/modular_forms/core/ramanujan_tau_function.rb
35
41
  - lib/modular_forms/core/sl2z_groups.rb
36
42
  - lib/modular_forms/core/theta_functions.rb