← Main book chapter 3
Contents / index
Browser back
← Previous chapter
Next chapter →
Laboratory
Memory
Cards
Sort
Match
Visuals
Coding
Quiz
Programming practice
Lagrange interpolation — Chapter 3
Fix the product so the index j is excluded.
Language:
JavaScript
Student code
function L(xs,j,x){ let p=1; for(let m=0;m<xs.length;m++){ p *= (x-xs[m])/(xs[j]-xs[m]); } return p; }
Check code
Show corrected code
Reset buggy code
Feedback
Corrected code