0

let's suppose I have geometric sum (a<1) of the form:

x + a*x + a^2*x + ... a^T*x = Y

where I know Y and a and I want to solve for an x on the LHS that matches the RHS Y. If my actual problem was that simple, I could calculate the LHS analytically but unfortunately it's not and that's why I want to do it numerically using matlab. I just don't know how to code it. The logic would be something like this:

LHS=@(x) x;
for t=1:T
    LHS = @(x) LHS(x) + a^t*x;
end
equation = @(x) LHS(x) - Y;
solution = fzero(equation, x_0) 

so in the loop I somehow add up the elements of the geometric sum as a function of x. My actual problem is something like this:

x + a*b1*x + a^2*b1*b2*x + ... + a^T*b1*b2..bTx = Y

where b1...bT are scalars. So I cannot use the symsum function I think, nor can I do it analytically.

marky2k
  • 97
  • 1
  • 5
  • 3
    I am failing to see why you can't do `x = Y/(1 + a*b1 + ... + a^T*b1*...*bT)`. Is something in this equation a matrix? – ioums Oct 09 '15 at 15:34
  • 3
    ummmm... What is your actual problem? Cuz the function you give is linear. – GameOfThrows Oct 09 '15 at 15:35
  • 2
    This is not a geometric sum. This **would** be a geometric sum if each value of `x` was raised to some power. However, the coefficients of `a` are being raised so this is simply a linear sum. – rayryeng Oct 09 '15 at 15:44
  • yup, totally my fault. Where can I close the question or should I delete it? – marky2k Oct 09 '15 at 16:53

0 Answers0