(* ========================================================================= *)
(* Complex transcendental functions. *)
(* ========================================================================= *)
needs "Library/transc.ml";;
needs "Library/floor.ml";;
needs "Complex/complexnumbers.ml";;
unparse_as_infix "exp";;
remove_interface "exp";;
(* ------------------------------------------------------------------------- *)
(* Complex square roots. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Complex exponential. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Complex trig functions. *)
(* ------------------------------------------------------------------------- *)
let CX_CSIN,CX_CCOS = (CONJ_PAIR o prove)
(`(!x. Cx(sin x) = csin(Cx x)) /\ (!x. Cx(cos x) = ccos(Cx x))`,
REWRITE_TAC[csin; ccos; cexp; CX_DEF; ii; RE; IM; complex_mul; complex_add;
REAL_MUL_RZERO; REAL_MUL_LZERO; REAL_SUB_RZERO;
REAL_MUL_LID; complex_neg; REAL_EXP_0; REAL_ADD_LID;
REAL_MUL_LNEG; REAL_NEG_0; REAL_ADD_RID; complex_sub;
SIN_NEG; COS_NEG; GSYM REAL_MUL_2; GSYM real_sub;
complex_div; REAL_SUB_REFL; complex_inv; REAL_SUB_RNEG] THEN
CONJ_TAC THEN GEN_TAC THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN
REWRITE_TAC[REAL_MUL_RZERO] THEN
AP_TERM_TAC THEN AP_THM_TAC THEN AP_TERM_TAC THEN CONV_TAC REAL_RING);;
(* ------------------------------------------------------------------------- *)
(* Euler and de Moivre formulas. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Some lemmas. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Complex logarithms (the conventional principal value). *)
(* ------------------------------------------------------------------------- *)
let clog = new_definition
`clog z = @w. cexp(w) = z /\ --pi < Im(w) /\ Im(w) <= pi`;;
(* ------------------------------------------------------------------------- *)
(* Unwinding number. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* An example of how to get nice identities with unwinding number. *)
(* ------------------------------------------------------------------------- *)