modular_forms 0.0.1 → 0.0.2
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 +4 -4
- data/LICENSE +21 -0
- data/README.md +72 -17
- data/lib/modular_forms/core/dirichlet_characters.rb +0 -1
- data/lib/modular_forms/core/l_functions.rb +15 -0
- data/lib/modular_forms/core.rb +1 -0
- data/lib/modular_forms/version.rb +1 -1
- data/lib/modular_forms.rb +4 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 749de4a6eccae53fa56728d33efae75d5f9c0d4376d2031760202dddb0815666
|
4
|
+
data.tar.gz: 0c4d325ea237d6c6478c2fae75f862e0b1f8e116d1b822b5a35eac5481ea88c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f9b7939543427e63283e38d4c3c4bd796823962809c65348ef0023c6a66a94cde414bddf5cfffe2f2ed0c88e342f90da8aa60774de78cf932d09d36a89f8d18
|
7
|
+
data.tar.gz: cc6ea4af26b7e9502d607e6128f522a383e03f4da9c1cf2b328158fb94f6b85a226cb3c2f9837fc00fbc2a1f0a1370d58b88df7c7a930f1e3968d03235829949
|
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,21 +2,28 @@
|
|
2
2
|
|
3
3
|
A creative toolkit for exploring modular forms and elliptic curves through [Sonic Pi](https://sonic-pi.net/).
|
4
4
|
|
5
|
-
|
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
|
-
|
12
|
+
[](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
17
|
Future updates might include a DSL, depending on how the library is used and the interest from the community.
|
11
18
|
|
12
|
-
Contributions are welcome! Feel free to fork
|
19
|
+
Contributions are welcome! Feel free to fork and submit a pull request.
|
13
20
|
|
14
|
-
## Features
|
21
|
+
## 🧊 Features
|
15
22
|
|
16
23
|
- **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
24
|
- **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
25
|
|
19
|
-
|
26
|
+
### Purpose and Scope
|
20
27
|
|
21
28
|
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:
|
22
29
|
|
@@ -31,15 +38,16 @@ Given the vastness of the field, this tool intentionally focuses on a limited su
|
|
31
38
|
- [Elliptic Curves over Rationals](#elliptic-curves-over-rationals)
|
32
39
|
- [Elliptic Curves over Finite Fields](#elliptic-curves-over-finite-fields)
|
33
40
|
- [Newforms Invariants](#newforms-invariants)
|
41
|
+
- [L-functions](#l-functions)
|
34
42
|
|
35
43
|
### Not Optimized for Computational Efficiency
|
36
44
|
|
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
|
45
|
+
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**.
|
38
46
|
|
39
47
|
### Goal
|
40
48
|
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
49
|
|
42
|
-
## Installation
|
50
|
+
## 💎 Installation
|
43
51
|
|
44
52
|
You can install the `modular_forms` gem directly from **RubyGems** or clone it from GitHub.
|
45
53
|
|
@@ -47,21 +55,27 @@ You can install the `modular_forms` gem directly from **RubyGems** or clone it f
|
|
47
55
|
gem install modular_forms
|
48
56
|
```
|
49
57
|
|
50
|
-
|
58
|
+
If you are **use Ruby**, then import via
|
59
|
+
```rb
|
60
|
+
require 'modular_forms'
|
61
|
+
```
|
51
62
|
|
52
|
-
|
63
|
+
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:
|
53
64
|
|
54
65
|
```rb
|
55
|
-
|
56
|
-
|
57
|
-
require 'modular_forms'
|
66
|
+
require "<PATH>/modular_forms.rb"
|
67
|
+
```
|
58
68
|
|
59
|
-
|
60
|
-
|
61
|
-
|
69
|
+
## 🧰 How to use?
|
70
|
+
|
71
|
+
### 🎶 Play an Eisenstein Series as Music for Warm-Up
|
72
|
+
|
73
|
+
Here is a simple example of how to use **modular_forms** to generate a basic musical pattern:
|
74
|
+
|
75
|
+
```rb
|
62
76
|
require "<PATH>/modular_forms.rb"
|
63
77
|
|
64
|
-
#
|
78
|
+
# Generate an Eisenstein series of weight k = 4
|
65
79
|
eisenstein_melody = ModularForms.eisenstein_serie(4)
|
66
80
|
|
67
81
|
# Play the melody in a loop with a mathematical transformation
|
@@ -71,7 +85,44 @@ eisenstein_melody = ModularForms.eisenstein_serie(4)
|
|
71
85
|
end
|
72
86
|
```
|
73
87
|
|
74
|
-
|
88
|
+
### 🎶 Explore Fermat’s Last Theorem in Sonic Pi
|
89
|
+
|
90
|
+
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**.
|
91
|
+
|
92
|
+
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,
|
93
|
+
`L(E, s) = L(f, s)`, in a musical sense.
|
94
|
+
|
95
|
+
```rb
|
96
|
+
require "<PATH>/modular_forms.rb"
|
97
|
+
|
98
|
+
# Set precision for the Fourier q-expansion
|
99
|
+
prec = 20
|
100
|
+
|
101
|
+
# Construct a weight 2 newform as an eta quotient
|
102
|
+
n = ModularForms.dedekind_eta_pow(12, prec, 12)
|
103
|
+
d1 = ModularForms.dedekind_eta_pow(4, prec, 6)
|
104
|
+
d2 = ModularForms.dedekind_eta_pow(4, prec, 24)
|
105
|
+
eta_prod = ModularForms.eta_product(d1, d2)
|
106
|
+
|
107
|
+
newform = ModularForms.eta_quotient(n, eta_prod, prec)
|
108
|
+
|
109
|
+
# Define the elliptic curve E over F_p
|
110
|
+
p = 13
|
111
|
+
ellc = ModularForms.elliptic_curve_fp(p, [0, -1]) # y^2 = x^3 - 1
|
112
|
+
points = ModularForms.cardinality_fp(ellc) # count points on E mod p
|
113
|
+
|
114
|
+
# Compute the modular coefficient a_p of L-function(E, s)
|
115
|
+
a_p = ModularForms.a_p(p, points)
|
116
|
+
|
117
|
+
# Sonify the modular relationship
|
118
|
+
live_loop :modularity_music do
|
119
|
+
play (chord (:a3 + a_p), :m11)[newform.ring.tick],
|
120
|
+
amp: a_p, release: 0.125
|
121
|
+
sleep 0.125
|
122
|
+
end
|
123
|
+
```
|
124
|
+
|
125
|
+
## 🧩 Implemented Modular Forms, Elliptic Curves, and Related Definitions
|
75
126
|
|
76
127
|
### Eisenstein Series
|
77
128
|
|
@@ -148,5 +199,9 @@ end
|
|
148
199
|
44. `ModularForms.quadratic_twist_fp(curve)`
|
149
200
|
|
150
201
|
### Newforms Invariants
|
202
|
+
|
151
203
|
45. `ModularForms.analytic_conductor(level_n, weight_k)`
|
152
204
|
|
205
|
+
### L-functions
|
206
|
+
|
207
|
+
46. `ModularForms.a_p(p, cardinality)`
|
@@ -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
|
data/lib/modular_forms/core.rb
CHANGED
data/lib/modular_forms.rb
CHANGED
@@ -192,4 +192,8 @@ 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
|
195
199
|
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.
|
4
|
+
version: 0.0.2
|
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,6 +31,7 @@ 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
|
34
37
|
- lib/modular_forms/core/ramanujan_tau_function.rb
|