Browse Source

Trig: use common short names for trig functions

pull/163/head
Christoph Ruegg 13 years ago
parent
commit
ba77fb9bc9
  1. 56
      src/FSharp/Complex.fs
  2. 91
      src/FSharp/Complex.fsi
  3. 18
      src/Numerics/Complex32.cs
  4. 20
      src/Numerics/Complex64.cs
  5. 232
      src/Numerics/Trigonometry.cs
  6. 96
      src/UnitTests/TrigonometryTest.cs

56
src/FSharp/Complex.fs

@ -58,22 +58,30 @@ namespace MathNet.Numerics
let sin x = Complex.Sin(x) let sin x = Complex.Sin(x)
let cos x = Complex.Cos(x) let cos x = Complex.Cos(x)
let tan x = Complex.Tan(x) let tan x = Complex.Tan(x)
let cot (x:complex) = Trig.Cot(x)
let sec (x:complex) = Trig.Sec(x)
let csc (x:complex) = Trig.Csc(x)
let asin x = Complex.Asin(x) let asin x = Complex.Asin(x)
let acos x = Complex.Acos(x) let acos x = Complex.Acos(x)
let atan x = Complex.Atan(x) let atan x = Complex.Atan(x)
let acot (x:complex) = Trig.Acot(x)
let asec (x:complex) = Trig.Asec(x)
let acsc (x:complex) = Trig.Acsc(x)
let sinh x = Complex.Sinh(x) let sinh x = Complex.Sinh(x)
let cosh x = Complex.Cosh(x) let cosh x = Complex.Cosh(x)
let tanh x = Complex.Tanh(x) let tanh x = Complex.Tanh(x)
let coth (x:complex) = Trig.Coth(x)
let sech (x:complex) = Trig.Sech(x)
let csch (x:complex) = Trig.Csch(x)
let sec (x:complex) = Trig.Secant(x) let asinh (x:complex) = Trig.Asinh(x)
let csc (x:complex) = Trig.Cosecant(x) let acosh (x:complex) = Trig.Acosh(x)
let cot (x:complex) = Trig.Cotangent(x) let atanh (x:complex) = Trig.Atanh(x)
let asec (x:complex) = Trig.InverseSecant(x) let acoth (x:complex) = Trig.Acoth(x)
let acsc (x:complex) = Trig.InverseCosecant(x) let asech (x:complex) = Trig.Asech(x)
let acot (x:complex) = Trig.InverseCotangent(x) let acsch (x:complex) = Trig.Acsch(x)
let sech (x:complex) = Trig.HyperbolicSecant(x)
let csch (x:complex) = Trig.HyperbolicCosecant(x)
let coth (x:complex) = Trig.HyperbolicCotangent(x)
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<RequireQualifiedAccess>] [<RequireQualifiedAccess>]
@ -114,26 +122,34 @@ namespace MathNet.Numerics
let sqr (x:complex32) = x.Square() let sqr (x:complex32) = x.Square()
let sqrt (x:complex32) = x.SquareRoot() // numerically more stable than Complex.Sqrt let sqrt (x:complex32) = x.SquareRoot() // numerically more stable than Complex.Sqrt
// no complex32 implementations available yet for some, fix once available
let sin x = Complex32.Sin(x) let sin x = Complex32.Sin(x)
let cos x = Complex32.Cos(x) let cos x = Complex32.Cos(x)
let tan x = Complex32.Tan(x) let tan x = Complex32.Tan(x)
let cot (x:complex32) = ofComplex <| Trig.Cot(x.ToComplex())
let sec (x:complex32) = ofComplex <| Trig.Sec(x.ToComplex())
let csc (x:complex32) = ofComplex <| Trig.Csc(x.ToComplex())
let asin x = Complex32.Asin(x) let asin x = Complex32.Asin(x)
let acos x = Complex32.Acos(x) let acos x = Complex32.Acos(x)
let atan x = Complex32.Atan(x) let atan x = Complex32.Atan(x)
let acot (x:complex32) = ofComplex <| Trig.Acot(x.ToComplex())
let asec (x:complex32) = ofComplex <| Trig.Asec(x.ToComplex())
let acsc (x:complex32) = ofComplex <| Trig.Acsc(x.ToComplex())
let sinh x = Complex32.Sinh(x) let sinh x = Complex32.Sinh(x)
let cosh x = Complex32.Cosh(x) let cosh x = Complex32.Cosh(x)
let tanh x = Complex32.Tanh(x) let tanh x = Complex32.Tanh(x)
let coth (x:complex32) = ofComplex <| Trig.Coth(x.ToComplex())
// no complex32 implementations available yet, fix once available let sech (x:complex32) = ofComplex <| Trig.Sech(x.ToComplex())
let sec (x:complex32) = ofComplex <| Trig.Secant(x.ToComplex()) let csch (x:complex32) = ofComplex <| Trig.Csch(x.ToComplex())
let csc (x:complex32) = ofComplex <| Trig.Cosecant(x.ToComplex())
let cot (x:complex32) = ofComplex <| Trig.Cotangent(x.ToComplex()) let asinh (x:complex32) = ofComplex <| Trig.Asinh(x.ToComplex())
let asec (x:complex32) = ofComplex <| Trig.InverseSecant(x.ToComplex()) let acosh (x:complex32) = ofComplex <| Trig.Acosh(x.ToComplex())
let acsc (x:complex32) = ofComplex <| Trig.InverseCosecant(x.ToComplex()) let atanh (x:complex32) = ofComplex <| Trig.Atanh(x.ToComplex())
let acot (x:complex32) = ofComplex <| Trig.InverseCotangent(x.ToComplex()) let acoth (x:complex32) = ofComplex <| Trig.Acoth(x.ToComplex())
let sech (x:complex32) = ofComplex <| Trig.HyperbolicSecant(x.ToComplex()) let asech (x:complex32) = ofComplex <| Trig.Asech(x.ToComplex())
let csch (x:complex32) = ofComplex <| Trig.HyperbolicCosecant(x.ToComplex()) let acsch (x:complex32) = ofComplex <| Trig.Acsch(x.ToComplex())
let coth (x:complex32) = ofComplex <| Trig.HyperbolicCotangent(x.ToComplex())
[<AutoOpen>] [<AutoOpen>]
module ComplexExtensions = module ComplexExtensions =

91
src/FSharp/Complex.fsi

