(** This file is part of the Coquelicot formalization of real analysis in Coq: http://coquelicot.saclay.inria.fr/  Copyright (C) 2011-2015 Sylvie Boldo #<br /># Copyright (C) 2011-2015 Catherine Lelay #<br /># Copyright (C) 2011-2015 Guillaume Melquiond  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the COPYING file for more details. *)
(** This file describes an experiment: most 18-year old French students pass an exam called Baccalaureate which ends the high school and is required for attending the university. We took the 2013 mathematics test of the scientific Baccalaureate at the same time as the students. The pdf of the test is available #<a href="https://www.lri.fr/~lelay/Bac2013/Bac_S_2013_Metropole.pdf">here</a>#. *)
Ltac pos_rat :=
repeat ( apply Rdiv_lt_0_compat
|| apply Rplus_lt_0_compat
|| apply Rmult_lt_0_compat) ;
try by apply Rlt_0_1.
(** * Exercice 2 *)
(* 8:14 *)
Definition fab (a b x : R) : R := (a + b * ln x) / x.
(** ** Questions 1 *)
(** 1.a. On voit sur le graphique que l'image de 1 par f correspond au point B(1,2). On a donc f(1) = 2. Comme la tangente (BC) à la courbe en ce point admet pour coefficient directeur 0, f'(1) = 0 *)
(** 1.b *)
(** 1.c *)
Definition f (x : R) : R := fab 2 2 x.
(** ** Questions 2 *)
(* 8:38 *)
(** 2.a. *)
(** 2.b. *)
(** 2.c. *)
(** ** Questions 3 *)
(* 9:40 *)
(** 3.a *)
(** 3.b. *)
(** ** Questions 5 *)
(* 10:08 *)
(** 5.a. *)
(** 5.b. *)
(** * Exercice 4 *)
(* 10:36 *)
Fixpoint u (n : nat) : R :=
match n with
| O => 2
| S n => 2/3 * u n + 1/3 * (INR n) + 1
end.
(** ** Questions 1 *)
(** 1.a. *)
(** 1.b. *)
(** ** Questions 2 *)
(* 10:40 *)
(** 2.a *)
(** 2.c. *)
(** ** Question 3 *)
(* 10:49 *)
Definition v (n : nat) : R := u n - INR n.
(** 3.a. *)
(** 3.b. *)
(** ** Questions 4 *)
(* 11:00 *)
Definition Su (n : nat) : R := sum_f_R0 u n.
Definition Tu (n : nat) : R := Su n / (INR n) ^ 2.
(** 4.a. *)
(** 4.b. *)

Lemma Q4b : is_lim_seq Tu (1/2).