# BasisOfSolutions.ml

```(* Copyright INRIA and Microsoft Corporation, 2008-2013. *)

INCLUDE "preamble.ml"

let title (_, _, point, _, _) =
<:text<Asymptotic expansion at <:isymb< \$(point) >>>>

(* Display a single basis element. *)
let display_basis_element basel bname =
let intro_text = <:par<The basis element <:isymb< \$(bname) >> is>> in
let linear_comb = << DDMF:-encode_linear_combination([[1, \$(basel)]]) >>
and notation = <:latex< \$(bname) >> ^ "=" in
let closed_form = fst (ClosedForm.obj ((linear_comb, notation), ())) in
let closed_form_text =
DC.inline_service (ClosedForm.descr (linear_comb, notation) None) in
let trunc_text =
if <:bool< has(\$(closed_form), Sum) >>
then DC.inline_service (TruncatedSeries.descr (linear_comb, notation) None)
else <:par<>>
in
(intro_text @:@ closed_form_text) @@@ trunc_text

(* Compute a basis of solutions at some point and display it. *)
let_service BasisOfSolutions
(eqn : diffeq maple)
(var : name maple)
(point : any maple)
(seq_var : name maple)
(sum_var : name maple) :
DC.sec_entities * unit with { title = title } =

let transf =
if <:bool< \$(point) = infinity >>
then << 1 / \$(var) >>
else << \$(var) - \$(point) >> in
let basis =
CommonTools.symb_list_of_symb
(LocalSolutionsPoint.obj
((eqn, << y >>, var, transf, seq_var, sum_var), ())) in
let nsol = List.length basis in
let bs =
CommonTools.symb_list_of_symb << [seq(b[i], i = 1 .. (\$(int: nsol)))] >> in
(LocalSolutionsPoint.descr
(eqn, << y >>, var, transf, seq_var, sum_var) None)
<:text<here>> in
let intro_text =
if nsol > 0 then
<:par<
The set of local solutions at <:isymb< \$(point) >>
is spanned by the basis element\$(str: Wording.ending_of_int nsol)
>>
@:@ (Wording.enumeration_of_maples bs) @:@
<:par<
below. The detailed derivation of these results can be