I have found from StackOverflow how to solve a fucntion with two variables giving the one as constant/known.
This is the part of the code:
def R(gg,a):
return a-r0*g0**(1/2)*D(gg)/gg**(1/2)
def G(r):
partial_func = functools.partial(R, a=r)
return fsolve(partial_func,10,xtol=10**-1)
and it works, since for the first 2 prints, I get the same value
f=([10,15])
print(G(10))
print(G(f[0]))
print(G(f))
but when giving the full array it has the following error:
The array returned by a function changed size between calls