Пример #1
0
    public static double ellipsoid_volume(int m, double[] a, double[] v, double r)

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    ELLIPSOID_VOLUME returns the volume of an ellipsoid.
    //
    //  Discussion:
    //
    //    The points X in the ellipsoid are described by an M by M
    //    positive definite symmetric matrix A, an M-dimensional point V,
    //    and a "radius" R, such that
    //      (X-V)' * A * (X-V) <= R * R
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    14 August 2014
    //
    //  Author:
    //
    //    John Burkardt
    //
    //  Parameters:
    //
    //    Input, int M, the spatial dimension.
    //
    //    Input, double A[M*M], the matrix that describes
    //    the ellipsoid.  A must be symmetric and positive definite.
    //
    //    Input, double V[M], the "center" of the ellipse.
    //    The value of V is not actually needed by this function.
    //
    //    Input, double R, the "radius" of the ellipse.
    //
    //    Output, double ELLIPSOID_VOLUME, the volume of the ellipsoid.
    //
    {
        int i;

        double[] u = typeMethods.r8po_fa(m, a);

        double sqrt_det = 1.0;

        for (i = 0; i < m; i++)
        {
            sqrt_det *= u[i + i * m];
        }

        double volume = Math.Pow(r, m) * Hypersphere.hypersphere_unit_volume(m) / sqrt_det;

        return(volume);
    }