+ Reply to Thread
Results 1 to 5 of 5

Simpson's rule in Excel

Hybrid View

Guest Simpson's rule in Excel 01-23-2006, 11:40 AM
Guest Re: Simpson's rule in Excel 01-23-2006, 12:20 PM
Guest Re: Simpson's rule in Excel 01-23-2006, 02:45 PM
harrisongot Re: Simpson's rule in Excel 08-20-2015, 10:39 PM
FDibbins Re: Simpson's rule in Excel 08-20-2015, 10:43 PM
  1. #1
    James Silverton
    Guest

    Simpson's rule in Excel

    Hello, All!

    There have been no responses to a previous post but forgive me
    if I try again. If this is not regarded as a charting question,
    please let me know. Anyway, is it possible to write a statement
    evaluating the area under a graph by Simpson's rule without
    using VBA or helper columns?




    James Silverton
    Potomac, Maryland, USA


  2. #2
    Bernard Liengme
    Guest

    Re: Simpson's rule in Excel

    Please look at my screen shot of a worksheet on
    http://www.stfx.ca/people/bliengme/E...UnderCurve.htm

    I can generate the same result with:
    =(1/3)*(A6-A5)*SUMPRODUCT(--(MOD(ROW(A5:B9),2)=1),((B5:B9)+4*(B6:B10)+B7:B11))

    If you look at the screen shot you will see that my x values are in A5:A11,
    y-values in B5:B11
    When I use a 'helper column' I need formulas in C5, C7, C9; i.e. in odd
    cells hence the MOD(ROW(),2)=1 test



    Hope this helps
    --
    Bernard V Liengme
    www.stfx.ca/people/bliengme
    remove caps from email


    "James Silverton" <not.jim.silverton@comcast.not> wrote in message
    news:ew6lrLDIGHA.3904@TK2MSFTNGP10.phx.gbl...
    > Hello, All!
    >
    > There have been no responses to a previous post but forgive me if I try
    > again. If this is not regarded as a charting question, please let me know.
    > Anyway, is it possible to write a statement evaluating the area under a
    > graph by Simpson's rule without using VBA or helper columns?
    >
    >
    >
    >
    > James Silverton
    > Potomac, Maryland, USA




  3. #3
    David J. Braden
    Guest

    Re: Simpson's rule in Excel

    James,
    From an old post of mine ---
    "Area under a curve"

    To use Excel for evaluating the integral of, say, 2+3*(Ln(x))^0.6 using
    Simpson's Rule (also see notes below):

    1) Enter some labels:
    In cell.....enter
    A1 "X_1"
    A2 "X_n"
    A3 "NbrPanels"

    2) Set some values:
    In cell.....enter
    B1 1
    B2 2.5
    B3 1000

    3) Define some names:
    Select A1:B3, then choose Insert->Name->Create. Make sure that only the
    "Left Column" box is selected. If it isn't, you might have entered text
    instead of numbers in the right column, or mis-selected the range. Press
    OK.

    4) Choose Insert->Names->Define
    Enter each of the following names and their definitions, pressing Add
    with each entry (you can copy and paste these):
    EPanels =NbrPanels+MOD(NbrPanels,2)
    delta =(X_n-X_1)/EPanels
    Steps =ROW(INDIRECT("1:"&EPanels+1))-1
    EvalPts =X_1+delta*Steps
    SimpWts =IF(MOD(Steps,EPanels)=0,1,IF(MOD(Steps,2)=1,4,2))*delta/3

    (optional) If interested in a trapezoidal approximation, define
    TrapWts =IF(MOD(Steps,EPanels)=0,0.5*delta,delta)

    5) Close the Define Names box, and in, say, cell D1, array-enter
    =SUM(SimpWts*(2+3*LN(EvalPts)^0.6))
    That is, type in the function, and hold ctl-shift when pressing Enter.

    In general, ctrl-shift-enter =SUM(SimpWts*f(EvalPts))
    where f() is a legitimate Excel expression that yields a scalar numeric
    value.

    To use the trapezoidal method, substitute in the above expression
    TrapWts for SimpWts.

    Notes:
    (1) With this implementation, an odd number for NbrPanels doesn't cut it
    (for Simpson's rule), so there will be no improvement moving from an odd
    number to the next integer (odd ones are automatically changed to the
    next even, internally).

    (2) If you have "jumps" in your function, break it up at the points
    where those occur, and add the pieces.

    .... FWIW, consider Weddle weights instead of the Simpson ones. For a
    single partition, they run [1 5 1 6 1 5 1], with the whole shebang
    multiplied by (3/10). Error term is much tighter, the calc is just as fast.

    HTH
    Dave Braden

    James Silverton wrote:
    > Hello, All!
    >
    > There have been no responses to a previous post but forgive me if I try
    > again. If this is not regarded as a charting question, please let me
    > know. Anyway, is it possible to write a statement evaluating the area
    > under a graph by Simpson's rule without using VBA or helper columns?
    >
    >
    >
    >
    > James Silverton
    > Potomac, Maryland, USA


  4. #4
    Registered User
    Join Date
    08-20-2015
    Location
    nigeria
    MS-Off Ver
    2007
    Posts
    1

    Re: Simpson's rule in Excel

    I need sample of Simpsons rule VBA on excel

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Simpson's rule in Excel

    harrisongot, welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1