0

The following is my code for solving a simple equation $$\sum_{n=1}^{10}100(1+x)^{4n}=5\cdot \sum_{n=1}^{5}100 (1+x)^{4n}$$ However, my code only returns one solution x=-1, assuming that I only want real solution. I know there is another solution close to $x=0.071773$.

I tried using x, [0 Inf] but the code just simply cannot find a solution.

A lot appreciated for any assistance.

coderesult

Valia
  • 371
  • 1
    Why syms x ? Do you expect that there might be a closed-form expression for the solution ? I doubt it. Working with symbolic calculus might be inefficient. You'd rather define a function $F$ by : $$ F(x) = \sum_{n=1}^{10} 100(1+x)^{4n} - 5 \sum_{n=1}^{5} 100(1+x)^{4n} $$ and try to solve $F(x) = 0$ using, for example, fminsearch or fminunc. Also, you might want to simplify the expression of $F$ before implementing it in Matlab. – pitchounet May 22 '17 at 15:09
  • fzero function finds $x=0.0717735$. Wolfram shows that all real-valued solutions except -1 do not have closed forms. They are (approximately) $-2.07177$ and $0.0717735$. – Arastas May 22 '17 at 15:30
  • @Arastas Thanks for helping. I am able to find the two solutions with mathematica. Which software do you find the best solving such application that's some purely basic computation? Thanks again. This question is related to financial mathematics. – Valia May 22 '17 at 16:18
  • Any software that can compute with finite precision real numbers and has loops and conditionals will work if you are willing to do some programming. – Somos May 22 '17 at 19:29

0 Answers0