equal
deleted
inserted
replaced
233 |
233 |
234 |
234 |
235 subsection{*Embedding Properties for @{term complex_of_real} Map*} |
235 subsection{*Embedding Properties for @{term complex_of_real} Map*} |
236 |
236 |
237 abbreviation |
237 abbreviation |
238 complex_of_real :: "real => complex" |
238 complex_of_real :: "real => complex" where |
239 "complex_of_real == of_real" |
239 "complex_of_real == of_real" |
240 |
240 |
241 lemma complex_of_real_def: "complex_of_real r = Complex r 0" |
241 lemma complex_of_real_def: "complex_of_real r = Complex r 0" |
242 by (simp add: of_real_def complex_scaleR_def) |
242 by (simp add: of_real_def complex_scaleR_def) |
243 |
243 |
319 |
319 |
320 |
320 |
321 subsection{*Conjugation is an Automorphism*} |
321 subsection{*Conjugation is an Automorphism*} |
322 |
322 |
323 definition |
323 definition |
324 cnj :: "complex => complex" |
324 cnj :: "complex => complex" where |
325 "cnj z = Complex (Re z) (-Im z)" |
325 "cnj z = Complex (Re z) (-Im z)" |
326 |
326 |
327 lemma complex_cnj: "cnj (Complex x y) = Complex x (-y)" |
327 lemma complex_cnj: "cnj (Complex x y) = Complex x (-y)" |
328 by (simp add: cnj_def) |
328 by (simp add: cnj_def) |
329 |
329 |
383 |
383 |
384 defs (overloaded) |
384 defs (overloaded) |
385 complex_norm_def: "norm z == sqrt(Re(z) ^ 2 + Im(z) ^ 2)" |
385 complex_norm_def: "norm z == sqrt(Re(z) ^ 2 + Im(z) ^ 2)" |
386 |
386 |
387 abbreviation |
387 abbreviation |
388 cmod :: "complex => real" |
388 cmod :: "complex => real" where |
389 "cmod == norm" |
389 "cmod == norm" |
390 |
390 |
391 lemmas cmod_def = complex_norm_def |
391 lemmas cmod_def = complex_norm_def |
392 |
392 |
393 lemma complex_mod [simp]: "cmod (Complex x y) = sqrt(x ^ 2 + y ^ 2)" |
393 lemma complex_mod [simp]: "cmod (Complex x y) = sqrt(x ^ 2 + y ^ 2)" |
573 subsection{*The Function @{term sgn}*} |
573 subsection{*The Function @{term sgn}*} |
574 |
574 |
575 definition |
575 definition |
576 (*------------ Argand -------------*) |
576 (*------------ Argand -------------*) |
577 |
577 |
578 sgn :: "complex => complex" |
578 sgn :: "complex => complex" where |
579 "sgn z = z / complex_of_real(cmod z)" |
579 "sgn z = z / complex_of_real(cmod z)" |
580 |
580 |
581 arg :: "complex => real" |
581 definition |
|
582 arg :: "complex => real" where |
582 "arg z = (SOME a. Re(sgn z) = cos a & Im(sgn z) = sin a & -pi < a & a \<le> pi)" |
583 "arg z = (SOME a. Re(sgn z) = cos a & Im(sgn z) = sin a & -pi < a & a \<le> pi)" |
583 |
584 |
584 lemma sgn_zero [simp]: "sgn 0 = 0" |
585 lemma sgn_zero [simp]: "sgn 0 = 0" |
585 by (simp add: sgn_def) |
586 by (simp add: sgn_def) |
586 |
587 |
669 subsection{*Finally! Polar Form for Complex Numbers*} |
670 subsection{*Finally! Polar Form for Complex Numbers*} |
670 |
671 |
671 definition |
672 definition |
672 |
673 |
673 (* abbreviation for (cos a + i sin a) *) |
674 (* abbreviation for (cos a + i sin a) *) |
674 cis :: "real => complex" |
675 cis :: "real => complex" where |
675 "cis a = Complex (cos a) (sin a)" |
676 "cis a = Complex (cos a) (sin a)" |
676 |
677 |
|
678 definition |
677 (* abbreviation for r*(cos a + i sin a) *) |
679 (* abbreviation for r*(cos a + i sin a) *) |
678 rcis :: "[real, real] => complex" |
680 rcis :: "[real, real] => complex" where |
679 "rcis r a = complex_of_real r * cis a" |
681 "rcis r a = complex_of_real r * cis a" |
680 |
682 |
|
683 definition |
681 (* e ^ (x + iy) *) |
684 (* e ^ (x + iy) *) |
682 expi :: "complex => complex" |
685 expi :: "complex => complex" where |
683 "expi z = complex_of_real(exp (Re z)) * cis (Im z)" |
686 "expi z = complex_of_real(exp (Re z)) * cis (Im z)" |
684 |
687 |
685 lemma complex_split_polar: |
688 lemma complex_split_polar: |
686 "\<exists>r a. z = complex_of_real r * (Complex (cos a) (sin a))" |
689 "\<exists>r a. z = complex_of_real r * (Complex (cos a) (sin a))" |
687 apply (induct z) |
690 apply (induct z) |