View Single Post
  #24   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default Worksheet Formula Returning Sum of a Series

f(x) = a1 + a2 x + a3 x^2 + a4 x^3 + a5 x^4 ....(*)

hence:
f(x) = a1 + x(a2 + x(a3 + x(a4 + x(a5)))) ..........(**)

Can we algorithmically evaluate (**) using only IMSUM and IMPRODUCT


Hi. Yes. Exactly That is basically the idea behind the code I posted about two up from this thread when I thought your Poly might be large.
Here's a copy...
Anyway, always an interesting subject.
I still would love to see your ZRoot code. :)

Function ImSeriesSum(Rng As Range, X)
' Rng is a single-column range on a worksheet
' holding complex values (or real's for that matter)

Dim j As Long
Dim Ans
Dim M

M = Rng.Cells.Value
Ans = M(UBound(M, 1), 1)

With WorksheetFunction
For j = UBound(M, 1) - 1 To 1 Step -1
Ans = .ImSum(M(j, 1), .ImProduct(Ans, X))
Next j
End With
ImSeriesSum = Ans
End Function

--
Dana DeLouis

<snip