From ba77fb9bc93c2234d54fb2eac2ed2ce467383fbf Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Wed, 14 Aug 2013 19:23:37 +0200 Subject: [PATCH] Trig: use common short names for trig functions --- src/FSharp/Complex.fs | 56 +++++--- src/FSharp/Complex.fsi | 91 ++++++++---- src/Numerics/Complex32.cs | 18 +-- src/Numerics/Complex64.cs | 20 +-- src/Numerics/Trigonometry.cs | 232 +++++++++++++++--------------- src/UnitTests/TrigonometryTest.cs | 96 ++++++------- 6 files changed, 279 insertions(+), 234 deletions(-) diff --git a/src/FSharp/Complex.fs b/src/FSharp/Complex.fs index d75acea2..5d4767f4 100644 --- a/src/FSharp/Complex.fs +++ b/src/FSharp/Complex.fs @@ -58,22 +58,30 @@ namespace MathNet.Numerics let sin x = Complex.Sin(x) let cos x = Complex.Cos(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 acos x = Complex.Acos(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 cosh x = Complex.Cosh(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 csc (x:complex) = Trig.Cosecant(x) - let cot (x:complex) = Trig.Cotangent(x) - let asec (x:complex) = Trig.InverseSecant(x) - let acsc (x:complex) = Trig.InverseCosecant(x) - let acot (x:complex) = Trig.InverseCotangent(x) - let sech (x:complex) = Trig.HyperbolicSecant(x) - let csch (x:complex) = Trig.HyperbolicCosecant(x) - let coth (x:complex) = Trig.HyperbolicCotangent(x) + let asinh (x:complex) = Trig.Asinh(x) + let acosh (x:complex) = Trig.Acosh(x) + let atanh (x:complex) = Trig.Atanh(x) + let acoth (x:complex) = Trig.Acoth(x) + let asech (x:complex) = Trig.Asech(x) + let acsch (x:complex) = Trig.Acsch(x) [] [] @@ -114,26 +122,34 @@ namespace MathNet.Numerics let sqr (x:complex32) = x.Square() 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 cos x = Complex32.Cos(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 acos x = Complex32.Acos(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 cosh x = Complex32.Cosh(x) let tanh x = Complex32.Tanh(x) - - // no complex32 implementations available yet, fix once available - let sec (x:complex32) = ofComplex <| Trig.Secant(x.ToComplex()) - let csc (x:complex32) = ofComplex <| Trig.Cosecant(x.ToComplex()) - let cot (x:complex32) = ofComplex <| Trig.Cotangent(x.ToComplex()) - let asec (x:complex32) = ofComplex <| Trig.InverseSecant(x.ToComplex()) - let acsc (x:complex32) = ofComplex <| Trig.InverseCosecant(x.ToComplex()) - let acot (x:complex32) = ofComplex <| Trig.InverseCotangent(x.ToComplex()) - let sech (x:complex32) = ofComplex <| Trig.HyperbolicSecant(x.ToComplex()) - let csch (x:complex32) = ofComplex <| Trig.HyperbolicCosecant(x.ToComplex()) - let coth (x:complex32) = ofComplex <| Trig.HyperbolicCotangent(x.ToComplex()) + let coth (x:complex32) = ofComplex <| Trig.Coth(x.ToComplex()) + let sech (x:complex32) = ofComplex <| Trig.Sech(x.ToComplex()) + let csch (x:complex32) = ofComplex <| Trig.Csch(x.ToComplex()) + + let asinh (x:complex32) = ofComplex <| Trig.Asinh(x.ToComplex()) + let acosh (x:complex32) = ofComplex <| Trig.Acosh(x.ToComplex()) + let atanh (x:complex32) = ofComplex <| Trig.Atanh(x.ToComplex()) + let acoth (x:complex32) = ofComplex <| Trig.Acoth(x.ToComplex()) + let asech (x:complex32) = ofComplex <| Trig.Asech(x.ToComplex()) + let acsch (x:complex32) = ofComplex <| Trig.Acsch(x.ToComplex()) [] module ComplexExtensions = diff --git a/src/FSharp/Complex.fsi b/src/FSharp/Complex.fsi index 8b43e22c..20674c16 100644 --- a/src/FSharp/Complex.fsi +++ b/src/FSharp/Complex.fsi @@ -79,44 +79,58 @@ namespace MathNet.Numerics val sqr : complex -> complex /// sqrt(x) and 0 <= phase(x) < pi val sqrt : complex -> complex - + /// Sine val sin : complex -> complex /// Cosine val cos : complex -> complex /// Tagent val tan : complex -> complex + /// Cotangent + val cot : complex -> complex + /// Secant + val sec : complex -> complex + /// Cosecant + val csc : complex -> complex + /// Arc Sine val asin : complex -> complex /// Arc Cosine val acos : complex -> complex /// Arc Tagent val atan : complex -> complex + /// Arc Cotangent + val acot : complex -> complex + /// Arc Secant + val asec : complex -> complex + /// Arc Cosecant + val acsc : complex -> complex + /// Hyperbolic Sine val sinh : complex -> complex /// Hyperbolic Cosine val cosh : complex -> complex /// Hyperbolic Tagent val tanh : complex -> complex - - /// Secant - 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 Cotangent + val coth : complex -> complex /// Hyperbolic Secant val sech : complex -> complex /// Hyperbolic Cosecant 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 [] [] @@ -189,37 +203,52 @@ namespace MathNet.Numerics val cos : complex32 -> complex32 /// Tagent val tan : complex32 -> complex32 + /// Cotangent + val cot : complex32 -> complex32 + /// Secant + val sec : complex32 -> complex32 + /// Cosecant + val csc : complex32 -> complex32 + /// Arc Sine val asin : complex32 -> complex32 /// Arc Cosine val acos : complex32 -> complex32 /// Arc Tagent val atan : complex32 -> complex32 + /// Arc Cotangent + val acot : complex32 -> complex32 + /// Arc Secant + val asec : complex32 -> complex32 + /// Arc Cosecant + val acsc : complex32 -> complex32 + /// Hyperbolic Sine val sinh : complex32 -> complex32 /// Hyperbolic Cosine val cosh : complex32 -> complex32 /// Hyperbolic Tagent val tanh : complex32 -> complex32 - - /// Secant - 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 Cotangent + val coth : complex32 -> complex32 /// Hyperbolic Secant val sech : complex32 -> complex32 /// Hyperbolic Cosecant 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 + [] module ComplexExtensions = diff --git a/src/Numerics/Complex32.cs b/src/Numerics/Complex32.cs index 2fdf9da5..5aa4c7eb 100644 --- a/src/Numerics/Complex32.cs +++ b/src/Numerics/Complex32.cs @@ -1402,7 +1402,7 @@ namespace MathNet.Numerics /// A complex number. public static Complex32 Sin(Complex32 value) { - return (Complex32)Trig.Sine(value.ToComplex()); + return (Complex32)Trig.Sin(value.ToComplex()); } /// @@ -1412,7 +1412,7 @@ namespace MathNet.Numerics /// A complex number. public static Complex32 Cos(Complex32 value) { - return (Complex32)Trig.Cosine(value.ToComplex()); + return (Complex32)Trig.Cos(value.ToComplex()); } /// @@ -1422,7 +1422,7 @@ namespace MathNet.Numerics /// A complex number. public static Complex32 Tan(Complex32 value) { - return (Complex32)Trig.Tangent(value.ToComplex()); + return (Complex32)Trig.Tan(value.ToComplex()); } /// @@ -1432,7 +1432,7 @@ namespace MathNet.Numerics /// A complex number. public static Complex32 Asin(Complex32 value) { - return (Complex32)Trig.InverseSine(value.ToComplex()); + return (Complex32)Trig.Asin(value.ToComplex()); } /// @@ -1442,7 +1442,7 @@ namespace MathNet.Numerics /// A complex number that represents a cosine. public static Complex32 Acos(Complex32 value) { - return (Complex32)Trig.InverseCosine(value.ToComplex()); + return (Complex32)Trig.Acos(value.ToComplex()); } /// @@ -1452,7 +1452,7 @@ namespace MathNet.Numerics /// A complex number. public static Complex32 Atan(Complex32 value) { - return (Complex32)Trig.InverseTangent(value.ToComplex()); + return (Complex32)Trig.Atan(value.ToComplex()); } /// @@ -1462,7 +1462,7 @@ namespace MathNet.Numerics /// A complex number. public static Complex32 Sinh(Complex32 value) { - return (Complex32)Trig.HyperbolicSine(value.ToComplex()); + return (Complex32)Trig.Sinh(value.ToComplex()); } /// @@ -1472,7 +1472,7 @@ namespace MathNet.Numerics /// A complex number. public static Complex32 Cosh(Complex32 value) { - return (Complex32)Trig.HyperbolicCosine(value.ToComplex()); + return (Complex32)Trig.Cosh(value.ToComplex()); } /// @@ -1482,7 +1482,7 @@ namespace MathNet.Numerics /// A complex number. public static Complex32 Tanh(Complex32 value) { - return (Complex32)Trig.HyperbolicTangent(value.ToComplex()); + return (Complex32)Trig.Tanh(value.ToComplex()); } } } diff --git a/src/Numerics/Complex64.cs b/src/Numerics/Complex64.cs index 262a1460..9303eb3a 100644 --- a/src/Numerics/Complex64.cs +++ b/src/Numerics/Complex64.cs @@ -1066,7 +1066,7 @@ namespace MathNet.Numerics 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)); } /// @@ -1172,7 +1172,7 @@ namespace MathNet.Numerics [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static Complex Sin(Complex value) { - return Trig.Sine(value); + return Trig.Sin(value); } /// @@ -1183,7 +1183,7 @@ namespace MathNet.Numerics [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static Complex Cos(Complex value) { - return Trig.Cosine(value); + return Trig.Cos(value); } /// @@ -1194,7 +1194,7 @@ namespace MathNet.Numerics [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static Complex Tan(Complex value) { - return Trig.Tangent(value); + return Trig.Tan(value); } /// @@ -1205,7 +1205,7 @@ namespace MathNet.Numerics [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static Complex Asin(Complex value) { - return Trig.InverseSine(value); + return Trig.Asin(value); } /// @@ -1216,7 +1216,7 @@ namespace MathNet.Numerics [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static Complex Acos(Complex value) { - return Trig.InverseCosine(value); + return Trig.Acos(value); } /// @@ -1227,7 +1227,7 @@ namespace MathNet.Numerics [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static Complex Atan(Complex value) { - return Trig.InverseTangent(value); + return Trig.Atan(value); } /// @@ -1238,7 +1238,7 @@ namespace MathNet.Numerics [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static Complex Sinh(Complex value) { - return Trig.HyperbolicSine(value); + return Trig.Sinh(value); } /// @@ -1249,7 +1249,7 @@ namespace MathNet.Numerics [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static Complex Cosh(Complex value) { - return Trig.HyperbolicCosine(value); + return Trig.Cosh(value); } /// @@ -1260,7 +1260,7 @@ namespace MathNet.Numerics [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static Complex Tanh(Complex value) { - return Trig.HyperbolicTangent(value); + return Trig.Tanh(value); } } } diff --git a/src/Numerics/Trigonometry.cs b/src/Numerics/Trigonometry.cs index 32c93528..c74c40b9 100644 --- a/src/Numerics/Trigonometry.cs +++ b/src/Numerics/Trigonometry.cs @@ -139,7 +139,7 @@ namespace MathNet.Numerics /// /// The sine of the radian angle. /// - public static double Sine(double radian) + public static double Sin(double radian) { return Math.Sin(radian); } @@ -153,16 +153,16 @@ namespace MathNet.Numerics /// /// The sine of the complex number. /// - public static Complex Sine(this Complex value) + public static Complex Sin(this Complex value) { if (value.IsReal()) { - return new Complex(Sine(value.Real), 0.0); + return new Complex(Sin(value.Real), 0.0); } return new Complex( - Sine(value.Real) * HyperbolicCosine(value.Imaginary), - Cosine(value.Real) * HyperbolicSine(value.Imaginary)); + Sin(value.Real) * Cosh(value.Imaginary), + Cos(value.Real) * Sinh(value.Imaginary)); } /// @@ -174,7 +174,7 @@ namespace MathNet.Numerics /// /// The cosine of an angle in radian. /// - public static double Cosine(double radian) + public static double Cos(double radian) { return Math.Cos(radian); } @@ -188,16 +188,16 @@ namespace MathNet.Numerics /// /// The cosine of a complex number. /// - public static Complex Cosine(this Complex value) + public static Complex Cos(this Complex value) { if (value.IsReal()) { - return new Complex(Cosine(value.Real), 0.0); + return new Complex(Cos(value.Real), 0.0); } return new Complex( - Cosine(value.Real) * HyperbolicCosine(value.Imaginary), - -Sine(value.Real) * HyperbolicSine(value.Imaginary)); + Cos(value.Real) * Cosh(value.Imaginary), + -Sin(value.Real) * Sinh(value.Imaginary)); } /// @@ -209,7 +209,7 @@ namespace MathNet.Numerics /// /// The tangent of the radian angle. /// - public static double Tangent(double radian) + public static double Tan(double radian) { return Math.Tan(radian); } @@ -223,18 +223,18 @@ namespace MathNet.Numerics /// /// The tangent of the complex number. /// - public static Complex Tangent(this Complex value) + public static Complex Tan(this Complex value) { 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 sinhi = HyperbolicSine(value.Imaginary); + var cosr = Cos(value.Real); + var sinhi = Sinh(value.Imaginary); 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); } /// @@ -246,7 +246,7 @@ namespace MathNet.Numerics /// /// The cotangent of an angle in radian. /// - public static double Cotangent(double radian) + public static double Cot(double radian) { return 1 / Math.Tan(radian); } @@ -260,18 +260,18 @@ namespace MathNet.Numerics /// /// The cotangent of the complex number. /// - public static Complex Cotangent(this Complex value) + public static Complex Cot(this Complex value) { if (value.IsReal()) { - return new Complex(Cotangent(value.Real), 0d); + return new Complex(Cot(value.Real), 0d); } - var sinr = Sine(value.Real); - var sinhi = HyperbolicSine(value.Imaginary); + var sinr = Sin(value.Real); + var sinhi = Sinh(value.Imaginary); 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); } /// @@ -283,7 +283,7 @@ namespace MathNet.Numerics /// /// The secant of the radian angle. /// - public static double Secant(double radian) + public static double Sec(double radian) { return 1 / Math.Cos(radian); } @@ -297,18 +297,18 @@ namespace MathNet.Numerics /// /// The secant of the complex number. /// - public static Complex Secant(this Complex value) + public static Complex Sec(this Complex value) { if (value.IsReal()) { - return new Complex(Secant(value.Real), 0d); + return new Complex(Sec(value.Real), 0d); } - var cosr = Cosine(value.Real); - var sinhi = HyperbolicSine(value.Imaginary); + var cosr = Cos(value.Real); + var sinhi = Sinh(value.Imaginary); 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); } /// @@ -320,7 +320,7 @@ namespace MathNet.Numerics /// /// Cosecant of an angle in radian. /// - public static double Cosecant(double radian) + public static double Csc(double radian) { return 1 / Math.Sin(radian); } @@ -334,18 +334,18 @@ namespace MathNet.Numerics /// /// The cosecant of a complex number. /// - public static Complex Cosecant(this Complex value) + public static Complex Csc(this Complex value) { if (value.IsReal()) { - return new Complex(Cosecant(value.Real), 0d); + return new Complex(Csc(value.Real), 0d); } - var sinr = Sine(value.Real); - var sinhi = HyperbolicSine(value.Imaginary); + var sinr = Sin(value.Real); + var sinhi = Sinh(value.Imaginary); 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); } /// @@ -357,7 +357,7 @@ namespace MathNet.Numerics /// /// The inverse sine of the radian angle. /// - public static double InverseSine(double radian) + public static double Asin(double radian) { return Math.Asin(radian); } @@ -371,11 +371,11 @@ namespace MathNet.Numerics /// /// The arc sine of a complex number. /// - public static Complex InverseSine(this Complex value) + public static Complex Asin(this Complex value) { 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(); @@ -393,7 +393,7 @@ namespace MathNet.Numerics /// /// if 1 < or < -1. /// - public static double InverseCosine(double radian) + public static double Acos(double radian) { return Math.Acos(radian); } @@ -407,11 +407,11 @@ namespace MathNet.Numerics /// /// The arc cosine of a complex number. /// - public static Complex InverseCosine(this Complex value) + public static Complex Acos(this Complex value) { 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(); @@ -426,7 +426,7 @@ namespace MathNet.Numerics /// /// The inverse tangent of the radian angle. /// - public static double InverseTangent(double radian) + public static double Atan(double radian) { return Math.Atan(radian); } @@ -440,7 +440,7 @@ namespace MathNet.Numerics /// /// The arc tangent of a complex number. /// - public static Complex InverseTangent(this Complex value) + public static Complex Atan(this Complex value) { var iz = new Complex(-value.Imaginary, value.Real); // I*this return new Complex(0, 0.5) * ((1 - iz).NaturalLogarithm() - (1 + iz).NaturalLogarithm()); @@ -455,7 +455,7 @@ namespace MathNet.Numerics /// /// The inverse cotangent of the radian angle. /// - public static double InverseCotangent(double radian) + public static double Acot(double radian) { return Math.Atan(1 / radian); } @@ -469,7 +469,7 @@ namespace MathNet.Numerics /// /// The arc cotangent of a complex number. /// - public static Complex InverseCotangent(this Complex value) + public static Complex Acot(this Complex value) { if (value.IsZero()) { @@ -489,7 +489,7 @@ namespace MathNet.Numerics /// /// The inverse secant of the radian angle. /// - public static double InverseSecant(double radian) + public static double Asec(double radian) { return Math.Acos(1 / radian); } @@ -503,7 +503,7 @@ namespace MathNet.Numerics /// /// The arc secant of a complex number. /// - public static Complex InverseSecant(this Complex value) + public static Complex Asec(this Complex value) { var inv = 1 / value; return -Complex.ImaginaryOne * (inv + (Complex.ImaginaryOne * (1 - inv.Square()).SquareRoot())).NaturalLogarithm(); @@ -521,7 +521,7 @@ namespace MathNet.Numerics /// /// if -1 < < 1. /// - public static double InverseCosecant(double radian) + public static double Acsc(double radian) { return Math.Asin(1 / radian); } @@ -535,7 +535,7 @@ namespace MathNet.Numerics /// /// The arc cosecant of a complex number. /// - public static Complex InverseCosecant(this Complex value) + public static Complex Acsc(this Complex value) { var inv = 1 / value; return -Complex.ImaginaryOne * ((Complex.ImaginaryOne * inv) + (1 - inv.Square()).SquareRoot()).NaturalLogarithm(); @@ -550,7 +550,7 @@ namespace MathNet.Numerics /// /// The hyperbolic sine of the radian angle. /// - public static double HyperbolicSine(double radian) + public static double Sinh(double radian) { return (Math.Exp(radian) - Math.Exp(-radian)) / 2; } @@ -564,16 +564,16 @@ namespace MathNet.Numerics /// /// The hyperbolic sine of a complex number. /// - public static Complex HyperbolicSine(this Complex value) + public static Complex Sinh(this Complex value) { if (value.IsReal()) { - return new Complex(HyperbolicSine(value.Real), 0.0); + return new Complex(Sinh(value.Real), 0.0); } return new Complex( - HyperbolicSine(value.Real) * Cosine(value.Imaginary), - HyperbolicCosine(value.Real) * Sine(value.Imaginary)); + Sinh(value.Real) * Cos(value.Imaginary), + Cosh(value.Real) * Sin(value.Imaginary)); } /// @@ -585,7 +585,7 @@ namespace MathNet.Numerics /// /// The hyperbolic Cosine of the radian angle. /// - public static double HyperbolicCosine(double radian) + public static double Cosh(double radian) { return (Math.Exp(radian) + Math.Exp(-radian)) / 2; } @@ -599,16 +599,16 @@ namespace MathNet.Numerics /// /// The hyperbolic cosine of a complex number. /// - public static Complex HyperbolicCosine(this Complex value) + public static Complex Cosh(this Complex value) { if (value.IsReal()) { - return new Complex(HyperbolicCosine(value.Real), 0.0); + return new Complex(Cosh(value.Real), 0.0); } return new Complex( - HyperbolicCosine(value.Real) * Cosine(value.Imaginary), - HyperbolicSine(value.Real) * Sine(value.Imaginary)); + Cosh(value.Real) * Cos(value.Imaginary), + Sinh(value.Real) * Sin(value.Imaginary)); } /// @@ -620,7 +620,7 @@ namespace MathNet.Numerics /// /// The hyperbolic tangent of the radian angle. /// - public static double HyperbolicTangent(double radian) + public static double Tanh(double radian) { if (radian > 19.1) { @@ -646,15 +646,15 @@ namespace MathNet.Numerics /// /// The hyperbolic tangent of a complex number. /// - public static Complex HyperbolicTangent(this Complex value) + public static Complex Tanh(this Complex value) { 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 sinhr = HyperbolicSine(value.Real); + var cosi = Cos(value.Imaginary); + var sinhr = Sinh(value.Real); if (double.IsInfinity(sinhr)) { @@ -663,7 +663,7 @@ namespace MathNet.Numerics 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); } /// @@ -675,7 +675,7 @@ namespace MathNet.Numerics /// /// The hyperbolic cotangent of the radian angle. /// - public static double HyperbolicCotangent(double radian) + public static double Coth(double radian) { if (radian > 19.115) { @@ -701,15 +701,15 @@ namespace MathNet.Numerics /// /// The hyperbolic cotangent of a complex number. /// - public static Complex HyperbolicCotangent(this Complex value) + public static Complex Coth(this Complex value) { 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 sinhr = HyperbolicSine(value.Real); + var sini = Sin(value.Imaginary); + var sinhr = Sinh(value.Real); if (double.IsInfinity(sinhr)) { @@ -718,7 +718,7 @@ namespace MathNet.Numerics 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); } /// @@ -730,9 +730,9 @@ namespace MathNet.Numerics /// /// The hyperbolic secant of the radian angle. /// - public static double HyperbolicSecant(double radian) + public static double Sech(double radian) { - return 1 / HyperbolicCosine(radian); + return 1 / Cosh(radian); } /// @@ -744,11 +744,11 @@ namespace MathNet.Numerics /// /// The hyperbolic secant of a complex number. /// - public static Complex HyperbolicSecant(this Complex value) + public static Complex Sech(this Complex value) { if (value.IsReal()) { - return new Complex(HyperbolicSecant(value.Real), 0.0); + return new Complex(Sech(value.Real), 0.0); } var exp = value.Exponential(); @@ -762,32 +762,43 @@ namespace MathNet.Numerics } /// - /// Trigonometric Hyperbolic Arc Cosecant + /// Trigonometric Hyperbolic Cosecant /// /// - /// The angle in radian angle. + /// The angle in radian. /// /// - /// The inverse hyperbolic cosecant of the radian angle. + /// The hyperbolic cosecant of the radian angle. /// - public static double InverseHyperbolicCosecant(double radian) + public static double Csch(double radian) { - return InverseHyperbolicSine(1 / radian); + return 1 / Sinh(radian); } /// - /// Trigonometric Hyperbolic Arc Cosecant of this Complex number. + /// Trigonometric Hyperbolic Cosecant of a Complex number. /// /// /// The complex value. /// /// - /// The hyperbolic arc cosecant of a complex number. + /// The hyperbolic cosecant of a complex number. /// - public static Complex InverseHyperbolicCosecant(this Complex value) + public static Complex Csch(this Complex value) { - var inv = 1 / value; - return (inv + (inv.Square() + 1).SquareRoot()).NaturalLogarithm(); + if (value.IsReal()) + { + return new Complex(Csch(value.Real), 0.0); + } + + var exp = value.Exponential(); + + if (exp.IsInfinity()) + { + return Complex.Zero; + } + + return 2 * exp / (exp.Square() - 1); } /// @@ -799,7 +810,7 @@ namespace MathNet.Numerics /// /// The inverse hyperbolic sine of the radian angle. /// - public static double InverseHyperbolicSine(double radian) + public static double Asinh(double radian) { return Math.Log(radian + Math.Sqrt((radian * radian) + 1), Math.E); } @@ -813,7 +824,7 @@ namespace MathNet.Numerics /// /// The hyperbolic arc sine of a complex number. /// - public static Complex InverseHyperbolicSine(this Complex value) + public static Complex Asinh(this Complex value) { return (value + (value.Square() + 1).SquareRoot()).NaturalLogarithm(); } @@ -827,7 +838,7 @@ namespace MathNet.Numerics /// /// The inverse hyperbolic cosine of the radian angle. /// - 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); } @@ -841,7 +852,7 @@ namespace MathNet.Numerics /// /// The hyperbolic arc cosine of a complex number. /// - public static Complex InverseHyperbolicCosine(this Complex value) + public static Complex Acosh(this Complex value) { return (value + ((value - 1).SquareRoot() * (value + 1).SquareRoot())).NaturalLogarithm(); } @@ -855,7 +866,7 @@ namespace MathNet.Numerics /// /// The inverse hyperbolic tangent of the radian angle. /// - public static double InverseHyperbolicTangent(double radian) + public static double Atanh(double radian) { return 0.5 * Math.Log((1 + radian) / (1 - radian), Math.E); } @@ -869,7 +880,7 @@ namespace MathNet.Numerics /// /// The hyperbolic arc tangent of a complex number. /// - public static Complex InverseHyperbolicTangent(this Complex value) + public static Complex Atanh(this Complex value) { return 0.5 * ((1 + value).NaturalLogarithm() - (1 - value).NaturalLogarithm()); } @@ -883,7 +894,7 @@ namespace MathNet.Numerics /// /// The inverse hyperbolic cotangent of the radian angle. /// - public static double InverseHyperbolicCotangent(double radian) + public static double Acoth(double radian) { return 0.5 * Math.Log((radian + 1) / (radian - 1), Math.E); } @@ -897,7 +908,7 @@ namespace MathNet.Numerics /// /// The hyperbolic arc cotangent of a complex number. /// - public static Complex InverseHyperbolicCotangent(this Complex value) + public static Complex Acoth(this Complex value) { var inv = 1.0 / value; return 0.5 * ((1.0 + inv).NaturalLogarithm() - (1.0 - inv).NaturalLogarithm()); @@ -912,9 +923,9 @@ namespace MathNet.Numerics /// /// The inverse hyperbolic secant of the radian angle. /// - public static double InverseHyperbolicSecant(double radian) + public static double Asech(double radian) { - return InverseHyperbolicCosine(1 / radian); + return Acosh(1 / radian); } /// @@ -926,50 +937,39 @@ namespace MathNet.Numerics /// /// The hyperbolic arc secant of a complex number. /// - public static Complex InverseHyperbolicSecant(this Complex value) + public static Complex Asech(this Complex value) { var inv = 1 / value; return (inv + ((inv - 1).SquareRoot() * (inv + 1).SquareRoot())).NaturalLogarithm(); } /// - /// Trigonometric Hyperbolic Cosecant + /// Trigonometric Hyperbolic Arc Cosecant /// /// - /// The angle in radian. + /// The angle in radian angle. /// /// - /// The hyperbolic cosecant of the radian angle. + /// The inverse hyperbolic cosecant of the radian angle. /// - public static double HyperbolicCosecant(double radian) + public static double Acsch(double radian) { - return 1 / HyperbolicSine(radian); + return Asinh(1 / radian); } /// - /// Trigonometric Hyperbolic Cosecant of a Complex number. + /// Trigonometric Hyperbolic Arc Cosecant of this Complex number. /// /// /// The complex value. /// /// - /// The hyperbolic cosecant of a complex number. + /// The hyperbolic arc cosecant of a complex number. /// - public static Complex HyperbolicCosecant(this Complex value) + public static Complex Acsch(this Complex value) { - if (value.IsReal()) - { - return new Complex(HyperbolicCosecant(value.Real), 0.0); - } - - var exp = value.Exponential(); - - if (exp.IsInfinity()) - { - return Complex.Zero; - } - - return 2 * exp / (exp.Square() - 1); + var inv = 1 / value; + return (inv + (inv.Square() + 1).SquareRoot()).NaturalLogarithm(); } } } \ No newline at end of file diff --git a/src/UnitTests/TrigonometryTest.cs b/src/UnitTests/TrigonometryTest.cs index 0e8b8623..31f155c9 100644 --- a/src/UnitTests/TrigonometryTest.cs +++ b/src/UnitTests/TrigonometryTest.cs @@ -52,7 +52,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -8.388608e6, double.PositiveInfinity, double.NegativeInfinity)] 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); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -73,7 +73,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -8.388608e6, double.NegativeInfinity, double.NegativeInfinity)] 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); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -94,7 +94,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-8.388608e6, -1.19209289550780998537e-7, 0.47934123862653449, -1.4659977233982276e-7)] 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); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -111,7 +111,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -8388608.0000000376)] public void CanComputeCosecant(double value, double expected) { - var actual = Trig.Cosecant(value); + var actual = Trig.Csc(value); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -127,7 +127,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 0.99999999999999289)] public void CanComputeCosine(double value, double expected) { - var actual = Trig.Cosine(value); + var actual = Trig.Cos(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -143,7 +143,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -8388607.999999978)] public void CanComputeCotangent(double value, double expected) { - var actual = Trig.Cotangent(value); + var actual = Trig.Cot(value); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -159,7 +159,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -8388607.9999999978)] public void CanComputeHyperbolicCosecant(double value, double expected) { - var actual = Trig.HyperbolicCosecant(value); + var actual = Trig.Csch(value); AssertHelpers.AlmostEqual(expected, actual, 15); } @@ -175,7 +175,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 1.0000000000000071)] public void CanComputeHyperbolicCosine(double value, double expected) { - var actual = Trig.HyperbolicCosine(value); + var actual = Trig.Cosh(value); AssertHelpers.AlmostEqual(expected, actual, 15); } @@ -191,7 +191,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -8388608.0000000574)] public void CanComputeHyperbolicCotangent(double value, double expected) { - var actual = Trig.HyperbolicCotangent(value); + var actual = Trig.Coth(value); AssertHelpers.AlmostEqual(expected, actual, 15); } @@ -207,7 +207,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 0.99999999999999289)] public void CanComputeHyperbolicSecant(double value, double expected) { - var actual = Trig.HyperbolicSecant(value); + var actual = Trig.Sech(value); AssertHelpers.AlmostEqual(expected, actual, 15); } @@ -222,7 +222,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -1.1920928955078128e-7)] public void CanComputeHyperbolicSine(double value, double expected) { - var actual = Trig.HyperbolicSine(value); + var actual = Trig.Sinh(value); AssertHelpers.AlmostEqual(expected, actual, 15); } @@ -238,7 +238,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -1.1920928955078043e-7)] public void CanComputeHyperbolicTangent(double value, double expected) { - var actual = Trig.HyperbolicTangent(value); + var actual = Trig.Tanh(value); AssertHelpers.AlmostEqual(expected, actual, 15); } @@ -253,7 +253,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1, -1.5707963267948966)] public void CanComputeInverseCosecant(double value, double expected) { - var actual = Trig.InverseCosecant(value); + var actual = Trig.Acsc(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -268,7 +268,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 1.5707964460041861)] public void CanComputeInverseCosine(double value, double expected) { - var actual = Trig.InverseCosine(value); + var actual = Trig.Acos(value); AssertHelpers.AlmostEqual(expected, actual, 15); } @@ -284,7 +284,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -1.5707962075856071)] public void CanComputeInverseCotangent(double value, double expected) { - var actual = Trig.InverseCotangent(value); + var actual = Trig.Acot(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -300,7 +300,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -16.635532333438693)] public void CanComputeInverseHyperbolicCosecant(double value, double expected) { - var actual = Trig.InverseHyperbolicCosecant(value); + var actual = Trig.Acsch(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -313,7 +313,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(8388608, 16.635532333438682)] public void CanComputeInverseHyperbolicCosine(double value, double expected) { - var actual = Trig.InverseHyperbolicCosine(value); + var actual = Trig.Acosh(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -328,7 +328,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1, double.NegativeInfinity)] public void CanComputeInverseHyperbolicCotangent(double value, double expected) { - var actual = Trig.InverseHyperbolicCotangent(value); + var actual = Trig.Acoth(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -342,7 +342,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(1, 0.0)] public void CanComputeInverseHyperbolicSecant(double value, double expected) { - var actual = Trig.InverseHyperbolicSecant(value); + var actual = Trig.Asech(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -358,7 +358,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -1.1920928955078072e-7)] public void CanComputeInverseHyperbolicSine(double value, double expected) { - var actual = Trig.InverseHyperbolicSine(value); + var actual = Trig.Asinh(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -374,7 +374,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -1.19209289550780998537e-7)] public void CanComputeInverseHyperbolicTangent(double value, double expected) { - var actual = Trig.InverseHyperbolicTangent(value); + var actual = Trig.Atanh(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -389,7 +389,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.0, 3.1415926535897932)] public void CanComputeInverseSecant(double value, double expected) { - var actual = Trig.InverseSecant(value); + var actual = Trig.Asec(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -405,7 +405,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -1.1920928955078128e-7)] public void CanComputeInverseSine(double value, double expected) { - var actual = Trig.InverseSine(value); + var actual = Trig.Asin(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -421,7 +421,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -1.19209289550780998537e-7)] public void CanComputeInverseTangent(double value, double expected) { - var actual = Trig.InverseTangent(value); + var actual = Trig.Atan(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -437,7 +437,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 1.0000000000000071)] public void CanComputeSecant(double value, double expected) { - var actual = Trig.Secant(value); + var actual = Trig.Sec(value); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -453,7 +453,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -1.1920928955078072e-7)] public void CanComputeSine(double value, double expected) { - var actual = Trig.Sine(value); + var actual = Trig.Sin(value); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -469,7 +469,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, -1.1920928955078157e-7)] public void CanComputeTangent(double value, double expected) { - var actual = Trig.Tangent(value); + var actual = Trig.Tan(value); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -543,7 +543,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-8.388608e6, -1.19209289550780998537e-7, 2.0861964701080704, 6.3803383253713457e-7)] 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); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -564,7 +564,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-8.388608e6, -1.19209289550780998537e-7, -1.1089490624226177, 6.3367488045143761e-8)] 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); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -585,7 +585,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-8.388608e6, -1.19209289550780998537e-7, -2.3134856195557596, -5.7534999050657057e-7)] 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); AssertHelpers.AlmostEqual(expected, actual, 13); } @@ -607,7 +607,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.45730415318424922, -0.54061268571315335)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -629,7 +629,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.9895848833999199, -0.24982639750046154)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -651,7 +651,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.56408314126749848, -0.40389645531602575)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -673,7 +673,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 1.1719451445243514, -0.8391395790248311)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -695,7 +695,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.94997886761549463, 0.23982763093808804)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -717,7 +717,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.91207426403881078, 1.0782296946540223)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -741,7 +741,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-123400000000d, 0d, -1.57079632679489661923, 26.23184412897764390497)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -765,7 +765,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(-123400000000d, 0d, 3.14159265358979323846, -26.23184412897764390497)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -787,7 +787,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.5535743588970452, -0.40235947810852507)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -809,7 +809,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 1.0172219678978514, 0.40235947810852509)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -830,7 +830,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.90455689430238136, -1.0612750619050357)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -851,7 +851,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.66623943249251526, 1.0612750619050357)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -872,7 +872,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.53063753095251787, -0.4522784471511907)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -893,7 +893,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.53063753095251787, -1.1185178796437059)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -914,7 +914,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.40235947810852509, -0.55357435889704525)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -935,7 +935,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 0.40235947810852509, 1.0172219678978514)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -956,7 +956,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 1.0612750619050357, 0.90455689430238136)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); } @@ -977,7 +977,7 @@ namespace MathNet.Numerics.UnitTests [TestCase(0.5, -0.5, 1.0612750619050357, 0.66623943249251526)] 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); AssertHelpers.AlmostEqual(expected, actual, 14); }