File size: 4,094 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | import Mathlib
namespace OAI
noncomputable section
open scoped BigOperators
namespace Problem367.ExponentialTaylor
theorem norm_exp_I_taylor_two_le (x : β) :
βComplex.exp ((x : β) * Complex.I) - 1 - (x : β) * Complex.I +
(x : β) ^ 2 / 2β β€ 4 * |x| ^ 3 := by
have hnorm : β(x : β) * Complex.Iβ = |x| := by simp
by_cases hx : |x| β€ 1
Β· have h := Complex.exp_bound (x := (x : β) * Complex.I)
(by simpa only [hnorm] using hx) (n := 3) (by norm_num)
have heq : (β m β Finset.range 3,
((x : β) * Complex.I) ^ m / (m.factorial : β)) =
1 + (x : β) * Complex.I - (x : β) ^ 2 / 2 := by
norm_num [Finset.sum_range_succ, mul_pow, Complex.I_sq]
ring
rw [heq, hnorm] at h
norm_num at h
have heq' : Complex.exp ((x : β) * Complex.I) - 1 - (x : β) * Complex.I +
(x : β) ^ 2 / 2 =
Complex.exp ((x : β) * Complex.I) -
(1 + (x : β) * Complex.I - (x : β) ^ 2 / 2) := by ring
rw [heq']
exact h.trans (by nlinarith [abs_nonneg x, pow_nonneg (abs_nonneg x) 3])
Β· have hx1 : 1 β€ |x| := (lt_of_not_ge hx).le
have hsq : |x| β€ |x| ^ 2 := by nlinarith [abs_nonneg x]
have hcube : |x| ^ 2 β€ |x| ^ 3 := by nlinarith [sq_nonneg (|x| - 1)]
calc
_ β€ βComplex.exp ((x : β) * Complex.I) - 1 - (x : β) * Complex.Iβ +
β(x : β) ^ 2 / 2β := norm_add_le _ _
_ β€ (βComplex.exp ((x : β) * Complex.I) - 1β +
β(x : β) * Complex.Iβ) + β(x : β) ^ 2 / 2β := by
gcongr
exact norm_sub_le _ _
_ β€ ((βComplex.exp ((x : β) * Complex.I)β + β(1 : β)β) +
β(x : β) * Complex.Iβ) + β(x : β) ^ 2 / 2β := by
gcongr
exact norm_sub_le _ _
_ = 2 + |x| + |x| ^ 2 / 2 := by norm_num
_ β€ 4 * |x| ^ 3 := by nlinarith
theorem norm_exp_I_mul_taylor_two_le (a x : β) :
βComplex.exp (((a * x : β) : β) * Complex.I) - 1 -
((a * x : β) : β) * Complex.I + (((a * x : β) : β) ^ 2) / 2β β€
4 * |a| ^ 3 * |x| ^ 3 := by
simpa only [abs_mul, mul_pow, mul_assoc] using norm_exp_I_taylor_two_le (a * x)
theorem norm_exp_neg_sub_one_add_le_sq {x : β} (hx : 0 β€ x) :
βComplex.exp ((-x : β) : β) - 1 + (x : β)β β€ x ^ 2 := by
have heq : Complex.exp ((-x : β) : β) - 1 + (x : β) =
((Real.exp (-x) - 1 + x : β) : β) := by simp
rw [heq, Complex.norm_real, Real.norm_eq_abs]
by_cases hsmall : x β€ 1
Β· have h := Real.norm_exp_sub_one_sub_id_le (x := -x) (by simpa [abs_of_nonneg hx] using hsmall)
simpa only [Real.norm_eq_abs, sub_neg_eq_add, sq_abs, neg_sq] using h
Β· have hlarge : 1 β€ x := (lt_of_not_ge hsmall).le
have hnonneg : 0 β€ Real.exp (-x) - 1 + x := by
linarith [Real.add_one_le_exp (-x)]
rw [abs_of_nonneg hnonneg]
have hbound : Real.exp (-x) β€ 1 := Real.exp_le_one_iff.mpr (neg_nonpos.mpr hx)
nlinarith
theorem norm_recurrence_error_le_sum
(z a : β β β) (e : β β β) (n : β)
(ha : β k < n, βa kβ β€ 1)
(he : β k < n, βz (k + 1) - a k * z kβ β€ e k) :
βz n - (β k β Finset.range n, a k) * z 0β β€
β k β Finset.range n, e k := by
induction n with
| zero => simp
| succ n ih =>
have hprev := ih (fun k hk => ha k (Nat.lt_succ_of_lt hk))
(fun k hk => he k (Nat.lt_succ_of_lt hk))
rw [Finset.prod_range_succ, Finset.sum_range_succ]
have heq : z (n + 1) - ((β k β Finset.range n, a k) * a n) * z 0 =
(z (n + 1) - a n * z n) +
a n * (z n - (β k β Finset.range n, a k) * z 0) := by ring
rw [heq]
calc
_ β€ βz (n + 1) - a n * z nβ +
βa n * (z n - (β k β Finset.range n, a k) * z 0)β := norm_add_le _ _
_ β€ e n + 1 * (β k β Finset.range n, e k) := by
apply add_le_add (he n (by omega))
rw [norm_mul]
exact mul_le_mul (ha n (by omega)) hprev (norm_nonneg _) (by norm_num)
_ = _ := by ring
end Problem367.ExponentialTaylor
end
end OAI
|