public static void moebius_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    MOEBIUS_TEST tests MOEBIUS.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    02 June 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int c = 0;
        int n = 0;

        Console.WriteLine("");
        Console.WriteLine("MOEBIUS_TEST");
        Console.WriteLine("  MOEBIUS computes the Moebius function.");
        Console.WriteLine("");
        Console.WriteLine("      N   Exact   MOEBIUS(N)");
        Console.WriteLine("");

        int n_data = 0;

        for (;;)
        {
            Burkardt.Values.Moebius.moebius_values(ref n_data, ref n, ref c);

            if (n_data == 0)
            {
                break;
            }

            Console.WriteLine("  "
                              + n.ToString().PadLeft(8) + "  "
                              + c.ToString().PadLeft(10) + "  "
                              + Moebius.moebius(n).ToString().PadLeft(10) + "");
        }
    }
示例#2
0
    public void Update()
    {
        if (this.oculusTouch.GetButton(this.button1) || this.oculusTouch.GetButton(this.button2))
        {
            //this.intersectionManager.Update();
            if (!this.HaveInterSections()) //this.intersectionManager.HaveInterSections())
            {
                Moebius moebius = new Moebius(newCurves);
                if (this.oculusTouch.GetButton(this.button1))
                {
                    moebius.Flow();
                }
                else if (this.oculusTouch.GetButton(this.button2))
                {
                    moebius.MomentumFlow();
                }

                foreach (Curve curve in this.newCurves)
                {
                    while (true)
                    {
                        Elasticity elasticity = new Elasticity(curve.points, curve.momentum, curve.segment);
                        if (elasticity.MaxError() < curve.segment * 0.2f)
                        {
                            break;
                        }
                        elasticity.Flow();
                    }
                }
            }
        }

        if (this.oculusTouch.GetButtonUp(this.button2))
        {
            foreach (Curve curve in this.newCurves)
            {
                curve.MomentumInitialize();
            }
        }

        foreach (Curve curve in this.newCurves)
        {
            curve.MeshUpdate();
            Graphics.DrawMesh(curve.mesh, Vector3.zero, Quaternion.identity, MakeMesh.SelectedCurveMaterial, 0);
        }
    }
    public static void moebius_values_test()
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    MOEBIUS_VALUES_TEST tests MOEBIUS_VALUES.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    13 June 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int fn = 0;
        int n  = 0;

        Console.WriteLine("");
        Console.WriteLine("MOEBIUS_VALUES_TEST:");
        Console.WriteLine("  MOEBIUS_VALUES returns values of");
        Console.WriteLine("  the Moebius function.");
        Console.WriteLine("");
        Console.WriteLine("     N         MU(N)");
        Console.WriteLine("");
        int n_data = 0;

        for (;;)
        {
            Moebius.moebius_values(ref n_data, ref n, ref fn);
            if (n_data == 0)
            {
                break;
            }

            Console.WriteLine("  "
                              + n.ToString().PadLeft(8) + "  "
                              + fn.ToString().PadLeft(12) + "");
        }
    }
示例#4
0
    public static int mertens(int n)

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    MERTENS evaluates the Mertens function.
    //
    //  Discussion:
    //
    //    The Mertens function M(N) is the sum from 1 to N of the Moebius
    //    function MU.  That is,
    //
    //    M(N) = sum ( 1 <= I <= N ) MU(I)
    //
    //        N   M(N)
    //        --  ----
    //         1     1
    //         2     0
    //         3    -1
    //         4    -1
    //         5    -2
    //         6    -1
    //         7    -2
    //         8    -2
    //         9    -2
    //        10    -1
    //        11    -2
    //        12    -2
    //       100     1
    //      1000     2
    //     10000   -23
    //    100000   -48
    //
    //    The determinant of the Redheffer matrix of order N is equal
    //    to the Mertens function M(N).
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    16 October 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    //  Reference:
    //
    //    M Deleglise, J Rivat,
    //    Computing the Summation of the Moebius Function,
    //    Experimental Mathematics,
    //    Volume 5, 1996, pages 291-295.
    //
    //    Eric Weisstein,
    //    CRC Concise Encyclopedia of Mathematics,
    //    CRC Press, 2002,
    //    Second edition,
    //    ISBN: 1584883472,
    //    LC: QA5.W45
    //
    //  Parameters:
    //
    //    Input, int N, the argument.
    //
    //    Output, int MERTENS, the value.
    //
    {
        int i;

        int value = 0;

        for (i = 1; i <= n; i++)
        {
            value += Moebius.moebius(i);
        }
        return(value);
    }