This app is online at https://p-adic-norm.up.railway.app/
This is a Flask application to calculate the p-adic norm of a rational number.
p_adic_controller.py
contains the app logic.
p_adic_view.html
is the Jinja view template.
p_adic_model.py
is a WTForms Form subclass.
p_adic_compute
contains the computation functions. p_adic_abs
is the old version.
The function p_adic_abs
takes a prime
{
'valuation': val,
'float': abs,
'fraction: to_fraction(abs)
}
where:
-
val
is the p-adic valuation$val_p(x)$ -
abs
is the p-adic norm$|x|_p$ as a float -
to_fraction(abs)
is a string expressed as a ratio of integers a/b, converted by thefractions
package
The web app interface returns the valuation and the fractional representation of the norm by default, for pedagogical purposes. The user can choose between float or fraction, and a copy to clipboard button is provided. When abs
is an integer (i.e. fraction
are converted to type int
.
Example in terminal:
import p_adic_compute as p
p.p_adic_abs(5, 1/200)
25
p.p_adic_abs(5, 200)
'1/25'
Next goals:
- update to a Flask-WTF FlaskForm subclass to include CSRF protection
- light/dark toggle switch
- provide a primality testing method