⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sample5_11.cs

📁 使用C#编辑的一些矩阵运算的源程序
💻 CS
字号:
/*
 * 示例程序Sample5_11: NLEquations类的求非线性方程一个实根的蒙特卡洛法
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
        // 建立NLEquation的子类,在其中重载函数func
        class NLEq : NLEquations
        {
            protected override double Func(double x)
            {
                double z = Math.Exp(-x*x*x)-Math.Sin(x)/Math.Cos(x)+800.0;
                return z;
            }
        }
        
        [STAThread]
		static void Main(string[] args)
		{
            // 求解
            NLEq nleq = new NLEq();
            double x=0.5; 
            double b=1.0; 
            int m=10;
            double eps=0.000001;
            nleq.GetRootMonteCarlo(ref x, b, m, eps);
            Console.WriteLine(x);
        }
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -