anchor.diff:  *)
   
   
  +open FSharp.Plotly
   open FSharp.Stats.Interpolation
   open FSharp.Stats.Fitting.LinearRegression
   
  
positive.code: open FSharp.Stats.Fitting.LinearRegression
  open FSharp.Plotly
  
  let x_data = vector [|1. .. 4.|]
  let y_data = vector [|4.;7.;9.;8.;|]
  
  //Polynomial interpolation
  
  //Define the order the polynomial should have. In Interpolation the order is equal to the data length - 1
  let order = x_data.Length - 1
  let coefficients = 
      OrdinaryLeastSquares.Polynomial.coefficient order x_data y_data 
  let interpolFunction x = 
      OrdinaryLeastSquares.Polynomial.fit order coefficients x
  
  let rawChart = 
      Chart.Point(x_data,y_data)
      |> Chart.withTraceName "raw data"
      
  let interpolPol = 
      let fit = [|1. .. 0.01 .. 4.|] |> Array.map (fun x -> x,interpolFunction x)
      fit
      |> Chart.Line
      |> Chart.withTraceName "interpolating polynomial"
  
  (*** do-not-eval ***)
  let chartPol = 
      [rawChart;interpolPol] 
      |> Chart.Combine
  
  
  (*** include-value:chartPol ***)
  
  
negative.code: open FSharp.Plotly
  
  
  (**
  
  #Interpolation
  
  ##Polynomial Interpolation
  
  Here a polynomial is fitted to the data. In general a polynomial with degree = dataPointNumber - 1 has sufficient flexibility to interpolate all data points.
  The least squares approach is not sufficient to converge to an interpolating polynomial! A degree other than n-1 results in a regression polynomial.
  
  *)
  
  