@ -79,44 +79,58 @@ namespace MathNet.Numerics
val sqr : complex -> complex val sqr : complex -> complex
/// sqrt(x) and 0 <= phase(x) < pi /// sqrt(x) and 0 <= phase(x) < pi
val sqrt : complex -> complex val sqrt : complex -> complex
/// Sine /// Sine
val sin : complex -> complex val sin : complex -> complex
/// Cosine /// Cosine
val cos : complex -> complex val cos : complex -> complex
/// Tagent /// Tagent
val tan : complex -> complex val tan : complex -> complex
/// Cotangent
val cot : complex -> complex
/// Secant
val sec : complex -> complex
/// Cosecant
val csc : complex -> complex
/// Arc Sine /// Arc Sine
val asin : complex -> complex val asin : complex -> complex
/// Arc Cosine /// Arc Cosine
val acos : complex -> complex val acos : complex -> complex
/// Arc Tagent /// Arc Tagent
val atan : complex -> complex val atan : complex -> complex
/// Arc Cotangent
val acot : complex -> complex
/// Arc Secant
val asec : complex -> complex
/// Arc Cosecant
val acsc : complex -> complex
/// Hyperbolic Sine /// Hyperbolic Sine
val sinh : complex -> complex val sinh : complex -> complex
/// Hyperbolic Cosine /// Hyperbolic Cosine
val cosh : complex -> complex val cosh : complex -> complex
/// Hyperbolic Tagent /// Hyperbolic Tagent
val tanh : complex -> complex val tanh : complex -> complex
/// Hyperbolic Cotangent
/// Secant val coth : complex -> complex
val sec : complex -> complex
/// Cosecant
val csc : complex -> complex
/// Cotangent
val cot : complex -> complex
/// Arc Secant
val asec : complex -> complex
/// Arc Cosecant
val acsc : complex -> complex
/// Arc Cotangent
val acot : complex -> complex
/// Hyperbolic Secant /// Hyperbolic Secant
val sech : complex -> complex val sech : complex -> complex
/// Hyperbolic Cosecant /// Hyperbolic Cosecant
val csch : complex -> complex val csch : complex -> complex
/// Hyperbolic Cotangent
val coth : complex -> complex /// Inverse Hyperbolic Sine
val asinh : complex -> complex
/// Inverse Hyperbolic Cosine
val acosh : complex -> complex
/// Inverse Hyperbolic Tagent
val atanh : complex -> complex
/// Inverse Hyperbolic Cotangent
val acoth : complex -> complex
/// Inverse Hyperbolic Secant
val asech : complex -> complex
/// Inverse Hyperbolic Cosecant
val acsch : complex -> complex
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<RequireQualifiedAccess>] [<RequireQualifiedAccess>]
@ -189,37 +203,52 @@ namespace MathNet.Numerics
val cos : complex32 -> complex32 val cos : complex32 -> complex32
/// Tagent /// Tagent
val tan : complex32 -> complex32 val tan : complex32 -> complex32
/// Cotangent
val cot : complex32 -> complex32
/// Secant
val sec : complex32 -> complex32
/// Cosecant
val csc : complex32 -> complex32
/// Arc Sine /// Arc Sine
val asin : complex32 -> complex32 val asin : complex32 -> complex32
/// Arc Cosine /// Arc Cosine
val acos : complex32 -> complex32 val acos : complex32 -> complex32
/// Arc Tagent /// Arc Tagent
val atan : complex32 -> complex32 val atan : complex32 -> complex32
/// Arc Cotangent
val acot : complex32 -> complex32
/// Arc Secant
val asec : complex32 -> complex32
/// Arc Cosecant
val acsc : complex32 -> complex32
/// Hyperbolic Sine /// Hyperbolic Sine
val sinh : complex32 -> complex32 val sinh : complex32 -> complex32
/// Hyperbolic Cosine /// Hyperbolic Cosine
val cosh : complex32 -> complex32 val cosh : complex32 -> complex32
/// Hyperbolic Tagent /// Hyperbolic Tagent
val tanh : complex32 -> complex32 val tanh : complex32 -> complex32
/// Hyperbolic Cotangent
/// Secant val coth : complex32 -> complex32
val sec : complex32 -> complex32
/// Cosecant
val csc : complex32 -> complex32
/// Cotangent
val cot : complex32 -> complex32
/// Arc Secant
val asec : complex32 -> complex32
/// Arc Cosecant
val acsc : complex32 -> complex32
/// Arc Cotangent
val acot : complex32 -> complex32
/// Hyperbolic Secant /// Hyperbolic Secant
val sech : complex32 -> complex32 val sech : complex32 -> complex32
/// Hyperbolic Cosecant /// Hyperbolic Cosecant
val csch : complex32 -> complex32 val csch : complex32 -> complex32
/// Hyperbolic Cotangent
val coth : complex32 -> complex32 /// Inverse Hyperbolic Sine
val asinh : complex32 -> complex32
/// Inverse Hyperbolic Cosine
val acosh : complex32 -> complex32
/// Inverse Hyperbolic Tagent
val atanh : complex32 -> complex32
/// Inverse Hyperbolic Cotangent
val acoth : complex32 -> complex32
/// Inverse Hyperbolic Secant
val asech : complex32 -> complex32
/// Inverse Hyperbolic Cosecant
val acsch : complex32 -> complex32
[<AutoOpen>] [<AutoOpen>]
module ComplexExtensions = module ComplexExtensions =

18
src/Numerics/Complex32.cs

@ -1402,7 +1402,7 @@ namespace MathNet.Numerics
/// <param name="value">A complex number.</param> /// <param name="value">A complex number.</param>
public static Complex32 Sin(Complex32 value) public static Complex32 Sin(Complex32 value)
{ {
return (Complex32)Trig.Sine(value.ToComplex()); return (Complex32)Trig.Sin(value.ToComplex());
} }
/// <summary> /// <summary>
@ -1412,7 +1412,7 @@ namespace MathNet.Numerics
/// <param name="value">A complex number.</param> /// <param name="value">A complex number.</param>
public static Complex32 Cos(Complex32 value) public static Complex32 Cos(Complex32 value)
{ {
return (Complex32)Trig.Cosine(value.ToComplex()); return (Complex32)Trig.Cos(value.ToComplex());
} }
/// <summary> /// <summary>
@ -1422,7 +1422,7 @@ namespace MathNet.Numerics
/// <param name="value">A complex number.</param> /// <param name="value">A complex number.</param>
public static Complex32 Tan(Complex32 value) public static Complex32 Tan(Complex32 value)
{ {
return (Complex32)Trig.Tangent(value.ToComplex()); return (Complex32)Trig.Tan(value.ToComplex());
} }
/// <summary> /// <summary>
@ -1432,7 +1432,7 @@ namespace MathNet.Numerics
/// <param name="value">A complex number.</param> /// <param name="value">A complex number.</param>
public static Complex32 Asin(Complex32 value) public static Complex32 Asin(Complex32 value)
{ {
return (Complex32)Trig.InverseSine(value.ToComplex()); return (Complex32)Trig.Asin(value.ToComplex());
} }
/// <summary> /// <summary>
@ -1442,7 +1442,7 @@ namespace MathNet.Numerics
/// <param name="value">A complex number that represents a cosine.</param> /// <param name="value">A complex number that represents a cosine.</param>
public static Complex32 Acos(Complex32 value) public static Complex32 Acos(Complex32 value)
{ {
return (Complex32)Trig.InverseCosine(value.ToComplex()); return (Complex32)Trig.Acos(value.ToComplex());
} }
/// <summary> /// <summary>
@ -1452,7 +1452,7 @@ namespace MathNet.Numerics
/// <param name="value">A complex number.</param> /// <param name="value">A complex number.</param>
public static Complex32 Atan(Complex32 value) public static Complex32 Atan(Complex32 value)
{ {
return (Complex32)Trig.InverseTangent(value.ToComplex()); return (Complex32)Trig.Atan(value.ToComplex());
} }
/// <summary> /// <summary>
@ -1462,7 +1462,7 @@ namespace MathNet.Numerics
/// <param name="value">A complex number.</param> /// <param name="value">A complex number.</param>
public static Complex32 Sinh(Complex32 value) public static Complex32 Sinh(Complex32 value)
{ {
return (Complex32)Trig.HyperbolicSine(value.ToComplex()); return (Complex32)Trig.Sinh(value.ToComplex());
} }
/// <summary> /// <summary>
@ -1472,7 +1472,7 @@ namespace MathNet.Numerics
/// <param name="value">A complex number.</param> /// <param name="value">A complex number.</param>
public static Complex32 Cosh(Complex32 value) public static Complex32 Cosh(Complex32 value)
{ {
return (Complex32)Trig.HyperbolicCosine(value.ToComplex()); return (Complex32)Trig.Cosh(value.ToComplex());
} }
/// <summary> /// <summary>
@ -1482,7 +1482,7 @@ namespace MathNet.Numerics
/// <param name="value">A complex number.</param> /// <param name="value">A complex number.</param>
public static Complex32 Tanh(Complex32 value) public static Complex32 Tanh(Complex32 value)
{ {
return (Complex32)Trig.HyperbolicTangent(value.ToComplex()); return (Complex32)Trig.Tanh(value.ToComplex());
} }
} }
} }

