Let's take the following example
V = (-G*Mn)/Sqrt[x^2 + y^2 + z^2 + cn^2]; Vx = D[V, x]; FortranForm[Vx]
The result is
(G*Mn*x)/(cn**2 + x**2 + y**2 + z**2)**1.5.
My questions is the following:
How can I replace x, y, z with x(1), x(2), x(3) respectively?
How can I get rid of the spaces between the plus signs?