Announcement

Collapse
No announcement yet.

Unconfigured Ad Widget

Collapse

Integral solution using Simpson's Rule

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Integral solution using Simpson's Rule

    Integral solution using Simpson's Rule(numerical integration) in VBA. Using any integral formula, does anybody out there knows how to use VBA to get integral solution using simpson's rule?
    Last edited by Isabella; June 9th, 2005, 17:02. Reason: change title

  • #2
    Re: huh?

    Please use a helpful title when posting questions. This thread's title is totally useless!!!! It cannot be used in Searches & will probably not attract too much attention.
    Hope that Helps

    Roy

    New users should read the Forum Rules before posting

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

    Comment


    • #3
      Re: Integral solution using Simpson's Rule

      is that ok?

      Comment


      • #4
        Re: Integral solution using Simpson's Rule

        I think you might find you get more help now. Thanks
        Hope that Helps

        Roy

        New users should read the Forum Rules before posting

        For free Excel tools & articles visit my web site

        If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

        RoyUK's Web Site

        royUK's Database Form

        Where to paste code from the Forum

        About me.

        Comment


        • #5
          Re: Integral solution using Simpson's Rule

          you can find all you want in Numerical Recipes

          look at the loowing link:

          http://www.library.cornell.edu/nr/bookcpdf/c4-2.pdf

          filo65

          Comment


          • #6
            Re: Integral solution using Simpson's Rule

            Thanks

            Comment


            • #7
              Re: Integral solution using Simpson's Rule

              It's not as stringent as simpson's rule, but here's a numerical integration UDF I wrote using the trapezoid rule. Perhaps it will be good enough for your situation.

              Code:
              Function AUC(xRng As Range, yRng As Range) As Double
              ' Approximation of the definite integral using the Trapezoid rule
              Dim xRows As Integer, yRows As Integer
              Dim xRow As Integer, yRow As Integer
              Dim LeftRule As Double, RightRule As Double, TrapRule As Double, MidRule As Double
              xRows = xRng.Rows.Count
              yRows = yRng.Rows.Count
              RightRule = 0
              LeftRule = 0
              TrapRule = 0
              
              For i = 2 To xRows
                RightRule = RightRule + yRng.Cells(i, 1) * (xRng.Cells(i, 1) - xRng.Cells(i - 1, 1))
                LeftRule = LeftRule + yRng.Cells(i - 1, 1) * (xRng.Cells(i, 1) - xRng.Cells(i - 1, 1))
                TrapRule = (LeftRule + RightRule) / 2
              Next i
              AUC = TrapRule
              End Function
              Attached Files

              Comment

              Trending

              Collapse

              There are no results that meet this criteria.

              Working...
              X