20
src/Numerics/Complex64.cs

@ -1066,7 +1066,7 @@ namespace MathNet.Numerics
return new Complex(exp, 0.0); return new Complex(exp, 0.0);
} }
return new Complex(exp * Trig.Cosine(value.Imaginary), exp * Trig.Sine(value.Imaginary)); return new Complex(exp * Trig.Cos(value.Imaginary), exp * Trig.Sin(value.Imaginary));
} }
/// <summary> /// <summary>
@ -1172,7 +1172,7 @@ namespace MathNet.Numerics
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public static Complex Sin(Complex value) public static Complex Sin(Complex value)
{ {
return Trig.Sine(value); return Trig.Sin(value);
} }
/// <summary> /// <summary>
@ -1183,7 +1183,7 @@ namespace MathNet.Numerics
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public static Complex Cos(Complex value) public static Complex Cos(Complex value)
{ {
return Trig.Cosine(value); return Trig.Cos(value);
} }
/// <summary> /// <summary>
@ -1194,7 +1194,7 @@ namespace MathNet.Numerics
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public static Complex Tan(Complex value) public static Complex Tan(Complex value)
{ {
return Trig.Tangent(value); return Trig.Tan(value);
} }
/// <summary> /// <summary>
@ -1205,7 +1205,7 @@ namespace MathNet.Numerics
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public static Complex Asin(Complex value) public static Complex Asin(Complex value)
{ {
return Trig.InverseSine(value); return Trig.Asin(value);
} }
/// <summary> /// <summary>
@ -1216,7 +1216,7 @@ namespace MathNet.Numerics
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public static Complex Acos(Complex value) public static Complex Acos(Complex value)
{ {
return Trig.InverseCosine(value); return Trig.Acos(value);
} }
/// <summary> /// <summary>
@ -1227,7 +1227,7 @@ namespace MathNet.Numerics
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public static Complex Atan(Complex value) public static Complex Atan(Complex value)
{ {
return Trig.InverseTangent(value); return Trig.Atan(value);
} }
/// <summary> /// <summary>
@ -1238,7 +1238,7 @@ namespace MathNet.Numerics
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public static Complex Sinh(Complex value) public static Complex Sinh(Complex value)
{ {
return Trig.HyperbolicSine(value); return Trig.Sinh(value);
} }
/// <summary> /// <summary>
@ -1249,7 +1249,7 @@ namespace MathNet.Numerics
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public static Complex Cosh(Complex value) public static Complex Cosh(Complex value)
{ {
return Trig.HyperbolicCosine(value); return Trig.Cosh(value);
} }
/// <summary> /// <summary>
@ -1260,7 +1260,7 @@ namespace MathNet.Numerics
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public static Complex Tanh(Complex value) public static Complex Tanh(Complex value)
{ {
return Trig.HyperbolicTangent(value); return Trig.Tanh(value);
} }
} }
} }

232
src/Numerics/Trigonometry.cs

