I'm trying to return multiple values that are obtained inside a scipy root finding function (scipy.optimize.root).
For example:
B = 1
def testfun(x, B):
B = x + 7
return B**2 + 9/18 - x
y = scipy.optimize.root(testfun, 7, (B))
Is there any way to return the value of B without using globals?