title: Obtain Lagrange interpolation in a point and function
body: <p>How do I obtain the Lagrange interpolation in R to find the <em>nth</em> order polynomial in <em>x</em> that passes through the given <em>x</em> points and <em>y</em> , which is a function?</p>
  
  <p>Here is a sample to show what I mean:</p>
  
  <p><img src="https://i.stack.imgur.com/vYVb5.png" alt="image description here"></p>
  
  <p>I found simple Lagrange interpolation questions but in there they use y as a function's point not as a function.</p>