I have a bit unusual calculation to do and I am struggling with an analytical solution.
I have a regular monthly deposit $r$ with a certain duration $n$ and fixed end capital $X$. I want to find the fixed interest rate $z$.
By putting $q = 1 + \frac{z}{100}$, I get the following equation to solve for $q$:
$$ r \cdot q \cdot \frac{q^n-1}{q-1}=X $$
Obviously $r \in \mathbb{R}^*$, $X \in \mathbb{R}^*$, $n \in \mathbb{N}^*$, and $q \in \mathbb{R}^*$ (actually $0.9 < q < 1.1$).
I have no problem solving this numerically, but I'm looking for the analytical solution (or at least a very very good approximation).
There is no general analytical solution for large $n$. In effect you are trying to solve an $n$ degree polynomial equation $$q+q^2+\cdots +q^n= \tfrac{X}{r}$$
This is easy enough when $n=1$: you get $q= \tfrac{X}{r}$ as you would expect
It is not much harder when $n=2$: you get $q=\pm \frac12 \sqrt{1+\tfrac{4X}{r}} -\frac12$ and in practice you want the positive square-root
But for $n=3$ and $n=4$ you are solving a cubic or a quartic; you get complicated answers which may involve complex arithmetic: see Wolfram Alpha's solutions when $n=3$ and when $n=4$
That is as far as you can go in aiming for a general closed-form solution: Galois theory suggests that except in special cases, there is not such solution for quintics or higher degree polynomials. So numerical approaches are the best way to go, and in practice also for the $n\ge 3 $ cases