src/HOL/Analysis/Harmonic_Numbers.thy
changeset 70136 f03a01a18c6e
parent 70113 c8deb8ba6d05
child 70532 fcf3b891ccb1
equal deleted inserted replaced
70135:ad6d4a14adb5 70136:f03a01a18c6e
    17   and the Euler-Mascheroni constant.
    17   and the Euler-Mascheroni constant.
    18 \<close>
    18 \<close>
    19 
    19 
    20 subsection \<open>The Harmonic numbers\<close>
    20 subsection \<open>The Harmonic numbers\<close>
    21 
    21 
    22 definition%important harm :: "nat \<Rightarrow> 'a :: real_normed_field" where
    22 definition\<^marker>\<open>tag important\<close> harm :: "nat \<Rightarrow> 'a :: real_normed_field" where
    23   "harm n = (\<Sum>k=1..n. inverse (of_nat k))"
    23   "harm n = (\<Sum>k=1..n. inverse (of_nat k))"
    24 
    24 
    25 lemma harm_altdef: "harm n = (\<Sum>k<n. inverse (of_nat (Suc k)))"
    25 lemma harm_altdef: "harm n = (\<Sum>k<n. inverse (of_nat (Suc k)))"
    26   unfolding harm_def by (induction n) simp_all
    26   unfolding harm_def by (induction n) simp_all
    27 
    27 
   154   have "convergent (\<lambda>n. harm (Suc n) - ln (of_nat (Suc n) :: real))"
   154   have "convergent (\<lambda>n. harm (Suc n) - ln (of_nat (Suc n) :: real))"
   155     by (subst A) (fact euler_mascheroni.sum_integral_diff_series_convergent)
   155     by (subst A) (fact euler_mascheroni.sum_integral_diff_series_convergent)
   156   thus ?thesis by (subst (asm) convergent_Suc_iff)
   156   thus ?thesis by (subst (asm) convergent_Suc_iff)
   157 qed
   157 qed
   158 
   158 
   159 lemma%important euler_mascheroni_LIMSEQ:
   159 lemma\<^marker>\<open>tag important\<close> euler_mascheroni_LIMSEQ:
   160   "(\<lambda>n. harm n - ln (of_nat n) :: real) \<longlonglongrightarrow> euler_mascheroni"
   160   "(\<lambda>n. harm n - ln (of_nat n) :: real) \<longlonglongrightarrow> euler_mascheroni"
   161   unfolding euler_mascheroni_def
   161   unfolding euler_mascheroni_def
   162   by (simp add: convergent_LIMSEQ_iff [symmetric] euler_mascheroni_convergent)
   162   by (simp add: convergent_LIMSEQ_iff [symmetric] euler_mascheroni_convergent)
   163 
   163 
   164 lemma euler_mascheroni_LIMSEQ_of_real:
   164 lemma euler_mascheroni_LIMSEQ_of_real:
   248       by (induction n) (simp_all add: inverse_eq_divide)
   248       by (induction n) (simp_all add: inverse_eq_divide)
   249   qed
   249   qed
   250 qed
   250 qed
   251 
   251 
   252 
   252 
   253 subsection%unimportant \<open>Bounds on the Euler-Mascheroni constant\<close>
   253 subsection\<^marker>\<open>tag unimportant\<close> \<open>Bounds on the Euler-Mascheroni constant\<close>
   254 
   254 
   255 (* TODO: Move? *)
   255 (* TODO: Move? *)
   256 lemma ln_inverse_approx_le:
   256 lemma ln_inverse_approx_le:
   257   assumes "(x::real) > 0" "a > 0"
   257   assumes "(x::real) > 0" "a > 0"
   258   shows   "ln (x + a) - ln x \<le> a * (inverse x + inverse (x + a))/2" (is "_ \<le> ?A")
   258   shows   "ln (x + a) - ln x \<le> a * (inverse x + inverse (x + a))/2" (is "_ \<le> ?A")