MainIndex.ml

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

INCLUDE "preamble.ml"

let release_string = <:text<1.9.1>>
and release_date = <:text<May 2013>>

let anchor_of_func sf_id =
  let sf = DB.sf_of_id sf_id in
  let rep = sf.SF.rep
  and name = sf.SF.full_name in
  if not (DynaMoW.Services.Renderings.is_defined ()) then
    <:par<The $(str: name)>>
  else
    let pars = List.map Maple.pretty_code_of_t (SF.params_of_t sf) in
    let link =
      DC.link_service
        (match List.length pars with
        | 0 -> SpecialFunction.P0.descr sf_id None
        | 1 -> SpecialFunction.P1.descr sf_id (Some (List.hd pars))
        | 2 ->
            SpecialFunction.P2.descr
              sf_id (Some (List.hd pars, List.nth pars 1))
        | 3 ->
            SpecialFunction.P3.descr
              sf_id (Some (List.hd pars, List.nth pars 1, List.nth pars 2))
        | _ -> SpecialFunction.Pn.descr sf_id None)
        <:text<$(str: name)>> in
    <:par<The $(link) <:isymb< $(rep) >>>>

let intro () =
  let w = DC.dstyle (DC.css_of_string "font-size:200%; float: left") "W" in
  let mathematical_functions =
    DC.link "http://en.wikipedia.org/wiki/List_of_mathematical_functions"
      <:text<Mathematical Functions>> in
  <:par<
    $(t_ent:w)elcome to this interactive site on $(mathematical_functions),
    with properties, truncated expansions, numerical evaluations, plots, and
    more.  The functions currently presented are elementary functions and
    special functions of a single variable.  More functionsspecial
    functions with parameters, orthogonal polynomials, sequenceswill be
    added with the project advances.
  >>


(* Make a paragraph that does not have class content-par. *)
let no_content_par = DC.pstyle (DC.css_of_string "")

let centered_par pos =
  DC.pstyle
    (DC.css_of_string
       ("text-align: center; font-weight: bold; padding" ^ pos ^ ": 20px"))

let info () =
  centered_par
    "-top" <:par<This is release $(t_ent:release_string) of DDMF>> @@@
  let math_rendering =
    DC.link "math_rendering.html" <:text<Select a mathematical rendering>> in
  centered_par "-bottom"
    (if not (DynaMoW.Services.Renderings.is_defined ()) then
      <:par< $(math_rendering) to enable access to the contents >>
    else <:par< Select a special function from the list >>)

let bold_text =
  DC.dstyle (DC.css_of_string "font-weight: bold; margin-right: 1em")

let what_s_new =
  let w = bold_text "What's new?" in
  no_content_par
    <:par<
      $(t_ent:w)  The main changes in this release $(t_ent:release_string), \
      dated $(t_ent:release_date), are:
    >> @@@
  DC.unordered_list
    (List.map no_content_par
      [ <:par<Proofs related to Taylor polynomial approximations.>> ]) @@@
  DC.pstyle (DC.css_of_string "padding-bottom: 20px")
    <:par< Release $(DC.link "history.html" <:text<history>>). >>

let links =
  let help = DC.link "math_rendering.html" <:text<Help>>
  and developers = DC.link "developers.html" <:text<developers>>
  and motivation = DC.link "motivation.html" <:text<Motivation>>
  and article = DC.link "icms-2011.pdf" <:text<Article>>
  and source = DC.link "src/index.html" <:text<Source code>>
  and related = DC.link "related.html" <:text<related projects>> in
  no_content_par
    <:par<$(t_ent:bold_text "More on the project:")>> @@@
  DC.unordered_list
    (List.map no_content_par
      [ <:par<
          $(help) on selecting and configuring the mathematical rendering
        >> ;
        <:par<DDMF $(developers) list>> ;
        <:par<$(motivation) of the project>> ;
        <:par<$(article) on the project at ICMS'2010>> ;
        <:par<$(source) used to generate these pages>> ;
        <:par<List of $(related)>> ])

let footer =
  let msr_inria =
    DC.link
      "http://www.msr-inria.inria.fr/"
      <:text<Microsoft ResearchINRIA Joint Centre>> in
    <:par<
      The DDMF project (20082013) is hosted and supported \
      by the $(msr_inria).
    >>

let function_list () =
  let compare s1 s2 =
    String.compare (String.lowercase s1) (String.lowercase s2) in
  let fl = List.map anchor_of_func (List.sort compare (DB.sf_list ())) in
  DC.pstyle (DC.css_of_string "text-align: center")
    <:par<Mathematical Functions>> @@@
  DC.unordered_list (List.map no_content_par fl)

let right_column () =
  DC.section
    <:text<Mathematical Functions and Differential Equations>>
    (function_list ())

let title _ = <:text<Dynamic Dictionary of Mathematical Functions>>

let service_style =
  DC.css_of_string
    "#section-1 {\
      float: right\
    }\
\
    #section-1 > .section2 {\
      display: none\
    }"

let welcome_picture () =
  let plot =
    TaylorExpansionPlot.TaylorExpansionPlotSVG.descr
      (<< AiryAi(x) >>, << x >>, << -7 >>, << 4 >>, 20) None in
  let plot_style =
    DC.css_of_string
      "text-align: center; margin-left: 10%; \
       margin-top: 20px; margin-bottom: 20px"
  in
  DC.pstyle plot_style <:par< $(DC.plot plot) >>

let_service MainIndex :
  DC.sec_entities * unit with { title = title; style = service_style } =

  (DC.section (title ())
     (right_column () @@@ intro () @@@ info () @@@ what_s_new @@@
      links @@@ welcome_picture () @@@ footer), ())

Generated by GNU Enscript 1.6.5.90.