Results 1 to 2 of 2

Thread: Quadrature integration--> two variable function

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    1

    Quadrature integration--> two variable function in IMSL C#

    Hi Guys,
    I have got a problem with using integration in Quadrature method.
    Actually I need to pass two variables to the "Function"F(double x) . For example I want F to accept two variables (x,y) instead of just x. The variable Y is defined under the "main" method.
    How can I modify the code below?
    needed: public double F(double x, double y)


    thanks

    -------------------------------------------------------------------------


    using System;
    using Imsl.Math;
    public class QuadratureEx2 : Quadrature.IFunction
    {
    public double F(double x)
    {
    return Math.Exp(- x);
    }
    public static void Main(String[] args)
    {
    Quadrature q = new Quadrature();
    Quadrature.IFunction fcn = new QuadratureEx2();
    double result = q.Eval(fcn, 0.0, Double.PositiveInfinity);
    double expect = 1.0;
    Console.Out.WriteLine("result = " + result);
    Console.Out.WriteLine("expect = " + expect);
    }
    }

  2. #2
    Senior Member
    Join Date
    Sep 2005
    Location
    Albuquerque, NM USA
    Posts
    140
    There is a way to do this within the C# framework. It is awkward but workable. First, please state a sample two-dimensional integral you would like to evaluate. The recommendation for what to use will depend on the integrand function and the shape of the integration domain.

    There is a 2D integration routine being added to Fortran Numerical Library, Version 7. There is no schedule for adding this algorithm to C# at present.

    Regards,
    Dickie T. Bird

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •