Zulip Chat Archive

Stream: Is there code for X?

Topic: The iterated derivative of a sum is the sum of the iterated


Mark Andrew Gerads (Oct 14 2024 at 03:15):

I am trying to take the iterated derivative of a sum, and thus need something like this:

theorem iteratedDerivSum {๐•œ : Type u} [NontriviallyNormedField ๐•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace ๐•œ F] {x : ๐•œ} {ฮน : Type u_1}
  {u : Finset ฮน} {A : ฮน โ†’ ๐•œ โ†’ F} (k : โ„•) (h : โˆ€ i โˆˆ u, ContDiff ๐•œ k (A i)) :
  iteratedDeriv k (fun y => Finset.sum u fun i => A i y) x = Finset.sum u fun i => iteratedDeriv k (A i) x := by
  sorry

I only need it for complex numbers but figure there should be a general version in mathlib.

Mark Andrew Gerads (Oct 14 2024 at 04:17):

I just built a similar theorem:

theorem iteratedDerivSum {๐•œ : Type u} [NontriviallyNormedField ๐•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace ๐•œ F] {ฮน : Type u_1}
  {u : Finset ฮน} {A : ฮน โ†’ ๐•œ โ†’ F} (h : โˆ€ i โˆˆ u, ContDiff ๐•œ โŠค (A i)) :
  โˆ€ (k : โ„•), iteratedDeriv k (fun y => Finset.sum u fun i => A i y) = (fun y => Finset.sum u fun i => iteratedDeriv k (A i) y) := by
  intros k
  induction' k with K Kih
  ยท simp only [iteratedDeriv_zero, Finset.sum_apply]
  ยท have hโ‚€ := congrArg deriv Kih
    rw [iteratedDeriv_succ, hโ‚€]
    clear hโ‚€
    ext x
    have hโ‚ : (1 : โ„•โˆž) โ‰ค โŠค := by exact OrderTop.le_top 1
    have hโ‚‚ : โˆ€ i โˆˆ u, DifferentiableAt ๐•œ (iteratedDeriv K (A i)) x := by
      intros i ih
      have hโ‚ƒ := ContDiff.iterate_deriv K (h i ih)
      rw [โ†iteratedDeriv_eq_iterate] at hโ‚ƒ
      exact ContDiffAt.differentiableAt (ContDiff.contDiffAt hโ‚ƒ) hโ‚
    rw [deriv_sum hโ‚‚]
    simp_rw [iteratedDeriv_succ]

Eric Wieser (Oct 14 2024 at 10:47):

is this docs#map_finset_sum ?

Eric Wieser (Oct 14 2024 at 10:49):

Hmm, maybe the lemma I'm thinking of is in an open PR, let me find it

Eric Wieser (Oct 14 2024 at 10:55):

docs#MultilinearMap.map_sum_finset, which seems misnamed

Eric Wieser (Oct 14 2024 at 11:20):

I think this is the start of the right approach:

import Mathlib

variable
    {๐•œ : Type u} [NontriviallyNormedField ๐•œ]
    {F : Type v} [NormedAddCommGroup E] [NormedSpace ๐•œ E]
    {F : Type v} [NormedAddCommGroup F] [NormedSpace ๐•œ F]

@[simp]
theorem HasFTaylorSeriesUpTo.zero {k} :
    HasFTaylorSeriesUpTo (๐•œ := ๐•œ) k (0 : E โ†’ F) 0 where
  zero_eq x := rfl
  fderiv _ _ x := hasFDerivAt_zero_of_eventually_const 0 (by simp)
  cont _ _ := continuous_const

theorem HasFTaylorSeriesUpTo.add
    {A B : E โ†’ F}
    {A' B' : E โ†’ FormalMultilinearSeries ๐•œ E F}
    (hA : HasFTaylorSeriesUpTo k A A')
    (hB : HasFTaylorSeriesUpTo k B B') :
    HasFTaylorSeriesUpTo k (A + B) (A' + B') where
  zero_eq x := congr($(hA.zero_eq x) + $(hB.zero_eq x))
  fderiv m hm x := (hA.fderiv m hm x).add (hB.fderiv m hm x)
  cont m hm := (hA.cont m hm).add (hB.cont m hm)

theorem HasFTaylorSeriesUpTo.sum
    {ฮน : Type u_1}
    {u : Finset ฮน} {A : ฮน โ†’ E โ†’ F}
    (A' : ฮน โ†’ E โ†’ FormalMultilinearSeries ๐•œ E F)
    (h : โˆ€ i, HasFTaylorSeriesUpTo (๐•œ := ๐•œ) k (A i) (A' i)) :
    HasFTaylorSeriesUpTo k (fun y => Finset.sum u fun i => A i y) (fun y => Finset.sum u fun i => A' i y) := by
  induction u using Finset.cons_induction with
  | empty => exact .zero
  | cons a s ha ih =>
    simp_rw [Finset.sum_cons]
    exact .add (h _) ih

Eric Wieser (Oct 14 2024 at 11:24):

Or docs#iteratedFDeriv_sum


Last updated: May 02 2025 at 03:31 UTC