# RecurrenceEqn.ml

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

INCLUDE "preamble.ml"

let rec_main_page rec_ parvals =

let params = FEqn.params_of_t rec_ in
let eqn = CommonTools.eval_expr rec_.FEqn.eqn params parvals in

(*********************** Particular Solutions **********************)
(* Create a short section telling to which function the considered *)
(* differential equation is related to. *)
let sol_ids = rec_.FEqn.sol_ids in
let lr = List.length sol_ids in
let text_rec =
<:par<of the differential equation <:dmath< \$(symb: eqn) = 0 >>>> in
let text1, text2 = match lr with
| 0 -> <:par<No particular solutions >>, <:par<are known to the database>>
| 1 -> <:par<A particular solution >>, <:par<is >>
| _ -> <:par<Some particular solutions >>, <:par<are >>
in

(* Test whether the given parameters are identical to those in the DB. *)
(* In the affirmative case, we can link to the corresponding function. *)
let list1 = CommonTools.symb_of_name_list params in
(*  let list2 = CommonTools.eval_expr list1 params parvals in *) (* see below *)
let display_sf sf_id =
let link_text = <:text<function>> in
(Sequence.Param0''.descr sf_id None)
in
let func_text =
(*      if <:bool< \$(list1) = \$(list2) >>*)
(* TODO: This is a hack to avoid linking to SF pages which do not work. *)
if <:bool< \$(list1) = [] >>
else <:par<\$(t_ent: link_text) >>
in
(* For displaying the mathematical representation of the function, *)
(* we test whether the particular choice of the parameters allows  *)
(* a simplification; in this case we write, e.g., J_{1/2}(x) = ... *)
let func_rep1 =
CommonTools.subs_expr (DB.seq_of_id sf_id).Seq.rep params parvals in
let func_rep2 =
<:latex<
\$(CommonTools.eval_expr (DB.seq_of_id sf_id).Seq.rep params parvals)
>> in
let func_rep =
(if (String.compare func_rep1 func_rep2) = 0
then <:par<<:imath<\$(str: func_rep1)>>>>
else <:par<<:imath< \$(str: func_rep1) = \$(str: func_rep2) >>>>)
in
<:par<the >> @:@ func_text @:@ func_rep
in
let text_sols = Wording.enumeration_of_ents (List.map display_sf sol_ids) in
let solution =
DC.section
<:text<Particular Solutions>>
(text1 @:@ text_rec @:@ text2 @:@ text_sols @:@ <:par<.>>)
in
solution

let display_rec rec_id parvals =
let rec_ = DB.eqn_of_id rec_id in
let var = FEqn.var_of_t rec_ in
let parval_list =
CommonTools.symb_of_symb_list
(List.map (fun a -> << parse(\$(str: a)) >>) parvals)
in
if <:bool< has(\$(parval_list), {\$(var), y}) >>
then
DC.warning
<:par<
Conflict between function <:isymb< y(\$(var)) >> and the parameters.
>>
else rec_main_page rec_ parvals

let title rec_id =
let rec_ = DB.eqn_of_id rec_id in
let name = rec_.FEqn.eqn_name in
<:text<The \$(str: name)>>

let_service Param0'
(rec_id : string) :
DC.sec_entities * unit with { title = title } =

(DC.section
(title rec_id)
(display_rec rec_id [ ]),
())
```

Generated by GNU Enscript 1.6.5.90.