NumericalChebyshev.ml

(* Copyright INRIA and Microsoft Corporation, 2008-2013. *)
(* DDMF is distributed under CeCILL-B license. *)

INCLUDE "preamble.ml"


let title (_, notation) =
  <:text<Numerical Chebyshev Approximation of <:imath< $(str: notation)>>>>

(* Compute the order first Chebyshev coefficients using the Chebyshev *)
(* recurrence. *)
let_service NumericalChebyshev
  (def : any maple)
  (notation : string)
  (order : int = Constants.default_order) :
  DC.sec_entities * any maple with { title = title } =

  <:unit<
    c_c := Chebyshev[Numeric][NumChebyCoeff](
             $(def), y(x), 10*max(5, $(int:order))) ;
  >> ;
  let e =
    <<
      __DynaMoW_ellipsis_of(
        evalf[$(int:order)](1/2*c_c[0]) * T[0](x) +
        add(evalf[$(int:order)](c_c[i]) * T[i](x), i=1..$(int:order))
      )
    >>
  and e' =
    <<
        evalf[$(int:order)](1/2*c_c[0]) +
        collect(
          add(evalf[$(int:order)](c_c[i]) * orthopoly[T](i, x),
              i = 1..$(int:order)),
          x, factor)
    >>
  in
  let par =
    <:par<First terms and polynomial approximation:
      <:dmath< $(str: notation) = $(symb:e) >>
      <:dmath< $(str: notation) \approx $(symb:e').>>
    >>
  in
  (par, << c_c >>)

Generated by GNU Enscript 1.6.5.90.