Source code for scimba_torch.physical_models.ode.damped_harmonic_oscillator
"""Implementation of a damped harmonic oscillator ODE."""fromtypingimportCallableimporttorchfromscimba_torch.approximation_space.abstract_spaceimportAbstractApproxSpacefromscimba_torch.physical_models.ode.abstract_odeimportAbstractODEfromscimba_torch.utils.scimba_tensorsimportLabelTensor,MultiLabelTensorfromscimba_torch.utils.typing_protocolsimportVarArgCallable
[docs]classDampedHarmonicOscillator(AbstractODE):r"""Implementation of a damped harmonic oscillator ODE. .. math:: \frac{dx}{dt} = - \mu x - y, \\ \frac{dy}{dt} = x - \mu y, \\ with an initial condition given by the function `init`. Args: space: The approximation space for the problem init: Callable for the initial condition **kwargs: Additional keyword arguments """def__init__(self,space:AbstractApproxSpace,init:Callable,**kwargs):super().__init__(space,init=init,n_equations=2,**kwargs)