/// <summary> /// e. g. Log(2, 32) = 5 /// </summary> /// <param name="base"> /// Log's base, log(base, x) is a number y such that base^y = x /// </param> /// <param name="x"> /// The number of which we want to get its base power /// </param> /// <returns></returns> public static ComplexNumber Log(RealNumber @base, Number x) { var baseCom = @base.AsComplexNumber(); var poweredCom = x.AsComplexNumber(); if (baseCom.IsDefinite() && poweredCom.IsDefinite()) { return(Functional.Downcast( Complex.Log(x.AsComplex(), @base.AsDouble()) ) as ComplexNumber); } else { return(ComplexNumber.Indefinite(RealNumber.UndefinedState.NAN)); } }
/// <summary> /// Calculates the exact value of arccotangent of num /// </summary> /// <param name="num"></param> /// <returns></returns> public static ComplexNumber Arccotan(Number num) => (num as ComplexNumber).IsDefinite() ? Functional.Downcast(Complex.Atan(1 / num.AsComplex())) as ComplexNumber : RealNumber.NaN();
/// <summary> /// Calculates the exact value of cosine of num /// </summary> /// <param name="num"></param> /// <returns></returns> public static ComplexNumber Cos(Number num) => (num as ComplexNumber).IsDefinite() ? Functional.Downcast(Complex.Cos(num.AsComplex())) as ComplexNumber : RealNumber.NaN();