1175 fixes z::complex |
1175 fixes z::complex |
1176 assumes "z \<noteq> 0" "n \<noteq> 0" |
1176 assumes "z \<noteq> 0" "n \<noteq> 0" |
1177 obtains w where "w \<noteq> 0" "z = w ^ n" |
1177 obtains w where "w \<noteq> 0" "z = w ^ n" |
1178 by (metis exists_complex_root [of n z] assms power_0_left) |
1178 by (metis exists_complex_root [of n z] assms power_0_left) |
1179 |
1179 |
1180 subsection\<open>The Unwinding Number and the Ln-product Formula\<close> |
|
1181 |
|
1182 text\<open>Note that in this special case the unwinding number is -1, 0 or 1.\<close> |
|
1183 |
|
1184 definition unwinding :: "complex \<Rightarrow> complex" where |
|
1185 "unwinding(z) = (z - Ln(exp z)) / (of_real(2*pi) * \<i>)" |
|
1186 |
|
1187 lemma unwinding_2pi: "(2*pi) * \<i> * unwinding(z) = z - Ln(exp z)" |
|
1188 by (simp add: unwinding_def) |
|
1189 |
|
1190 lemma Ln_times_unwinding: |
|
1191 "w \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> Ln(w * z) = Ln(w) + Ln(z) - (2*pi) * \<i> * unwinding(Ln w + Ln z)" |
|
1192 using unwinding_2pi by (simp add: exp_add) |
|
1193 |
|
1194 |
|
1195 subsection\<open>Derivative of Ln away from the branch cut\<close> |
1180 subsection\<open>Derivative of Ln away from the branch cut\<close> |
1196 |
1181 |
1197 lemma |
1182 lemma |
1198 assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" |
1183 assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" |
1199 shows has_field_derivative_Ln: "(Ln has_field_derivative inverse(z)) (at z)" |
1184 shows has_field_derivative_Ln: "(Ln has_field_derivative inverse(z)) (at z)" |
1462 |
1447 |
1463 corollary Ln_times_of_real: |
1448 corollary Ln_times_of_real: |
1464 "\<lbrakk>r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(of_real r * z) = ln r + Ln(z)" |
1449 "\<lbrakk>r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(of_real r * z) = ln r + Ln(z)" |
1465 using mpi_less_Im_Ln Im_Ln_le_pi |
1450 using mpi_less_Im_Ln Im_Ln_le_pi |
1466 by (force simp: Ln_times) |
1451 by (force simp: Ln_times) |
|
1452 |
|
1453 corollary Ln_times_Reals: |
|
1454 "\<lbrakk>r \<in> Reals; Re r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(r * z) = ln (Re r) + Ln(z)" |
|
1455 using Ln_Reals_eq Ln_times_of_real by fastforce |
1467 |
1456 |
1468 corollary Ln_divide_of_real: |
1457 corollary Ln_divide_of_real: |
1469 "\<lbrakk>r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(z / of_real r) = Ln(z) - ln r" |
1458 "\<lbrakk>r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(z / of_real r) = Ln(z) - ln r" |
1470 using Ln_times_of_real [of "inverse r" z] |
1459 using Ln_times_of_real [of "inverse r" z] |
1471 by (simp add: ln_inverse Ln_of_real mult.commute divide_inverse of_real_inverse [symmetric] |
1460 by (simp add: ln_inverse Ln_of_real mult.commute divide_inverse of_real_inverse [symmetric] |
1569 shows "(\<lambda>x. f x powr g x :: complex) \<in> measurable M borel" |
1558 shows "(\<lambda>x. f x powr g x :: complex) \<in> measurable M borel" |
1570 using assms by (simp add: powr_def) |
1559 using assms by (simp add: powr_def) |
1571 |
1560 |
1572 subsection\<open>The Argument of a Complex Number\<close> |
1561 subsection\<open>The Argument of a Complex Number\<close> |
1573 |
1562 |
|
1563 text\<open>Finally: it's is defined for the same interval as the complex logarithm: $(-\pi,\pi]$.\<close> |
|
1564 |
1574 definition Arg :: "complex \<Rightarrow> real" where "Arg z \<equiv> (if z = 0 then 0 else Im (Ln z))" |
1565 definition Arg :: "complex \<Rightarrow> real" where "Arg z \<equiv> (if z = 0 then 0 else Im (Ln z))" |
1575 |
|
1576 text\<open>Finally the Argument is defined for the same interval as the complex logarithm: $(-\pi,\pi]$.\<close> |
|
1577 |
1566 |
1578 lemma Arg_of_real: "Arg (of_real r) = (if r<0 then pi else 0)" |
1567 lemma Arg_of_real: "Arg (of_real r) = (if r<0 then pi else 0)" |
1579 by (simp add: Im_Ln_eq_pi Arg_def) |
1568 by (simp add: Im_Ln_eq_pi Arg_def) |
1580 |
1569 |
1581 lemma mpi_less_Arg: "-pi < Arg z" |
1570 lemma mpi_less_Arg: "-pi < Arg z" |
1585 lemma |
1574 lemma |
1586 assumes "z \<noteq> 0" |
1575 assumes "z \<noteq> 0" |
1587 shows Arg_eq: "z = of_real(norm z) * exp(\<i> * Arg z)" |
1576 shows Arg_eq: "z = of_real(norm z) * exp(\<i> * Arg z)" |
1588 using assms exp_Ln exp_eq_polar |
1577 using assms exp_Ln exp_eq_polar |
1589 by (auto simp: Arg_def) |
1578 by (auto simp: Arg_def) |
|
1579 |
|
1580 lemma is_Arg_Arg: "z \<noteq> 0 \<Longrightarrow> is_Arg z (Arg z)" |
|
1581 by (simp add: Arg_eq is_Arg_def) |
1590 |
1582 |
1591 lemma Argument_exists: |
1583 lemma Argument_exists: |
1592 assumes "z \<noteq> 0" and R: "R = {r-pi<..r+pi}" |
1584 assumes "z \<noteq> 0" and R: "R = {r-pi<..r+pi}" |
1593 obtains s where "is_Arg z s" "s\<in>R" |
1585 obtains s where "is_Arg z s" "s\<in>R" |
1594 proof - |
1586 proof - |
1780 qed (use assms in auto) |
1772 qed (use assms in auto) |
1781 qed |
1773 qed |
1782 |
1774 |
1783 lemma continuous_within_Arg: "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> continuous (at z within S) Arg" |
1775 lemma continuous_within_Arg: "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> continuous (at z within S) Arg" |
1784 using continuous_at_Arg continuous_at_imp_continuous_within by blast |
1776 using continuous_at_Arg continuous_at_imp_continuous_within by blast |
|
1777 |
|
1778 |
|
1779 subsection\<open>The Unwinding Number and the Ln-product Formula\<close> |
|
1780 |
|
1781 text\<open>Note that in this special case the unwinding number is -1, 0 or 1. But it's always an integer.\<close> |
|
1782 |
|
1783 lemma is_Arg_exp_Im: "is_Arg (exp z) (Im z)" |
|
1784 using exp_eq_polar is_Arg_def norm_exp_eq_Re by auto |
|
1785 |
|
1786 lemma is_Arg_exp_diff_2pi: |
|
1787 assumes "is_Arg (exp z) \<theta>" |
|
1788 shows "\<exists>k. Im z - of_int k * (2 * pi) = \<theta>" |
|
1789 proof (intro exI is_Arg_eqI) |
|
1790 let ?k = "\<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor>" |
|
1791 show "is_Arg (exp z) (Im z - real_of_int ?k * (2 * pi))" |
|
1792 by (metis diff_add_cancel is_Arg_2pi_iff is_Arg_exp_Im) |
|
1793 show "\<bar>Im z - real_of_int ?k * (2 * pi) - \<theta>\<bar> < 2 * pi" |
|
1794 using floor_divide_upper [of "2*pi" "Im z - \<theta>"] floor_divide_lower [of "2*pi" "Im z - \<theta>"] |
|
1795 by (auto simp: algebra_simps abs_if) |
|
1796 qed (auto simp: is_Arg_exp_Im assms) |
|
1797 |
|
1798 lemma Arg_exp_diff_2pi: "\<exists>k. Im z - of_int k * (2 * pi) = Arg (exp z)" |
|
1799 using is_Arg_exp_diff_2pi [OF is_Arg_Arg] by auto |
|
1800 |
|
1801 lemma unwinding_in_Ints: "(z - Ln(exp z)) / (of_real(2*pi) * \<i>) \<in> \<int>" |
|
1802 using Arg_exp_diff_2pi [of z] |
|
1803 by (force simp: Ints_def image_def field_simps Arg_def intro!: complex_eqI) |
|
1804 |
|
1805 definition unwinding :: "complex \<Rightarrow> int" where |
|
1806 "unwinding z \<equiv> THE k. of_int k = (z - Ln(exp z)) / (of_real(2*pi) * \<i>)" |
|
1807 |
|
1808 lemma unwinding: "of_int (unwinding z) = (z - Ln(exp z)) / (of_real(2*pi) * \<i>)" |
|
1809 using unwinding_in_Ints [of z] |
|
1810 unfolding unwinding_def Ints_def by force |
|
1811 |
|
1812 lemma unwinding_2pi: "(2*pi) * \<i> * unwinding(z) = z - Ln(exp z)" |
|
1813 by (simp add: unwinding) |
|
1814 |
|
1815 lemma Ln_times_unwinding: |
|
1816 "w \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> Ln(w * z) = Ln(w) + Ln(z) - (2*pi) * \<i> * unwinding(Ln w + Ln z)" |
|
1817 using unwinding_2pi by (simp add: exp_add) |
1785 |
1818 |
1786 |
1819 |
1787 subsection\<open>Relation between Ln and Arg2pi, and hence continuity of Arg2pi\<close> |
1820 subsection\<open>Relation between Ln and Arg2pi, and hence continuity of Arg2pi\<close> |
1788 |
1821 |
1789 lemma Arg2pi_Ln: |
1822 lemma Arg2pi_Ln: |