example.cs

来自「Labview s trapezoital algorithm」· CS 代码 · 共 36 行

CS
36
字号
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2003 CenterSpace Software, LLC                            //
//                                                                         //
// This code is free software under the Artistic license.                  //
//                                                                         //
// CenterSpace Software                                                    //
// 2098 NW Myrtlewood Way                                                  //
// Corvallis, Oregon, 97330                                                //
// USA                                                                     //
// http://www.centerspace.net                                              //
/////////////////////////////////////////////////////////////////////////////

using System;

namespace Trapezoid
{
	public class Example
	{
    public static void Main()
    {
      Console.WriteLine();
      double lower = 0.3;
      double upper = 0.6;
      DoubleFunction function = new DoubleFunction( Example.Foo );
      double integral = TrapezoidalRule.Integrate( function, lower, upper );
      Console.WriteLine( "Integral from " + lower + " to " + upper + " is " + integral );
      Console.ReadLine();
    }

    internal static double Foo( double d )
    {
      return Math.Sin( d ) + ( d * d );
    }
	}
}

⌨️ 快捷键说明

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