def __init__(self, function="np.exp(-0.5())", potential="(x)**2/2"): super().__init__() self.psi: Union[None, WaveFunction2D] = None self.U_t: Union[None, UnitaryOperator2D] = None self.V: Union[None, np.ndarray, str] = None self.V_latex: Union[None, str] = None self.lines = None self.line10 = None self.line11 = None # String attributes # self.v_x = None self._KE_ltx = r"-\frac{\hbar^2}{2m} \frac{d^2}{dx^2}" self._lmts_str = r" %s$ \leq x \leq $%s" % \ (str(np.round(self.x0, 2)), str(np.round(self.L + self.x0, 2))) self._msg = "" # Temporary messages in the textbox in the corner self._main_msg = "" # Primary messages in this same text box. self._main_msg_store = "" # Store the primary message self.psi_name = "" # Name of the wavefunction self.psi_latex = "" # LaTEX name of the wavefunction self.V_name = "" # Name of the potential self.v_latex = "" # LaTEX name of the potential self.identity_matrix = np.identity(self.N, np.complex128) # Ticking int attributes self.fpi = 1 # Set the number of time evolutions per animation frame self._t = 0 # Time that has passed self._msg_i = 0 # Message counter for displaying temporary messagesT self.fps = 30 # frames per second self.fps_total = 0 # Total number of fps self.avg_fps = 0 # Average fps self.ticks = 0 # total number of ticks self.x_ticks = [] self.t_perf = [1.0, 0.] self._dpi = 120 # Display the probability function? self._display_probs = False self._scale_y = 1.0 # Show position or momentum? self._show_p = False # Show energy levels? self._show_energy_levels = False # Show expectation values? self.show_exp_val = False # Position of the message self._msg_pos = (0, 0) # Positions self.x = np.linspace(self.x0, (self.L + self.x0), self.N) self.y = np.linspace(self.x0, (self.L + self.x0), self.N) # Parameters self.psi_base = None self.psi_params = {} self.V_base = None self.V_params = None Function.add_function('arg', lambda theta: np.exp(2.0j * np.pi * theta)) Function.add_function( 'ees', lambda n, _x: self.get_energy_eigenstate(int(n)) if np.array_equal(self.x, _x) else rescale_array( _x, self.x, np.real(self.get_energy_eigenstate(int(n))))) self.set_wavefunction(function, function) self.V_x = None self.set_unitary(potential) self._init_plots()