def timeit_with_unit(): import numpy as np from physipy.integrate import solve_ivp from physipy import units, s, set_favunit, setup_matplotlib setup_matplotlib() ohm = units["ohm"] F = units["F"] V = units["V"] # in Ohms R = 10000 * ohm # in Farad capa = 1*10**-12 * F # time constant tau= R*capa # Source in volts Ve = 1 * V # initial tension in volts y0 = [0*V] def RHS_dydt(t, y): return 1/(tau)*(Ve - y) t_span = (0*s, 10*tau)
) import matplotlib.pyplot as plt import numpy as np import physipy from physipy import s, m, setup_matplotlib from handcalcs import render import forallpeople as si from physipy import Dimension, units, quantify, Quantity from IPython.display import display, Latex from sympy.printing import latex import pint import sympy as sp setup_matplotlib() mm = units['mm'] km = units["km"] cm = units["cm"] print(mm) arrd = np.random.rand(10) * 1.123 * cm arrd.favunit = m # %% arrd # %% plt.plot(arrd, arrd)