can't really figure out why this error RuntimeWarning: overflow encountered in exp
is showing up. The function I'm trying to implement is:
Id = lambda t_u, yp: Is * (np.exp((Vin(t_u) - L*yp)/(n_Ut*Ut)) - 1.0)
with values:
Vin = lambda t: Vo * np.sin(2*np.pi*w*t)L = 50e-3 # 50 mH
Vo = 5 # 5 V
w = 50 # 50 Hz
Is = 1e-9 # 1 nA
Ut = 25e-3 # 25 mV
n_Ut = 1.0
The function Id
is part of a ODE that I'm trying to solve with Runge-Kutta-Method.
EDIT:
Methoden\Serien\6>python circuit.py
Traceback (most recent call last):File "circuit.py", line 148, in <module>perform_experiment(exrk_o5(), "exrk_o5")File "circuit.py", line 48, in perform_experimentt, y = run_method(method, label)File "circuit.py", line 69, in run_methodt, y = method.__call__(circuit_rhs, y[0, :], t_end, n_steps)File "C:\Users\-\numerical_methodes\6\rk.py", line 49, in __call__t[k+1],y[k+1, :] = self.step(f, y[k, :], t[k], dt)File "C:\Users\-\numerical_methodes\6\rk.py", line 102, in stepdydt[:, i] = rhs(t + c[i] * dt, y0 + dt * np.dot(A[i, :].T, dydt.T))File "circuit.py", line 38, in circuit_rhsdydt= np.array ([y[1] , Id(t, y [1]) /(C*L) - y [1]/( R*C) - y [0]/( C*L)])File "circuit.py", line 27, in <lambda>Id = lambda t_u, yp: Is * (np.exp((Vin(t_u) - L*yp)/(n_Ut*Ut)) - 1.0)
FloatingPointError: overflow encountered in exp
where y[1]=0 and y[0]=0, as first values. The rk.py file is just the implementation of the Runge-Kutta-Method.