I am writing a code that plots the Lagrange polynomial of a given function. I have all the necessary data, but I can't find a way to plot
$P(x) = \sum_{i=0}^n (f(a_i) \prod_{j\neq i,j=0}^n \frac{x-a_j}{a_i-a_j} )$
Or
Note that I don't want to use pgfplots, since I already know how to do it this way. Using only tikz I find difficult to declare the function to plot. Thank you for your help :)
