+ Reply to Thread
Results 1 to 12 of 12

executing a sub within a function

Hybrid View

  1. #1
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,389

    Re: executing a sub within a function

    1st question: Is there a special reason you are doing this in VB rather than just using spreadsheet formulas? This looks like it should be so easy without VBA, that I have to wonder if there is a special reason for using VB.

    For example, the =SERIESSUM() function makes short work of polynomials http://office.microsoft.com/en-us/ma...015.aspx?CTT=1 (in R1C1 notation) =seriessum(r3c2,0,1,r7c2:r7c10) for a 9th order polynomial. If you have less than a 9th order, enter 0's for the excess coefficients. If r3c2 can ever be 0, rewrite to take the constant term outside of the seriessum() function to avoid a 0^0 error. If you'll never have a 9th order polynomial, adjust the coefficients argument to reflect the largest polynomial you ever expect to see.

    I think before I tried to tackle this in VB, I'd want to understand the rationale for doing this in VB rather than the spreadsheet.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  2. #2
    Registered User
    Join Date
    02-01-2013
    Location
    Haywards Heath
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: executing a sub within a function

    Quote Originally Posted by MrShorty View Post
    1st question: Is there a special reason you are doing this in VB rather than just using spreadsheet formulas? This looks like it should be so easy without VBA, that I have to wonder if there is a special reason for using VB.

    For example, the =SERIESSUM() function makes short work of polynomials http://office.microsoft.com/en-us/ma...015.aspx?CTT=1 (in R1C1 notation) =seriessum(r3c2,0,1,r7c2:r7c10) for a 9th order polynomial. If you have less than a 9th order, enter 0's for the excess coefficients. If r3c2 can ever be 0, rewrite to take the constant term outside of the seriessum() function to avoid a 0^0 error. If you'll never have a 9th order polynomial, adjust the coefficients argument to reflect the largest polynomial you ever expect to see.

    I think before I tried to tackle this in VB, I'd want to understand the rationale for doing this in VB rather than the spreadsheet.
    Hi Shorty,

    Thanks for your reply. I'm using vba as it's much more convenient to work with when you've got a variable like degree of polynomial. The purpose of this is so that I can do the following:

    a.) want to know about a polynomial of degree n (whatever I choose, there is no largest)
    b.) get a function (or something like a function) which will take an input of x and give f(x)
    c.) then to plot the function on a graph (I've already got the x-axis set up so I can specify the range and accuracy of my graph I just need the function now).

    Hence using vba is better than manually using formulae (for instance in some cases I have 1000 points to plot on my x-axis)...

    =seriessum function looks really good. I'll have a play with it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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