# Fast extrapolation from āØšā© $$ \def\F{\mathbb F} $$ Given $P ā \F[X]$ with $\deg P < n$ and $š$ a $n$-primitive root of unity. Evaluate $P$ on the subgroup generated by $š$: $$ a_i = P(š^i) $$ **Goal.** *Given only $a_i$ and arbitrary $z ā \F$, efficiently evaluate $P(z)$.* --- Observe the Lagrange basis for $āØšā©$: $$ L_i(X) = c_i \frac{X^n - 1}{X-š^i} $$ where $c_i$ is set such that $L_i(š^j) = \delta_{ij}$ (i.e. one when $i=j$ and zero otherwise). Using [L'Hospital rule](https://hackmd.io/ZxR4-iKsRRqqcMtHYj8duA) we find: $$ \left. \frac{X^n - 1}{X-š^i} \right\vert_{X=š^i} = \left. \frac{nā X^{n-1}}{1} \right\vert_{X=š^i} = n ā š^{i(n-1)} = \frac{n}{š^i} $$ and thus $$ L_i(X) = \frac{š^i}{n} \frac{X^n - 1}{X-š^i} $$ --- $$ \begin{aligned} P(z) &= \sum_i a_i ā L_i(z) \\&= \sum_i a_i ā \frac{š^i}{n} \frac{z^n - 1}{z - š^i} \\&= \frac{z^n - 1}{n} \sum_i \frac{a_i ā š^i}{z - š^i} \end{aligned} $$ This can be evaluated in $\mathcal{O}(1)$ space and $\mathcal{O}(m + \log n)$ time, where $m$ is the number of non-zero entries in $\vec a$.
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up