Function: ellpadicbsd
Section: elliptic_curves
C-Name: ellpadicbsd
Prototype: GGLDG
Help: ellpadicbsd(E, p, n, {D = 1}): returns [r,Lp] where
 r is the (conjectural) analytic rank of the p-adic L-function attached
 to the quadratic twist E_D and Lp is (conjecturally) equal
 to the product of the p-adic regulator and the cardinal of the
 Tate-Shafarevich group.
Doc: Given an elliptic curve $E$ over $\Q$, its quadratic twist $E_D$
 and a prime number $p$, this function is a $p$-adic analog of the complex
 functions \tet{ellanalyticrank} and \tet{ellbsd}. It calls \kbd{ellpadicL}
 with initial accuracy $p^n$ and may increase it internally;
 it returns a vector $[r, L_p]$ where

 \item $L_p$ is a $p$-adic number (resp. a pair of $p$-adic numbers if
 $E$ has good supersingular reduction) defined modulo $p^N$, conjecturally
 equal to $R_p S$, where $R_p$ is the $p$-adic regulator as given by
 \tet{ellpadicregulator} (in the basis $(\omega, F \omega)$) and $S$ is the
 cardinal of the Tate-Shafarevich group for the quadratic twist $E_D$.

 \item $r$ is an upper bound for the analytic rank of the $p$-adic
 $L$-function attached to $E_D$: we know for sure that the $i$-th
 derivative of $L_p(E_D,.)$ at $\chi^0$ is $O(p^N)$ for all $i < r$
 and that its $r$-th derivative is non-zero; it is expected that the true
 analytic rank is equal to the rank of the Mordell-Weil group $E_D(\Q)$,
 plus $1$ if the reduction of $E_D$ at $p$ is split multiplicative;
 if $r = 0$, then both the analytic rank and the Mordell-Weil rank are
 unconditionnally $0$.

 Recall that the $p$-adic BSD conjecture (Mazur, Tate, Teitelbaum, Bernardi,
 Perrin-Riou) predicts an explicit link between $R_p S$ and
 $$(1-p^{-1}  F)^{-2} \cdot L_p^{(r)}(E_D, \chi^0) / r! $$
 where $r$ is the analytic rank of the $p$-adic $L$-function attached to
 $E_D$ and $F$ is the Frobenius on $H^1_{dR}$; see \tet{ellpadicL}
 for definitions.
 \bprog
 ? E = ellinit("11a1"); p = 7; n = 5; \\ good ordinary
 ? ellpadicbsd(E, 7, 5) \\ rank 0,
 %2 = [0, 1 + O(7^5)]

 ? E = ellinit("91a1"); p = 7; n = 5; \\ non split multiplicative
 ? [r,Lp] = ellpadicbsd(E, p, n)
 %5 = [1, 2*7 + 6*7^2 + 3*7^3 + 7^4 + O(7^5)]
 ? R = ellpadicregulator(E, p, n, E.gen)
 %6 = 2*7 + 6*7^2 + 3*7^3 + 7^4 + 5*7^5 + O(7^6)
 ? sha = Lp/R
 %7 = 1 + O(7^4)

 ? E = ellinit("91b1"); p = 7; n = 5; \\ split multiplicative
 ? [r,Lp] = ellpadicbsd(E, p, n)
 %9 = [2, 2*7 + 7^2 + 5*7^3 + O(7^4)]
 ? ellpadicregulator(E, p, n, E.gen)
 %10 = 2*7 + 7^2 + 5*7^3 + 6*7^4 + 2*7^5 + O(7^6)
 ? [rC, LC] = ellanalyticrank(E);
 ? [r, rC]
 %12 = [2, 1]  \\ r = rC+1 because of split multiplicative reduction

 ? E = ellinit("53a1"); p = 5; n = 5; \\ supersingular
 ? [r, Lp] = ellpadicbsd(E, p, n);
 ? r
 %15 = 1
 ? Lp
 %16 = [3*5 + 2*5^2 + 2*5^5 + O(5^6), \
        5 + 3*5^2 + 4*5^3 + 2*5^4 + 5^5 + O(5^6)]
 ? R = ellpadicregulator(E, p, n, E.gen)
 %17 = [3*5 + 2*5^2 + 2*5^5 + O(5^6), 5 + 3*5^2 + 4*5^3 + 2*5^4 + O(5^5)]
 \\ expect Lp = R*#Sha, hence (conjecturally) #Sha = 1

 ? E = ellinit("84a1"); p = 11; n = 6; D = -443;
 ? [r,Lp] = ellpadicbsd(E, 11, 6, D) \\ Mordell-Weil rank 0, no regulator
 %19 = [0, 3 + 2*11 + O(11^6)]
 ? lift(Lp)  \\ expected cardinal for Sha is 5^2
 %20 = 25
 ? ellpadicbsd(E, 3, 12, D)  \\ at 3
 %21 = [1, 1 + 2*3 + 2*3^2 + O(3^8)]
 ? ellpadicbsd(E, 7, 8, D)   \\ and at 7
 %22 = [0, 4 + 3*7 + O(7^8)]
 @eprog
