Ejemplo n.º 1
0
        /// <summary>
        /// Returns the tangent of the specified complex number.
        /// </summary>
        /// <param name="value">A complex number.</param>
        /// <returns>The tangent of value.</returns>
        public static Complex Tan(Complex value)
        {
            double sa  = Functions.Sin(value.A);
            double ca  = Functions.Cos(value.A);
            double shb = Functions.Sinh(value.B);
            double cha = Functions.Cosh(value.B);

            return((new Complex(sa * cha, ca * shb)) / (new Complex(ca * cha, -sa * shb)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a matrix that rotates around the z-axis.
        /// </summary>
        /// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param>
        /// <returns>The created rotation matrix.</returns>
        public static Matrix2x2f RotationZ(float angle)
        {
            var cos = Functions.Cos(angle);
            var sin = Functions.Sin(angle);

            return(new Matrix2x2f(
                       cos, sin,
                       -sin, cos
                       ));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a matrix that rotates around the z-axis.
        /// </summary>
        /// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param>
        /// <returns>The created rotation matrix.</returns>
        public static Matrix2x2d RotationZ(double angle)
        {
            var cos = Functions.Cos(angle);
            var sin = Functions.Sin(angle);

            return(new Matrix2x2d(
                       cos, sin,
                       -sin, cos
                       ));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a matrix that rotates around the y-axis.
        /// </summary>
        /// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param>
        /// <returns>The created rotation matrix.</returns>
        public static Matrix3x3d RotationY(double angle)
        {
            var cos = Functions.Cos(angle);
            var sin = Functions.Sin(angle);

            return(new Matrix3x3d(
                       cos, 0, -sin,
                       0, 1, 0,
                       sin, 0, cos
                       ));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a matrix that rotates around the x-axis.
        /// </summary>
        /// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param>
        /// <returns>The created rotation matrix.</returns>
        public static Matrix3x3f RotationX(float angle)
        {
            var cos = Functions.Cos(angle);
            var sin = Functions.Sin(angle);

            return(new Matrix3x3f(
                       1, 0, 0,
                       0, cos, sin,
                       0, -sin, cos
                       ));
        }
Ejemplo n.º 6
0
 private static Complex Y(int l, int m, double phi, double theta)
 {
     return(K(l, m) * Complex.Exp(Complex.I * m * theta) * P(l, m, Functions.Cos(phi)));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates a complex number from a point's polar coordinates.
 /// </summary>
 /// <param name="coordinate">The polar coordinate</param>
 public static Complex FromPolarCoordinates(Geometry.PolarCoordinate coordinate)
 {
     return(new Complex(
                Functions.Cos(coordinate.Theta) * coordinate.Rho,
                Functions.Sin(coordinate.Theta) * coordinate.Rho));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Creates a complex number from a point's polar coordinates.
 /// </summary>
 /// <param name="magnitude">The magnitude, which is the distance from the origin (the intersection of
 /// the x-axis and the y-axis) to the number.</param>
 /// <param name="phase">The phase, which is the angle from the line to the horizontal axis, measured
 /// in radians.</param>
 public static Complex FromPolarCoordinates(double magnitude, double phase)
 {
     return(new Complex(Functions.Cos(phase) * magnitude, Functions.Sin(phase) * magnitude));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Returns the sine of the specified complex number.
 /// </summary>
 /// <param name="value">A complex number.</param>
 /// <returns>The sine of value.</returns>
 public static Complex Sin(Complex value)
 {
     return(new Complex(Functions.Sin(value.A) * Functions.Cosh(value.B), Functions.Cos(value.A) * Functions.Sinh(value.B)));
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Returns e raised to the power specified by a complex number.
        /// </summary>
        /// <param name="value">A complex number that specifies a power.</param>
        /// <returns>The number e raised to the power value.</returns>
        public static Complex Exp(Complex value)
        {
            double e = Functions.Exp(value.A);

            return(new Complex(e * Functions.Cos(value.B), e * Functions.Sin(value.B)));
        }