module ProjectionMethods.CollocationTaskData

open System
open ProjectionMethods.CollocationTaskModel
open MathNet.Numerics.Differentiate

// General form
// Equation: Ly(x) = f(x)
// Initial conditions:
// x**2 + c_1 * x + d_1
// x**3 + c_2 * x + d_2

// Option 1 from method_part_2_2 (Pakulina's manual)
let L_y y x =
    (Math.Cos x) * (y x)
    - (derivative 1 x (fun arg -> (1.0 / (2.0 + arg)) * (arg |> derivativeFunc 1 y)))

let f x = 1.0 + x

let equationData = { Ly = L_y; f = f }

let firstPolynomial x = x * x - 1.0

let secondPolynomial x = x * x * x - 1.0 * x

let initialData =
    { first_polynomial = firstPolynomial
      second_polynomial = secondPolynomial }

let taskData: CollocationTask =
    { Equation = equationData
      InitialConditions = initialData }