I have to find the temperature in the equation:
u = 1.2*e^(-.025*T)
u = viscosity in N*s/m^2
T = degree C
using
scipy.optimize.broyden1()
how would you use that to find the T when u=.001?
To use the broyden1 function, just give it the function that you want the root to be found and also an initial value. If you are only interested in solving for u=.001, you can just define a function that take T as an input. If you might want to change the value of u, partial might be a handy tool.
import scipy.optimize
import numpy as np
from functools import partial
def findtemp(T, u):
return u - 1.2 * np.exp(-.025*T)
sol = scipy.optimize.broyden1(partial(findtemp, u=.001), 0)
print(sol)
gives me a value of 283.4828690696808 which is close to the theoretical value.