Results 1 to 7 of 7

LOOPING: Faster rate of convergence required

Threaded View

davidm LOOPING: Faster rate of... 03-24-2008, 10:45 PM
tekman 18 Loops 03-25-2008, 12:05 AM
mikerickson If A = (i +1)^10 then... 03-25-2008, 12:21 AM
tekman Much Better 03-25-2008, 12:50 AM
mikerickson Your binary search is nice. ... 03-25-2008, 01:04 AM
  1. #1
    Forum Contributor
    Join Date
    03-03-2005
    Posts
    316

    LOOPING: Faster rate of convergence required

    I am developing a UDF which requires some looping to arrive at the result. To keep it simple, part of the routine is akin to solving the following Amount equation for i.

    Find i such that A=1.72846 given A=(1+i)^10

    The following code resolves to the correct answer of i = 5.6248%

    Sub nn()
    Time1 = Timer
    i = 0.01
    k = 1
    Do
    A = (1 + i) ^ 10
    i = i + 0.0000001
    k = k + 1
    'Debug.Print k & "........" & i
    Loop Until Application.Round(A, 4) = 1.7285
    MsgBox i & " ... " & Timer - Time1
    End Sub
    But it does so using 462,477 iterations and taking a whooping 90 seconds! (One would expect under 100 iterations to be ideal).

    While Solver can easily tackle this problem, the Solver tool cannot be deployed in my exercise. Solver requires a WorkSheet interface and is hence inappropriate for incorporation in the UDF.

    Can someone kindly come up with a non-linear algorithm that will speed up the rate of convergence? I would be happy with a solution that takes under 5 seconds.
    Last edited by davidm; 03-24-2008 at 10:47 PM.

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