FEqn.ml

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

INCLUDE "preamble.ml"

type arg_type =
  | Diff
  | Param
  | Shift

type eqn_type =
  | DiffEq
  | RecEq

type eqn_type_filter =
  | FDiffEq
  | FRecEq
  | FAny

type t = {
  eqn_type : eqn_type ;
  (* Names of the variables and parameters and their types
     (Diff, Shift, Param). *)
  names_and_types : (name maple * arg_type) list ;
  (* Like "Airy differential equation". *)
  eqn_name : string ;
  (* Equation as Maple expression. *)
  eqn : diffeq maple ;
  (* List of id's which are solution to this equation. *)
  sol_ids : string list ;
}

let var_of_t eqn =
  let nats = eqn.names_and_types in
  let dvars = List.filter (fun (_, t) -> t = Diff) nats
  and rvars = List.filter (fun (_, t) -> t = Shift) nats in
  let nb_dvars = List.length dvars
  and nb_rvars = List.length rvars in
  (* FIXME: Raise a better error than this failwith. *)
  match
    List.hd
      (if nb_dvars = 1 && nb_rvars = 0 then dvars
      else if nb_dvars = 0 && nb_rvars = 1 then rvars
      else failwith ("FEqn.var_of_t: " ^ eqn.eqn_name))
  with (n, _) -> n

let params_of_t eqn =
  let nats = eqn.names_and_types in
  let params = List.filter (fun (_, t) -> t = Param) nats in
  List.map (fun (n, _) -> n) params

Generated by GNU Enscript 1.6.5.90.