@ -139,7 +139,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The sine of the radian angle. /// The sine of the radian angle.
/// </returns> /// </returns>
public static double Sine(double radian) public static double Sin(double radian)
{ {
return Math.Sin(radian); return Math.Sin(radian);
} }
@ -153,16 +153,16 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The sine of the complex number. /// The sine of the complex number.
/// </returns> /// </returns>
public static Complex Sine(this Complex value) public static Complex Sin(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(Sine(value.Real), 0.0); return new Complex(Sin(value.Real), 0.0);
} }
return new Complex( return new Complex(
Sine(value.Real) * HyperbolicCosine(value.Imaginary), Sin(value.Real) * Cosh(value.Imaginary),
Cosine(value.Real) * HyperbolicSine(value.Imaginary)); Cos(value.Real) * Sinh(value.Imaginary));
} }
/// <summary> /// <summary>
@ -174,7 +174,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The cosine of an angle in radian. /// The cosine of an angle in radian.
/// </returns> /// </returns>
public static double Cosine(double radian) public static double Cos(double radian)
{ {
return Math.Cos(radian); return Math.Cos(radian);
} }
@ -188,16 +188,16 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The cosine of a complex number. /// The cosine of a complex number.
/// </returns> /// </returns>
public static Complex Cosine(this Complex value) public static Complex Cos(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(Cosine(value.Real), 0.0); return new Complex(Cos(value.Real), 0.0);
} }
return new Complex( return new Complex(
Cosine(value.Real) * HyperbolicCosine(value.Imaginary), Cos(value.Real) * Cosh(value.Imaginary),
-Sine(value.Real) * HyperbolicSine(value.Imaginary)); -Sin(value.Real) * Sinh(value.Imaginary));
} }
/// <summary> /// <summary>
@ -209,7 +209,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The tangent of the radian angle. /// The tangent of the radian angle.
/// </returns> /// </returns>
public static double Tangent(double radian) public static double Tan(double radian)
{ {
return Math.Tan(radian); return Math.Tan(radian);
} }
@ -223,18 +223,18 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The tangent of the complex number. /// The tangent of the complex number.
/// </returns> /// </returns>
public static Complex Tangent(this Complex value) public static Complex Tan(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(Tangent(value.Real), 0.0); return new Complex(Tan(value.Real), 0.0);
} }
var cosr = Cosine(value.Real); var cosr = Cos(value.Real);
var sinhi = HyperbolicSine(value.Imaginary); var sinhi = Sinh(value.Imaginary);
var denom = (cosr * cosr) + (sinhi * sinhi); var denom = (cosr * cosr) + (sinhi * sinhi);
return new Complex(Sine(value.Real) * cosr / denom, sinhi * HyperbolicCosine(value.Imaginary) / denom); return new Complex(Sin(value.Real) * cosr / denom, sinhi * Cosh(value.Imaginary) / denom);
} }
/// <summary> /// <summary>
@ -246,7 +246,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The cotangent of an angle in radian. /// The cotangent of an angle in radian.
/// </returns> /// </returns>
public static double Cotangent(double radian) public static double Cot(double radian)
{ {
return 1 / Math.Tan(radian); return 1 / Math.Tan(radian);
} }
@ -260,18 +260,18 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The cotangent of the complex number. /// The cotangent of the complex number.
/// </returns> /// </returns>
public static Complex Cotangent(this Complex value) public static Complex Cot(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(Cotangent(value.Real), 0d); return new Complex(Cot(value.Real), 0d);
} }
var sinr = Sine(value.Real); var sinr = Sin(value.Real);
var sinhi = HyperbolicSine(value.Imaginary); var sinhi = Sinh(value.Imaginary);
var denom = (sinr * sinr) + (sinhi * sinhi); var denom = (sinr * sinr) + (sinhi * sinhi);
return new Complex(sinr * Cosine(value.Real) / denom, -sinhi * HyperbolicCosine(value.Imaginary) / denom); return new Complex(sinr * Cos(value.Real) / denom, -sinhi * Cosh(value.Imaginary) / denom);
} }
/// <summary> /// <summary>
@ -283,7 +283,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The secant of the radian angle. /// The secant of the radian angle.
/// </returns> /// </returns>
public static double Secant(double radian) public static double Sec(double radian)
{ {
return 1 / Math.Cos(radian); return 1 / Math.Cos(radian);
} }
@ -297,18 +297,18 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The secant of the complex number. /// The secant of the complex number.
/// </returns> /// </returns>
public static Complex Secant(this Complex value) public static Complex Sec(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(Secant(value.Real), 0d); return new Complex(Sec(value.Real), 0d);
} }
var cosr = Cosine(value.Real); var cosr = Cos(value.Real);
var sinhi = HyperbolicSine(value.Imaginary); var sinhi = Sinh(value.Imaginary);
var denom = (cosr * cosr) + (sinhi * sinhi); var denom = (cosr * cosr) + (sinhi * sinhi);
return new Complex(cosr * HyperbolicCosine(value.Imaginary) / denom, Sine(value.Real) * sinhi / denom); return new Complex(cosr * Cosh(value.Imaginary) / denom, Sin(value.Real) * sinhi / denom);
} }
/// <summary> /// <summary>
@ -320,7 +320,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// Cosecant of an angle in radian. /// Cosecant of an angle in radian.
/// </returns> /// </returns>
public static double Cosecant(double radian) public static double Csc(double radian)
{ {
return 1 / Math.Sin(radian); return 1 / Math.Sin(radian);
} }
@ -334,18 +334,18 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The cosecant of a complex number. /// The cosecant of a complex number.
/// </returns> /// </returns>
public static Complex Cosecant(this Complex value) public static Complex Csc(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(Cosecant(value.Real), 0d); return new Complex(Csc(value.Real), 0d);
} }
var sinr = Sine(value.Real); var sinr = Sin(value.Real);
var sinhi = HyperbolicSine(value.Imaginary); var sinhi = Sinh(value.Imaginary);
var denom = (sinr * sinr) + (sinhi * sinhi); var denom = (sinr * sinr) + (sinhi * sinhi);
return new Complex(sinr * HyperbolicCosine(value.Imaginary) / denom, -Cosine(value.Real) * sinhi / denom); return new Complex(sinr * Cosh(value.Imaginary) / denom, -Cos(value.Real) * sinhi / denom);
} }
/// <summary> /// <summary>
@ -357,7 +357,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The inverse sine of the radian angle. /// The inverse sine of the radian angle.
/// </returns> /// </returns>
public static double InverseSine(double radian) public static double Asin(double radian)
{ {
return Math.Asin(radian); return Math.Asin(radian);
} }
@ -371,11 +371,11 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The arc sine of a complex number. /// The arc sine of a complex number.
/// </returns> /// </returns>
public static Complex InverseSine(this Complex value) public static Complex Asin(this Complex value)
{ {
if (value.Imaginary > 0 || value.Imaginary == 0d && value.Real < 0) if (value.Imaginary > 0 || value.Imaginary == 0d && value.Real < 0)
{ {
return -InverseSine(-value); return -Asin(-value);
} }
return -Complex.ImaginaryOne * ((1 - value.Square()).SquareRoot() + (Complex.ImaginaryOne * value)).NaturalLogarithm(); return -Complex.ImaginaryOne * ((1 - value.Square()).SquareRoot() + (Complex.ImaginaryOne * value)).NaturalLogarithm();
@ -393,7 +393,7 @@ namespace MathNet.Numerics
/// <exception cref="ArgumentOutOfRangeException"> /// <exception cref="ArgumentOutOfRangeException">
/// if 1 &lt; <paramref name="radian"/> or <paramref name="radian"/> &lt; -1. /// if 1 &lt; <paramref name="radian"/> or <paramref name="radian"/> &lt; -1.
/// </exception> /// </exception>
public static double InverseCosine(double radian) public static double Acos(double radian)
{ {
return Math.Acos(radian); return Math.Acos(radian);
} }
@ -407,11 +407,11 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The arc cosine of a complex number. /// The arc cosine of a complex number.
/// </returns> /// </returns>
public static Complex InverseCosine(this Complex value) public static Complex Acos(this Complex value)
{ {
if (value.Imaginary < 0 || value.Imaginary == 0d && value.Real > 0) if (value.Imaginary < 0 || value.Imaginary == 0d && value.Real > 0)
{ {
return Constants.Pi - InverseCosine(-value); return Constants.Pi - Acos(-value);
} }
return -Complex.ImaginaryOne * (value + (Complex.ImaginaryOne * (1 - value.Square()).SquareRoot())).NaturalLogarithm(); return -Complex.ImaginaryOne * (value + (Complex.ImaginaryOne * (1 - value.Square()).SquareRoot())).NaturalLogarithm();
@ -426,7 +426,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The inverse tangent of the radian angle. /// The inverse tangent of the radian angle.
/// </returns> /// </returns>
public static double InverseTangent(double radian) public static double Atan(double radian)
{ {
return Math.Atan(radian); return Math.Atan(radian);
} }
@ -440,7 +440,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The arc tangent of a complex number. /// The arc tangent of a complex number.
/// </returns> /// </returns>
public static Complex InverseTangent(this Complex value) public static Complex Atan(this Complex value)
{ {
var iz = new Complex(-value.Imaginary, value.Real); // I*this var iz = new Complex(-value.Imaginary, value.Real); // I*this
return new Complex(0, 0.5) * ((1 - iz).NaturalLogarithm() - (1 + iz).NaturalLogarithm()); return new Complex(0, 0.5) * ((1 - iz).NaturalLogarithm() - (1 + iz).NaturalLogarithm());
@ -455,7 +455,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The inverse cotangent of the radian angle. /// The inverse cotangent of the radian angle.
/// </returns> /// </returns>
public static double InverseCotangent(double radian) public static double Acot(double radian)
{ {
return Math.Atan(1 / radian); return Math.Atan(1 / radian);
} }
@ -469,7 +469,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The arc cotangent of a complex number. /// The arc cotangent of a complex number.
/// </returns> /// </returns>
public static Complex InverseCotangent(this Complex value) public static Complex Acot(this Complex value)
{ {
if (value.IsZero()) if (value.IsZero())
{ {
@ -489,7 +489,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The inverse secant of the radian angle. /// The inverse secant of the radian angle.
/// </returns> /// </returns>
public static double InverseSecant(double radian) public static double Asec(double radian)
{ {
return Math.Acos(1 / radian); return Math.Acos(1 / radian);
} }
@ -503,7 +503,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The arc secant of a complex number. /// The arc secant of a complex number.
/// </returns> /// </returns>
public static Complex InverseSecant(this Complex value) public static Complex Asec(this Complex value)
{ {
var inv = 1 / value; var inv = 1 / value;
return -Complex.ImaginaryOne * (inv + (Complex.ImaginaryOne * (1 - inv.Square()).SquareRoot())).NaturalLogarithm(); return -Complex.ImaginaryOne * (inv + (Complex.ImaginaryOne * (1 - inv.Square()).SquareRoot())).NaturalLogarithm();
@ -521,7 +521,7 @@ namespace MathNet.Numerics
/// <exception cref="ArgumentOutOfRangeException"> /// <exception cref="ArgumentOutOfRangeException">
/// if -1 &lt; <paramref name="radian"/> &lt; 1. /// if -1 &lt; <paramref name="radian"/> &lt; 1.
/// </exception> /// </exception>
public static double InverseCosecant(double radian) public static double Acsc(double radian)
{ {
return Math.Asin(1 / radian); return Math.Asin(1 / radian);
} }
@ -535,7 +535,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The arc cosecant of a complex number. /// The arc cosecant of a complex number.
/// </returns> /// </returns>
public static Complex InverseCosecant(this Complex value) public static Complex Acsc(this Complex value)
{ {
var inv = 1 / value; var inv = 1 / value;
return -Complex.ImaginaryOne * ((Complex.ImaginaryOne * inv) + (1 - inv.Square()).SquareRoot()).NaturalLogarithm(); return -Complex.ImaginaryOne * ((Complex.ImaginaryOne * inv) + (1 - inv.Square()).SquareRoot()).NaturalLogarithm();
@ -550,7 +550,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic sine of the radian angle. /// The hyperbolic sine of the radian angle.
/// </returns> /// </returns>
public static double HyperbolicSine(double radian) public static double Sinh(double radian)
{ {
return (Math.Exp(radian) - Math.Exp(-radian)) / 2; return (Math.Exp(radian) - Math.Exp(-radian)) / 2;
} }
@ -564,16 +564,16 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic sine of a complex number. /// The hyperbolic sine of a complex number.
/// </returns> /// </returns>
public static Complex HyperbolicSine(this Complex value) public static Complex Sinh(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(HyperbolicSine(value.Real), 0.0); return new Complex(Sinh(value.Real), 0.0);
} }
return new Complex( return new Complex(
HyperbolicSine(value.Real) * Cosine(value.Imaginary), Sinh(value.Real) * Cos(value.Imaginary),
HyperbolicCosine(value.Real) * Sine(value.Imaginary)); Cosh(value.Real) * Sin(value.Imaginary));
} }
/// <summary> /// <summary>
@ -585,7 +585,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic Cosine of the radian angle. /// The hyperbolic Cosine of the radian angle.
/// </returns> /// </returns>
public static double HyperbolicCosine(double radian) public static double Cosh(double radian)
{ {
return (Math.Exp(radian) + Math.Exp(-radian)) / 2; return (Math.Exp(radian) + Math.Exp(-radian)) / 2;
} }
@ -599,16 +599,16 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic cosine of a complex number. /// The hyperbolic cosine of a complex number.
/// </returns> /// </returns>
public static Complex HyperbolicCosine(this Complex value) public static Complex Cosh(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(HyperbolicCosine(value.Real), 0.0); return new Complex(Cosh(value.Real), 0.0);
} }
return new Complex( return new Complex(
HyperbolicCosine(value.Real) * Cosine(value.Imaginary), Cosh(value.Real) * Cos(value.Imaginary),
HyperbolicSine(value.Real) * Sine(value.Imaginary)); Sinh(value.Real) * Sin(value.Imaginary));
} }
/// <summary> /// <summary>
@ -620,7 +620,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic tangent of the radian angle. /// The hyperbolic tangent of the radian angle.
/// </returns> /// </returns>
public static double HyperbolicTangent(double radian) public static double Tanh(double radian)
{ {
if (radian > 19.1) if (radian > 19.1)
{ {
@ -646,15 +646,15 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic tangent of a complex number. /// The hyperbolic tangent of a complex number.
/// </returns> /// </returns>
public static Complex HyperbolicTangent(this Complex value) public static Complex Tanh(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(HyperbolicTangent(value.Real), 0.0); return new Complex(Tanh(value.Real), 0.0);
} }
var cosi = Cosine(value.Imaginary); var cosi = Cos(value.Imaginary);
var sinhr = HyperbolicSine(value.Real); var sinhr = Sinh(value.Real);
if (double.IsInfinity(sinhr)) if (double.IsInfinity(sinhr))
{ {
@ -663,7 +663,7 @@ namespace MathNet.Numerics
var denom = (cosi * cosi) + (sinhr * sinhr); var denom = (cosi * cosi) + (sinhr * sinhr);
return new Complex(HyperbolicCosine(value.Real) * sinhr / denom, cosi * Sine(value.Imaginary) / denom); return new Complex(Cosh(value.Real) * sinhr / denom, cosi * Sin(value.Imaginary) / denom);
} }
/// <summary> /// <summary>
@ -675,7 +675,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic cotangent of the radian angle. /// The hyperbolic cotangent of the radian angle.
/// </returns> /// </returns>
public static double HyperbolicCotangent(double radian) public static double Coth(double radian)
{ {
if (radian > 19.115) if (radian > 19.115)
{ {
@ -701,15 +701,15 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic cotangent of a complex number. /// The hyperbolic cotangent of a complex number.
/// </returns> /// </returns>
public static Complex HyperbolicCotangent(this Complex value) public static Complex Coth(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(HyperbolicCotangent(value.Real), 0.0); return new Complex(Coth(value.Real), 0.0);
} }
var sini = Sine(value.Imaginary); var sini = Sin(value.Imaginary);
var sinhr = HyperbolicSine(value.Real); var sinhr = Sinh(value.Real);
if (double.IsInfinity(sinhr)) if (double.IsInfinity(sinhr))
{ {
@ -718,7 +718,7 @@ namespace MathNet.Numerics
var denom = (sini * sini) + (sinhr * sinhr); var denom = (sini * sini) + (sinhr * sinhr);
return new Complex(sinhr * HyperbolicCosine(value.Real) / denom, sini * Cosine(value.Imaginary) / denom); return new Complex(sinhr * Cosh(value.Real) / denom, sini * Cos(value.Imaginary) / denom);
} }
/// <summary> /// <summary>
@ -730,9 +730,9 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic secant of the radian angle. /// The hyperbolic secant of the radian angle.
/// </returns> /// </returns>
public static double HyperbolicSecant(double radian) public static double Sech(double radian)
{ {
return 1 / HyperbolicCosine(radian); return 1 / Cosh(radian);
} }
/// <summary> /// <summary>
@ -744,11 +744,11 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic secant of a complex number. /// The hyperbolic secant of a complex number.
/// </returns> /// </returns>
public static Complex HyperbolicSecant(this Complex value) public static Complex Sech(this Complex value)
{ {
if (value.IsReal()) if (value.IsReal())
{ {
return new Complex(HyperbolicSecant(value.Real), 0.0); return new Complex(Sech(value.Real), 0.0);
} }
var exp = value.Exponential(); var exp = value.Exponential();
@ -762,32 +762,43 @@ namespace MathNet.Numerics
} }
/// <summary> /// <summary>
/// Trigonometric Hyperbolic Arc Cosecant /// Trigonometric Hyperbolic Cosecant
/// </summary> /// </summary>
/// <param name="radian"> /// <param name="radian">
/// The angle in radian angle. /// The angle in radian.
/// </param> /// </param>
/// <returns> /// <returns>
/// The inverse hyperbolic cosecant of the radian angle. /// The hyperbolic cosecant of the radian angle.
/// </returns> /// </returns>
public static double InverseHyperbolicCosecant(double radian) public static double Csch(double radian)
{ {
return InverseHyperbolicSine(1 / radian); return 1 / Sinh(radian);
} }
/// <summary> /// <summary>
/// Trigonometric Hyperbolic Arc Cosecant of this <c>Complex</c> number. /// Trigonometric Hyperbolic Cosecant of a <c>Complex</c> number.
/// </summary> /// </summary>
/// <param name="value"> /// <param name="value">
/// The complex value. /// The complex value.
/// </param> /// </param>
/// <returns> /// <returns>
/// The hyperbolic arc cosecant of a complex number. /// The hyperbolic cosecant of a complex number.
/// </returns> /// </returns>
public static Complex InverseHyperbolicCosecant(this Complex value) public static Complex Csch(this Complex value)
{ {
var inv = 1 / value; if (value.IsReal())
return (inv + (inv.Square() + 1).SquareRoot()).NaturalLogarithm(); {
return new Complex(Csch(value.Real), 0.0);
}
var exp = value.Exponential();
if (exp.IsInfinity())
{
return Complex.Zero;
}
return 2 * exp / (exp.Square() - 1);
} }
/// <summary> /// <summary>
@ -799,7 +810,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The inverse hyperbolic sine of the radian angle. /// The inverse hyperbolic sine of the radian angle.
/// </returns> /// </returns>
public static double InverseHyperbolicSine(double radian) public static double Asinh(double radian)
{ {
return Math.Log(radian + Math.Sqrt((radian * radian) + 1), Math.E); return Math.Log(radian + Math.Sqrt((radian * radian) + 1), Math.E);
} }
@ -813,7 +824,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic arc sine of a complex number. /// The hyperbolic arc sine of a complex number.
/// </returns> /// </returns>
public static Complex InverseHyperbolicSine(this Complex value) public static Complex Asinh(this Complex value)
{ {
return (value + (value.Square() + 1).SquareRoot()).NaturalLogarithm(); return (value + (value.Square() + 1).SquareRoot()).NaturalLogarithm();
} }
@ -827,7 +838,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The inverse hyperbolic cosine of the radian angle. /// The inverse hyperbolic cosine of the radian angle.
/// </returns> /// </returns>
public static double InverseHyperbolicCosine(double radian) public static double Acosh(double radian)
{ {
return Math.Log(radian + (Math.Sqrt(radian - 1) * Math.Sqrt(radian + 1)), Math.E); return Math.Log(radian + (Math.Sqrt(radian - 1) * Math.Sqrt(radian + 1)), Math.E);
} }
@ -841,7 +852,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic arc cosine of a complex number. /// The hyperbolic arc cosine of a complex number.
/// </returns> /// </returns>
public static Complex InverseHyperbolicCosine(this Complex value) public static Complex Acosh(this Complex value)
{ {
return (value + ((value - 1).SquareRoot() * (value + 1).SquareRoot())).NaturalLogarithm(); return (value + ((value - 1).SquareRoot() * (value + 1).SquareRoot())).NaturalLogarithm();
} }
@ -855,7 +866,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The inverse hyperbolic tangent of the radian angle. /// The inverse hyperbolic tangent of the radian angle.
/// </returns> /// </returns>
public static double InverseHyperbolicTangent(double radian) public static double Atanh(double radian)
{ {
return 0.5 * Math.Log((1 + radian) / (1 - radian), Math.E); return 0.5 * Math.Log((1 + radian) / (1 - radian), Math.E);
} }
@ -869,7 +880,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic arc tangent of a complex number. /// The hyperbolic arc tangent of a complex number.
/// </returns> /// </returns>
public static Complex InverseHyperbolicTangent(this Complex value) public static Complex Atanh(this Complex value)
{ {
return 0.5 * ((1 + value).NaturalLogarithm() - (1 - value).NaturalLogarithm()); return 0.5 * ((1 + value).NaturalLogarithm() - (1 - value).NaturalLogarithm());
} }
@ -883,7 +894,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The inverse hyperbolic cotangent of the radian angle. /// The inverse hyperbolic cotangent of the radian angle.
/// </returns> /// </returns>
public static double InverseHyperbolicCotangent(double radian) public static double Acoth(double radian)
{ {
return 0.5 * Math.Log((radian + 1) / (radian - 1), Math.E); return 0.5 * Math.Log((radian + 1) / (radian - 1), Math.E);
} }
@ -897,7 +908,7 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic arc cotangent of a complex number. /// The hyperbolic arc cotangent of a complex number.
/// </returns> /// </returns>
public static Complex InverseHyperbolicCotangent(this Complex value) public static Complex Acoth(this Complex value)
{ {
var inv = 1.0 / value; var inv = 1.0 / value;
return 0.5 * ((1.0 + inv).NaturalLogarithm() - (1.0 - inv).NaturalLogarithm()); return 0.5 * ((1.0 + inv).NaturalLogarithm() - (1.0 - inv).NaturalLogarithm());
@ -912,9 +923,9 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The inverse hyperbolic secant of the radian angle. /// The inverse hyperbolic secant of the radian angle.
/// </returns> /// </returns>
public static double InverseHyperbolicSecant(double radian) public static double Asech(double radian)
{ {
return InverseHyperbolicCosine(1 / radian); return Acosh(1 / radian);
} }
/// <summary> /// <summary>
@ -926,50 +937,39 @@ namespace MathNet.Numerics
/// <returns> /// <returns>
/// The hyperbolic arc secant of a complex number. /// The hyperbolic arc secant of a complex number.
/// </returns> /// </returns>
public static Complex InverseHyperbolicSecant(this Complex value) public static Complex Asech(this Complex value)
{ {
var inv = 1 / value; var inv = 1 / value;
return (inv + ((inv - 1).SquareRoot() * (inv + 1).SquareRoot())).NaturalLogarithm(); return (inv + ((inv - 1).SquareRoot() * (inv + 1).SquareRoot())).NaturalLogarithm();
} }
/// <summary> /// <summary>
/// Trigonometric Hyperbolic Cosecant /// Trigonometric Hyperbolic Arc Cosecant
/// </summary> /// </summary>
/// <param name="radian"> /// <param name="radian">
/// The angle in radian. /// The angle in radian angle.
/// </param> /// </param>
/// <returns> /// <returns>
/// The hyperbolic cosecant of the radian angle. /// The inverse hyperbolic cosecant of the radian angle.
/// </returns> /// </returns>
public static double HyperbolicCosecant(double radian) public static double Acsch(double radian)
{ {
return 1 / HyperbolicSine(radian); return Asinh(1 / radian);
} }
/// <summary> /// <summary>
/// Trigonometric Hyperbolic Cosecant of a <c>Complex</c> number. /// Trigonometric Hyperbolic Arc Cosecant of this <c>Complex</c> number.
/// </summary> /// </summary>
/// <param name="value"> /// <param name="value">
/// The complex value. /// The complex value.
/// </param> /// </param>
/// <returns> /// <returns>
/// The hyperbolic cosecant of a complex number. /// The hyperbolic arc cosecant of a complex number.
/// </returns> /// </returns>
public static Complex HyperbolicCosecant(this Complex value) public static Complex Acsch(this Complex value)
{ {
if (value.IsReal()) var inv = 1 / value;
{ return (inv + (inv.Square() + 1).SquareRoot()).NaturalLogarithm();
return new Complex(HyperbolicCosecant(value.Real), 0.0);
}
var exp = value.Exponential();
if (exp.IsInfinity())
{
return Complex.Zero;
}
return 2 * exp / (exp.Square() - 1);
} }
} }
} }

96
src/UnitTests/TrigonometryTest.cs

@ -52,7 +52,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -8.388608e6, double.PositiveInfinity, double.NegativeInfinity)] [TestCase(-1.19209289550780998537e-7, -8.388608e6, double.PositiveInfinity, double.NegativeInfinity)]
public void CanComputeComplexCosine(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexCosine(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).Cosine(); var actual = new Complex(real, imag).Cos();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -73,7 +73,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -8.388608e6, double.NegativeInfinity, double.NegativeInfinity)] [TestCase(-1.19209289550780998537e-7, -8.388608e6, double.NegativeInfinity, double.NegativeInfinity)]
public void CanComputeComplexSine(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexSine(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).Sine(); var actual = new Complex(real, imag).Sin();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -94,7 +94,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-8.388608e6, -1.19209289550780998537e-7, 0.47934123862653449, -1.4659977233982276e-7)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, 0.47934123862653449, -1.4659977233982276e-7)]
public void CanComputeComplexTangent(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexTangent(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).Tangent(); var actual = new Complex(real, imag).Tan();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -111,7 +111,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -8388608.0000000376)] [TestCase(-1.19209289550780998537e-7, -8388608.0000000376)]
public void CanComputeCosecant(double value, double expected) public void CanComputeCosecant(double value, double expected)
{ {
var actual = Trig.Cosecant(value); var actual = Trig.Csc(value);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -127,7 +127,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, 0.99999999999999289)] [TestCase(-1.19209289550780998537e-7, 0.99999999999999289)]
public void CanComputeCosine(double value, double expected) public void CanComputeCosine(double value, double expected)
{ {
var actual = Trig.Cosine(value); var actual = Trig.Cos(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -143,7 +143,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -8388607.999999978)] [TestCase(-1.19209289550780998537e-7, -8388607.999999978)]
public void CanComputeCotangent(double value, double expected) public void CanComputeCotangent(double value, double expected)
{ {
var actual = Trig.Cotangent(value); var actual = Trig.Cot(value);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -159,7 +159,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -8388607.9999999978)] [TestCase(-1.19209289550780998537e-7, -8388607.9999999978)]
public void CanComputeHyperbolicCosecant(double value, double expected) public void CanComputeHyperbolicCosecant(double value, double expected)
{ {
var actual = Trig.HyperbolicCosecant(value); var actual = Trig.Csch(value);
AssertHelpers.AlmostEqual(expected, actual, 15); AssertHelpers.AlmostEqual(expected, actual, 15);
} }
@ -175,7 +175,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, 1.0000000000000071)] [TestCase(-1.19209289550780998537e-7, 1.0000000000000071)]
public void CanComputeHyperbolicCosine(double value, double expected) public void CanComputeHyperbolicCosine(double value, double expected)
{ {
var actual = Trig.HyperbolicCosine(value); var actual = Trig.Cosh(value);
AssertHelpers.AlmostEqual(expected, actual, 15); AssertHelpers.AlmostEqual(expected, actual, 15);
} }
@ -191,7 +191,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -8388608.0000000574)] [TestCase(-1.19209289550780998537e-7, -8388608.0000000574)]
public void CanComputeHyperbolicCotangent(double value, double expected) public void CanComputeHyperbolicCotangent(double value, double expected)
{ {
var actual = Trig.HyperbolicCotangent(value); var actual = Trig.Coth(value);
AssertHelpers.AlmostEqual(expected, actual, 15); AssertHelpers.AlmostEqual(expected, actual, 15);
} }
@ -207,7 +207,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, 0.99999999999999289)] [TestCase(-1.19209289550780998537e-7, 0.99999999999999289)]
public void CanComputeHyperbolicSecant(double value, double expected) public void CanComputeHyperbolicSecant(double value, double expected)
{ {
var actual = Trig.HyperbolicSecant(value); var actual = Trig.Sech(value);
AssertHelpers.AlmostEqual(expected, actual, 15); AssertHelpers.AlmostEqual(expected, actual, 15);
} }
@ -222,7 +222,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -1.1920928955078128e-7)] [TestCase(-1.19209289550780998537e-7, -1.1920928955078128e-7)]
public void CanComputeHyperbolicSine(double value, double expected) public void CanComputeHyperbolicSine(double value, double expected)
{ {
var actual = Trig.HyperbolicSine(value); var actual = Trig.Sinh(value);
AssertHelpers.AlmostEqual(expected, actual, 15); AssertHelpers.AlmostEqual(expected, actual, 15);
} }
@ -238,7 +238,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -1.1920928955078043e-7)] [TestCase(-1.19209289550780998537e-7, -1.1920928955078043e-7)]
public void CanComputeHyperbolicTangent(double value, double expected) public void CanComputeHyperbolicTangent(double value, double expected)
{ {
var actual = Trig.HyperbolicTangent(value); var actual = Trig.Tanh(value);
AssertHelpers.AlmostEqual(expected, actual, 15); AssertHelpers.AlmostEqual(expected, actual, 15);
} }
@ -253,7 +253,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1, -1.5707963267948966)] [TestCase(-1, -1.5707963267948966)]
public void CanComputeInverseCosecant(double value, double expected) public void CanComputeInverseCosecant(double value, double expected)
{ {
var actual = Trig.InverseCosecant(value); var actual = Trig.Acsc(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -268,7 +268,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, 1.5707964460041861)] [TestCase(-1.19209289550780998537e-7, 1.5707964460041861)]
public void CanComputeInverseCosine(double value, double expected) public void CanComputeInverseCosine(double value, double expected)
{ {
var actual = Trig.InverseCosine(value); var actual = Trig.Acos(value);
AssertHelpers.AlmostEqual(expected, actual, 15); AssertHelpers.AlmostEqual(expected, actual, 15);
} }
@ -284,7 +284,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -1.5707962075856071)] [TestCase(-1.19209289550780998537e-7, -1.5707962075856071)]
public void CanComputeInverseCotangent(double value, double expected) public void CanComputeInverseCotangent(double value, double expected)
{ {
var actual = Trig.InverseCotangent(value); var actual = Trig.Acot(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -300,7 +300,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -16.635532333438693)] [TestCase(-1.19209289550780998537e-7, -16.635532333438693)]
public void CanComputeInverseHyperbolicCosecant(double value, double expected) public void CanComputeInverseHyperbolicCosecant(double value, double expected)
{ {
var actual = Trig.InverseHyperbolicCosecant(value); var actual = Trig.Acsch(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -313,7 +313,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(8388608, 16.635532333438682)] [TestCase(8388608, 16.635532333438682)]
public void CanComputeInverseHyperbolicCosine(double value, double expected) public void CanComputeInverseHyperbolicCosine(double value, double expected)
{ {
var actual = Trig.InverseHyperbolicCosine(value); var actual = Trig.Acosh(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -328,7 +328,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1, double.NegativeInfinity)] [TestCase(-1, double.NegativeInfinity)]
public void CanComputeInverseHyperbolicCotangent(double value, double expected) public void CanComputeInverseHyperbolicCotangent(double value, double expected)
{ {
var actual = Trig.InverseHyperbolicCotangent(value); var actual = Trig.Acoth(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -342,7 +342,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(1, 0.0)] [TestCase(1, 0.0)]
public void CanComputeInverseHyperbolicSecant(double value, double expected) public void CanComputeInverseHyperbolicSecant(double value, double expected)
{ {
var actual = Trig.InverseHyperbolicSecant(value); var actual = Trig.Asech(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -358,7 +358,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -1.1920928955078072e-7)] [TestCase(-1.19209289550780998537e-7, -1.1920928955078072e-7)]
public void CanComputeInverseHyperbolicSine(double value, double expected) public void CanComputeInverseHyperbolicSine(double value, double expected)
{ {
var actual = Trig.InverseHyperbolicSine(value); var actual = Trig.Asinh(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -374,7 +374,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -1.19209289550780998537e-7)] [TestCase(-1.19209289550780998537e-7, -1.19209289550780998537e-7)]
public void CanComputeInverseHyperbolicTangent(double value, double expected) public void CanComputeInverseHyperbolicTangent(double value, double expected)
{ {
var actual = Trig.InverseHyperbolicTangent(value); var actual = Trig.Atanh(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -389,7 +389,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.0, 3.1415926535897932)] [TestCase(-1.0, 3.1415926535897932)]
public void CanComputeInverseSecant(double value, double expected) public void CanComputeInverseSecant(double value, double expected)
{ {
var actual = Trig.InverseSecant(value); var actual = Trig.Asec(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -405,7 +405,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -1.1920928955078128e-7)] [TestCase(-1.19209289550780998537e-7, -1.1920928955078128e-7)]
public void CanComputeInverseSine(double value, double expected) public void CanComputeInverseSine(double value, double expected)
{ {
var actual = Trig.InverseSine(value); var actual = Trig.Asin(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -421,7 +421,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -1.19209289550780998537e-7)] [TestCase(-1.19209289550780998537e-7, -1.19209289550780998537e-7)]
public void CanComputeInverseTangent(double value, double expected) public void CanComputeInverseTangent(double value, double expected)
{ {
var actual = Trig.InverseTangent(value); var actual = Trig.Atan(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -437,7 +437,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, 1.0000000000000071)] [TestCase(-1.19209289550780998537e-7, 1.0000000000000071)]
public void CanComputeSecant(double value, double expected) public void CanComputeSecant(double value, double expected)
{ {
var actual = Trig.Secant(value); var actual = Trig.Sec(value);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -453,7 +453,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -1.1920928955078072e-7)] [TestCase(-1.19209289550780998537e-7, -1.1920928955078072e-7)]
public void CanComputeSine(double value, double expected) public void CanComputeSine(double value, double expected)
{ {
var actual = Trig.Sine(value); var actual = Trig.Sin(value);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -469,7 +469,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-1.19209289550780998537e-7, -1.1920928955078157e-7)] [TestCase(-1.19209289550780998537e-7, -1.1920928955078157e-7)]
public void CanComputeTangent(double value, double expected) public void CanComputeTangent(double value, double expected)
{ {
var actual = Trig.Tangent(value); var actual = Trig.Tan(value);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -543,7 +543,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-8.388608e6, -1.19209289550780998537e-7, 2.0861964701080704, 6.3803383253713457e-7)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, 2.0861964701080704, 6.3803383253713457e-7)]
public void CanComputeComplexCotangent(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexCotangent(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).Cotangent(); var actual = new Complex(real, imag).Cot();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -564,7 +564,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-8.388608e6, -1.19209289550780998537e-7, -1.1089490624226177, 6.3367488045143761e-8)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, -1.1089490624226177, 6.3367488045143761e-8)]
public void CanComputeComplexSecant(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexSecant(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).Secant(); var actual = new Complex(real, imag).Sec();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -585,7 +585,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-8.388608e6, -1.19209289550780998537e-7, -2.3134856195557596, -5.7534999050657057e-7)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, -2.3134856195557596, -5.7534999050657057e-7)]
public void CanComputeComplexCosecant(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexCosecant(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).Cosecant(); var actual = new Complex(real, imag).Csc();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 13); AssertHelpers.AlmostEqual(expected, actual, 13);
} }
@ -607,7 +607,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.45730415318424922, -0.54061268571315335)] [TestCase(0.5, -0.5, 0.45730415318424922, -0.54061268571315335)]
public void CanComputeComplexHyperbolicSine(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexHyperbolicSine(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).HyperbolicSine(); var actual = new Complex(real, imag).Sinh();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -629,7 +629,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.9895848833999199, -0.24982639750046154)] [TestCase(0.5, -0.5, 0.9895848833999199, -0.24982639750046154)]
public void CanComputeComplexHyperbolicCosine(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexHyperbolicCosine(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).HyperbolicCosine(); var actual = new Complex(real, imag).Cosh();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -651,7 +651,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.56408314126749848, -0.40389645531602575)] [TestCase(0.5, -0.5, 0.56408314126749848, -0.40389645531602575)]
public void CanComputeComplexHyperbolicTangent(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexHyperbolicTangent(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).HyperbolicTangent(); var actual = new Complex(real, imag).Tanh();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -673,7 +673,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 1.1719451445243514, -0.8391395790248311)] [TestCase(0.5, -0.5, 1.1719451445243514, -0.8391395790248311)]
public void CanComputeComplexHyperbolicCotangent(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexHyperbolicCotangent(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).HyperbolicCotangent(); var actual = new Complex(real, imag).Coth();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -695,7 +695,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.94997886761549463, 0.23982763093808804)] [TestCase(0.5, -0.5, 0.94997886761549463, 0.23982763093808804)]
public void CanComputeComplexHyperbolicSecant(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexHyperbolicSecant(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).HyperbolicSecant(); var actual = new Complex(real, imag).Sech();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -717,7 +717,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.91207426403881078, 1.0782296946540223)] [TestCase(0.5, -0.5, 0.91207426403881078, 1.0782296946540223)]
public void CanComputeComplexHyperbolicCosecant(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexHyperbolicCosecant(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).HyperbolicCosecant(); var actual = new Complex(real, imag).Csch();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -741,7 +741,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-123400000000d, 0d, -1.57079632679489661923, 26.23184412897764390497)] [TestCase(-123400000000d, 0d, -1.57079632679489661923, 26.23184412897764390497)]
public void CanComputeComplexInverseSine(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseSine(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseSine(); var actual = new Complex(real, imag).Asin();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -765,7 +765,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(-123400000000d, 0d, 3.14159265358979323846, -26.23184412897764390497)] [TestCase(-123400000000d, 0d, 3.14159265358979323846, -26.23184412897764390497)]
public void CanComputeComplexInverseCosine(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseCosine(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseCosine(); var actual = new Complex(real, imag).Acos();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -787,7 +787,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.5535743588970452, -0.40235947810852507)] [TestCase(0.5, -0.5, 0.5535743588970452, -0.40235947810852507)]
public void CanComputeComplexInverseTangent(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseTangent(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseTangent(); var actual = new Complex(real, imag).Atan();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -809,7 +809,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 1.0172219678978514, 0.40235947810852509)] [TestCase(0.5, -0.5, 1.0172219678978514, 0.40235947810852509)]
public void CanComputeComplexInverseCotangent(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseCotangent(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseCotangent(); var actual = new Complex(real, imag).Acot();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -830,7 +830,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.90455689430238136, -1.0612750619050357)] [TestCase(0.5, -0.5, 0.90455689430238136, -1.0612750619050357)]
public void CanComputeComplexInverseSecant(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseSecant(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseSecant(); var actual = new Complex(real, imag).Asec();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -851,7 +851,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.66623943249251526, 1.0612750619050357)] [TestCase(0.5, -0.5, 0.66623943249251526, 1.0612750619050357)]
public void CanComputeComplexInverseCosecant(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseCosecant(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseCosecant(); var actual = new Complex(real, imag).Acsc();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -872,7 +872,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.53063753095251787, -0.4522784471511907)] [TestCase(0.5, -0.5, 0.53063753095251787, -0.4522784471511907)]
public void CanComputeComplexInverseHyperbolicSine(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseHyperbolicSine(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseHyperbolicSine(); var actual = new Complex(real, imag).Asinh();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -893,7 +893,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.53063753095251787, -1.1185178796437059)] [TestCase(0.5, -0.5, 0.53063753095251787, -1.1185178796437059)]
public void CanComputeComplexInverseHyperbolicCosine(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseHyperbolicCosine(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseHyperbolicCosine(); var actual = new Complex(real, imag).Acosh();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -914,7 +914,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.40235947810852509, -0.55357435889704525)] [TestCase(0.5, -0.5, 0.40235947810852509, -0.55357435889704525)]
public void CanComputeComplexInverseHyperbolicTangent(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseHyperbolicTangent(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseHyperbolicTangent(); var actual = new Complex(real, imag).Atanh();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -935,7 +935,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 0.40235947810852509, 1.0172219678978514)] [TestCase(0.5, -0.5, 0.40235947810852509, 1.0172219678978514)]
public void CanComputeComplexInverseHyperbolicCotangent(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseHyperbolicCotangent(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseHyperbolicCotangent(); var actual = new Complex(real, imag).Acoth();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -956,7 +956,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 1.0612750619050357, 0.90455689430238136)] [TestCase(0.5, -0.5, 1.0612750619050357, 0.90455689430238136)]
public void CanComputeComplexInverseHyperbolicSecant(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseHyperbolicSecant(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseHyperbolicSecant(); var actual = new Complex(real, imag).Asech();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }
@ -977,7 +977,7 @@ namespace MathNet.Numerics.UnitTests
[TestCase(0.5, -0.5, 1.0612750619050357, 0.66623943249251526)] [TestCase(0.5, -0.5, 1.0612750619050357, 0.66623943249251526)]
public void CanComputeComplexInverseHyperbolicCosecant(double real, double imag, double expectedReal, double expectedImag) public void CanComputeComplexInverseHyperbolicCosecant(double real, double imag, double expectedReal, double expectedImag)
{ {
var actual = new Complex(real, imag).InverseHyperbolicCosecant(); var actual = new Complex(real, imag).Acsch();
var expected = new Complex(expectedReal, expectedImag); var expected = new Complex(expectedReal, expectedImag);
AssertHelpers.AlmostEqual(expected, actual, 14); AssertHelpers.AlmostEqual(expected, actual, 14);
} }

Loading…
Cancel
Save