Serving the Quantitative Finance Community

 
User avatar
JontyJ
Topic Author
Posts: 0
Joined: May 4th, 2006, 12:24 pm

Can I explicitly solve this?

March 24th, 2007, 7:40 pm

If I'm given the value of the following sum, Y, how do I explicitly solve for a?x + x*(x-a) + x*(x-a)*(x-2a) + x*(x-a)*(x-2a)*(x-3a) +x*(x-a)*(x-2a)*(x-3a)*(x-4a)......+x + x*(x-a)* ....*(x-na) = YX and a are known constants. a is small and n is possibly large. If I'm given Y is there a way I can get a closed-form solution for a?Thanks for any help.
 
User avatar
JontyJ
Topic Author
Posts: 0
Joined: May 4th, 2006, 12:24 pm

Can I explicitly solve this?

March 24th, 2007, 7:45 pm

Sorry, a is obviously not known. However I know x, n and y.
 
User avatar
mutley
Posts: 20
Joined: February 9th, 2005, 3:51 pm

Can I explicitly solve this?

March 25th, 2007, 8:47 am

if you write f(a,0) = x, f(a,1) = x(x-a), f(a,2) = x(x-a)(x-2a) you can see that f(a,n+1) can be written f(a,n+1) = f(a,n) + (x-a(n+1))[f(a,n)-f(a,n-1)]Thus you can solve it algebraicly but i'd suggest using that recusion formula on a computer for a general N. shouldn't take more than 5 mins to code it in vba or whatever.
 
User avatar
mutley
Posts: 20
Joined: February 9th, 2005, 3:51 pm

Can I explicitly solve this?

March 26th, 2007, 12:03 pm

Public Function SolveForA(Y As Double, X As Double, N As Long) As Double Dim A As Double Dim tol As Double, shift As Double tol = 0.00001 shift = 0.01 Dim res As Double, resPrime As Double, deriv As Double A = X * N res = Y - FOfA(X, N, A) While Abs(res) > tol resPrime = Y - FOfA(X, N, A + shift) deriv = (resPrime - res) / shift If (Abs(deriv) < tol) Then GoTo out: End If A = A - res / deriv res = Y - FOfA(X, N, A) Wendout: SolveForA = AEnd FunctionPrivate Function FOfA(X As Double, N As Long, A As Double) As Double Dim temp As Double, sum As Double Dim i As Long temp = X sum = temp For i = 1 To N temp = temp * (X - i * A) sum = sum + temp Next i FOfA = sumEnd Functionpop these in a vba module and call SolveForA() from the worksheet.
 
User avatar
mutley
Posts: 20
Joined: February 9th, 2005, 3:51 pm

Can I explicitly solve this?

March 26th, 2007, 1:00 pm

well, maybe i wasn't too clear in my last post - writing f recursively allows us to compute f(a,k) relatively swiftly (order k). that allows for a numeric solver (like the newton-raphson below) to trawl through the derivatives without too much burden.i bet you can write a closed form for f(a,k) if you wish to sit through the tedious unpacking / repacking of products / sums, but with modern computing, a simple function like that is solved numerically in less time it takes to do the algebra.
 
User avatar
JontyJ
Topic Author
Posts: 0
Joined: May 4th, 2006, 12:24 pm

Can I explicitly solve this?

March 29th, 2007, 2:39 pm

Thanks very much for that Mutley, and also to you Outrun.
 
User avatar
vixen
Posts: 0
Joined: April 5th, 2006, 1:43 pm

Can I explicitly solve this?

April 3rd, 2007, 8:27 am

Explicit Solution.Construct the (n x n) diagonal matrix D with D(k,k) = k for k = 1 to n.Construct the (n x n) matrix A withA(k,k) = x for k = 1 to n,A(k,k+1) = -1 for k = 1 to n-1,A(n,1) = -Y/x,A(n,k) = A(n,k) + 1 for k = 1 to n,Let the matrix M = inv(D)*A. Then the solution to a are the eigenvalues of M, a = eig(M).There are exactly n solutions to a as the equation is an nth order polynomial in a.This solution is essentially re-writing the recurrence relations of f(a,n) in matrix form. The eigenvector appropriately normalised are the vectors [f(a,0);f(a,1);f(a,2),...,f(a,n-1)]. Edit: typo
Last edited by vixen on April 3rd, 2007, 10:00 pm, edited 1 time in total.