anchor.diff:              Algebra.LinearAlgebra.SolveLinearSystem A b 
   
           let fit (coefficients: Vector<float>) (x_Values: Vector<float>) x =
  +            let sortedX = x_Values |> Seq.sort
               let intervalNumber =
                   
  -                if x > Seq.last x_Values || x < x_Values.[0] then 
  -                    failwith "Spline is not defined outside of the interval [x_Values.[0],x_Values.[n-1]]"
  -                
  -                if x = Seq.last x_Values then 
  -                    Vector.length x_Values - 2
  +                if x > Seq.last sortedX || x < Seq.head sortedX then 
  +                    failwith "Spline is not defined outside of the interval of the xValues"
  +                
  +                if x = Seq.last sortedX then 
  +                    Seq.length sortedX - 2
                   else
  -                    x_Values
  +                    sortedX
                       |> Seq.findIndex(fun x_Knot -> (x_Knot - x) > 0.)
                       |> fun nextInterval -> nextInterval - 1
               
  
positive.code:                     [|0 .. intervalNumber - 1|]
                      |> Array.map (fun i -> 
                          [|
                          interpolatingConstraints i x_Values.[i] y_Values.[i]
                          interpolatingConstraints i x_Values.[i+1] y_Values.[i+1]
                          |])
                          |> Array.concat
  
  
negative.code:                 (tmp,0.)
              
              let boundaryCondition = 
                  let firstX = xVal.[0]
                  let secondX = xVal.[1]
                  let lastX = xVal.[intervalNumber]
                  let penultimate = xVal.[intervalNumber - 1]
                  let tmp1 = Array.init (4 * intervalNumber) (fun x -> 0.)
                  let tmp2 = Array.init (4 * intervalNumber) (fun x -> 0.)
                  match boundaryCondition with
  