|
|
|
|
Quelle LogDeriv.lean
Sprache: Lean
|
|
/-
Copyright (c) 2024 Chris Birkbeck. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Chris Birkbeck
-/
module
public import Mathlib.Analysis.Calculus.Deriv.ZPow
public import Mathlib.Analysis.Calculus.MeanValue
/-!
# Logarithmic Derivatives
We define the logarithmic derivative of a function `f` as `deriv f / f`. We then prove some basic
facts about this, including how it changes under multiplication and composition.
-/
@[expose] public section
noncomputable section
open Filter Function Set
open scoped Topology
variable { ' : Type*} [NontriviallyNormedField ] [NontriviallyNormedField ']
[NormedAlgebra ']
/-- The logarithmic derivative of a function defined as `deriv f /f`. Note that it will be zero
at `x` if `f` is not DifferentiableAt `x`. -/
def logDeriv (f : → ') :=
deriv f / f
theorem logDeriv_apply (f : → ') (x : ) : logDeriv f x = deriv f x / f x := rfl
lemma logDeriv_eq_zero_of_not_differentiableAt (f : → ') (x : ) (h : ¬DifferentiableAt f x) :
logDeriv f x = 0 := by
simp only [logDeriv_apply, deriv_zero_of_not_differentiableAt h, zero_div]
/-- If two functions agree in a neighborhood of `x`, then so do their logarithmic derivatives. -/
lemma logDeriv_congr_nhds {f g : → '} {x : } (h : f =ᶠ[ x] g) :
logDeriv f =ᶠ[ x] logDeriv g := h.deriv.div h
/--
If two functions agree in a punctured neighborhood of `x`, then so do their logarithmic derivatives.
-/
lemma logDeriv_congr_nhdsNE {f g : → '} {x : } (h : f =ᶠ[[≠] x] g) :
logDeriv f =ᶠ[[≠] x] logDeriv g := h.nhdsNE_deriv.div h
/--
If two functions agree on a codiscrete subset of an open set `U`, then so do their logarithmic
derivatives.
-/
theorem logDeriv_congr_codiscreteWithin {f g : → '} {U : Set } (hU : IsOpen U)
(h : f =ᶠ[codiscreteWithin U] g) :
logDeriv f =ᶠ[codiscreteWithin U] logDeriv g := by
refine mem_codiscreteWithin_iff_forall_mem_nhdsNE.2 fun x hx ↦ ?_
refine mem_of_superset (logDeriv_congr_nhdsNE ?_) Set.subset_union_left
filter_upwards [mem_codiscreteWithin_iff_forall_mem_nhdsNE.1 h x hx,
nhdsWithin_le_nhds (hU.mem_nhds hx)] with z hz hzU
exact hz.resolve_right (not_not_intro hzU)
/--
If two functions agree on a codiscrete subset of ``, then so do their logarithmic derivatives.
-/
theorem logDeriv_congr_codiscrete {f g : → '} (h : f =ᶠ[codiscrete ] g) :
logDeriv f =ᶠ[codiscrete ] logDeriv g :=
logDeriv_congr_codiscreteWithin isOpen_univ h
@[simp]
theorem logDeriv_id (x : ) : logDeriv id x = 1 / x := by
simp [logDeriv_apply]
@[simp] theorem logDeriv_id' (x : ) : logDeriv (·) x = 1 / x := logDeriv_id x
@[simp]
theorem logDeriv_const (a : ') : logDeriv (fun _ : ↦ a) = 0 := by
ext
simp [logDeriv_apply]
@[to_fun logDeriv_fun_mul]
theorem logDeriv_mul {f g : → '} (x : ) (hf : f x ≠ 0) (hg : g x ≠ 0)
(hdf : DifferentiableAt f x) (hdg : DifferentiableAt g x) :
logDeriv (f * g) x = logDeriv f x + logDeriv g x := by
simp [field, logDeriv_apply, *]
@[to_fun logDeriv_fun_div]
theorem logDeriv_div {f g : → '} (x : ) (hf : f x ≠ 0) (hg : g x ≠ 0)
(hdf : DifferentiableAt f x) (hdg : DifferentiableAt g x) :
logDeriv (f / g) x = logDeriv f x - logDeriv g x := by
simp [field, logDeriv_apply, *]
theorem logDeriv_mul_const {f : → '} (x : ) (a : ') (ha : a ≠ 0) :
logDeriv (fun z => f z * a) x = logDeriv f x := by
simp only [logDeriv_apply, deriv_mul_const_field, mul_div_mul_right _ _ ha]
theorem logDeriv_const_mul {f : → '} (x : ) (a : ') (ha : a ≠ 0) :
logDeriv (fun z => a * f z) x = logDeriv f x := by
simp only [logDeriv_apply, deriv_const_mul_field, mul_div_mul_left _ _ ha]
/-- The logarithmic derivative of a finite product is the sum of the logarithmic derivatives. -/
@[to_fun logDeriv_fun_prod]
theorem logDeriv_prod {ι : Type*} {s : Finset ι} {f : ι → → '} {x : } (hf : ∀ i ∈ s, f i x ≠ 0)
(hd : ∀ i ∈ s, DifferentiableAt (f i) x) :
logDeriv (∏ i ∈ s, f i) x = ∑ i ∈ s, logDeriv (f i) x := by
induction s using Finset.cons_induction with
| empty => simp [Pi.one_def]
| cons a s ha ih =>
rw [Finset.forall_mem_cons] at hf hd
rw [Finset.prod_cons, Finset.sum_cons, logDeriv_mul, ih hf.2 hd.2]
· exact hf.1
· simpa [Finset.prod_eq_zero_iff] using hf.2
· exact hd.1
· exact .finsetProd hd.2
lemma logDeriv_fun_zpow {f : → '} {x : } (hdf : DifferentiableAt f x) (n : ℤ) :
logDeriv (f · ^ n) x = n * logDeriv f x := by
rcases eq_or_ne n 0 with rfl | hn; · simp
rcases eq_or_ne (f x) 0 with hf | hf
· simp [logDeriv_apply, zero_zpow, *]
· rw [logDeriv_apply, ← comp_def (· ^ n), deriv_comp _ (differentiableAt_zpow.2 <| .inl hf) hdf,
deriv_zpow, logDeriv_apply]
simp [field, zpow_sub_one₀ hf]
lemma logDeriv_fun_pow {f : → '} {x : } (hdf : DifferentiableAt f x) (n : ℕ) :
logDeriv (f · ^ n) x = n * logDeriv f x :=
mod_cast logDeriv_fun_zpow hdf n
@[simp]
lemma logDeriv_zpow (x : ) (n : ℤ) : logDeriv (· ^ n) x = n / x := by
rw [logDeriv_fun_zpow (by fun_prop), logDeriv_id', mul_one_div]
@[simp]
lemma logDeriv_pow (x : ) (n : ℕ) : logDeriv (· ^ n) x = n / x :=
mod_cast logDeriv_zpow x n
@[simp] lemma logDeriv_inv (x : ) : logDeriv (·⁻¹) x = -1 / x := by
simpa using logDeriv_zpow x (-1)
@[to_fun logDeriv_fun_comp]
theorem logDeriv_comp {f : ' → '} {g : → '} {x : } (hf : DifferentiableAt ' f (g x))
(hg : DifferentiableAt g x) : logDeriv (f ∘ g) x = logDeriv f (g x) * deriv g x := by
simp only [logDeriv, Pi.div_apply, deriv_comp _ hf hg, comp_apply]
ring
@[simp] theorem logDeriv_neg (f : → ') : logDeriv (fun x ↦ -f x) = logDeriv f := by
funext; simp [logDeriv_apply, neg_div_neg_eq]
@[simp] theorem logDeriv_comp_neg (f : → ') (x : ) :
logDeriv (fun x ↦ f (-x)) x = -logDeriv f (-x) := by
simp [logDeriv_apply, deriv_comp_neg, field]
lemma logDeriv_eqOn_iff [IsRCLikeNormedField ] {f g : → '} {s : Set }
(hf : DifferentiableOn f s) (hg : DifferentiableOn g s)
(hs2 : IsOpen s) (hsc : IsPreconnected s) (hgn : ∀ x ∈ s, g x ≠ 0) (hfn : ∀ x ∈ s, f x ≠ 0) :
EqOn (logDeriv f) (logDeriv g) s ↔ ∃ z : ', z ≠ 0 ∧ EqOn f (z • g) s := by
rcases s.eq_empty_or_nonempty with rfl | ⟨t, ht⟩
· simpa using ⟨1, one_ne_zero⟩
· constructor
· refine fun h ↦ ⟨f t * (g t)⁻¹, by grind, fun y hy ↦ ?_⟩
have hderiv : s.EqOn (deriv (f * g⁻¹)) (deriv f * g⁻¹ - f * deriv g / g ^ 2) := by
intro z hz
rw [deriv_mul (hf.differentiableAt (hs2.mem_nhds hz)) ((hg.differentiableAt
(hs2.mem_nhds hz)).inv (hgn z hz))]
simp only [Pi.inv_apply, show g⁻¹ = (fun x => x⁻¹) ∘ g by rfl, deriv_inv, neg_mul,
deriv_comp z (differentiableAt_inv (hgn z hz)) (hg.differentiableAt (hs2.mem_nhds hz)),
mul_neg, Pi.sub_apply, Pi.mul_apply, comp_apply, Pi.div_apply, Pi.pow_apply]
ring
have hfg : EqOn (deriv (f * g⁻¹)) 0 s := hderiv.trans fun z hz ↦ by
simp only [Pi.sub_apply, Pi.mul_apply, Pi.inv_apply, Pi.div_apply, Pi.pow_apply,
Pi.zero_apply]
grind [logDeriv_apply, Pi.div_apply]
let := IsRCLikeNormedField.rclike
obtain ⟨a, ha⟩ := hs2.exists_is_const_of_deriv_eq_zero hsc (hf.mul (hg.inv hgn)) hfg
grind [Pi.mul_apply, Pi.inv_apply, Pi.smul_apply, smul_eq_mul]
· rintro ⟨z, hz0, hz⟩ x hx
simp [logDeriv_apply, hz.deriv hs2 hx, hz hx, deriv_const_smul _
(hg.differentiableAt (hs2.mem_nhds hx)), mul_div_mul_left (deriv g x) (g x) hz0]
/-- At a simple zero of an analytic function, the logarithmic residue
`(w - x) * logDeriv f w` tends to 1. -/
theorem AnalyticAt.tendsto_mul_logDeriv_simple_zero [CompleteSpace ]
{f : → } {x : }
(hf : AnalyticAt f x) (hfx : f x = 0) (hf' : deriv f x ≠ 0) :
Filter.Tendsto (fun w => (w - x) * logDeriv f w)
([≠] x) ( 1) := by
have h_slope := hasDerivAt_iff_tendsto_slope.mp hf.differentiableAt.hasDerivAt
rw [← div_self hf']
convert hf.deriv.continuousAt.tendsto.mono_left nhdsWithin_le_nhds |>.div h_slope hf'
simp [logDeriv, slope, hfx]
field
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|
|
|
|
|