这是求解薛定谔方程吧?

问题描述 投票:0回答:0
from math import pi,sqrt, asin
from qiskit.quantum_info import Statevector
import numpy as np
import matplotlib.pyplot as plt


class Wave():
    def __init__(self, *args, **kwargs):
        super().__init__()
    
    
    # Calculate the wave particals momentum
    def wave_momentum(self,Mass,Acceleration=False,Velocity=False):
        if Acceleration != False:
            return Mass*Acceleration
        
        if Velocity != False:
            return Mass*Velocity
    
    
    # Define the mass of the particle
    def energy(self,Frequency):
        return 6.62607015e-34*Frequency
    
    
    # # Frequency Function
    def _frequency(self,CyclesPerUnitDistance,WaveLength):
        return CyclesPerUnitDistance/WaveLength
    
    
    def _wavevector(self,wavelength):
        k = 2 * pi / wavelength
        return k
    
    
        
        

    """
        - The wave function for a sphere
          describes the behavior of particles,
          or waves within a spherical volume.
    
        - The wave functions is a solution to the 
          Schrodinger equation.
    """
    def wave_function(self, Speed, Frequency, WaveLength, WaveVector):
        #L = self._wavelength(Speed, Frequency)
        GridPoints = 1000
        GridSpacing = WaveLength/(GridPoints-1)
        # Array of grid points spaced evenly
        # between 0 and L
        ArrayGridPoints = np.linspace(0,WaveLength,GridPoints)
        def psi(GridPointsArray,WaveVector):
            # Standard formula for a plane wave.
            # X represents the position and k is a wavevector
            return np.exp(1j*WaveVector*GridPointsArray)
        
        # Define a waveVector
        #WAVE_VEC = self._wavevector(WaveLength)
        # WAVE FUNCTION
        return psi(ArrayGridPoints, WaveVector)
        
    
    
    # Cycles Per Unit of Distance Function    
    def _CyclesPerUnitDistance(
            self,
            WaveLength=False,
            Hertz=False,
            NanoMeter=False
        ):
        
        if WaveLength != False:
            return 1/WaveLength
        
        if Hertz != False:
            Hertz=1
            return 1/Hertz
        
        if NanoMeter != False:
            return 1/1e-9
        
        if WaveLength == False and Hertz == False and NanoMeter == False:
            print("Please note must set at least one argument to boolean.")
        
        if WaveLength == True and Hertz == True and NanoMeter == False:
            print("Can only choose one unit.")
        
    
    
   
    # # Frequency Function
    def _frequency(self,CyclesPerUnitDistance,WaveLength):
        return CyclesPerUnitDistance/WaveLength
    
    
    # # Wave Length Function
    def _wavelength(self, Speed=False, Frequency=False):
        if Speed != False:
            Speed = 6.62607015e-34
        
        if Frequency != False:
            Frequency=Frequency
        
        if Frequency >= 0 or Frequency <=1:
            return 6.62607015e-34
        
        
        return 6.62607015e-34/Frequency
    
     
    # Velocity Function
    def _velocity(d2, d1, t):
        return (d2 - d1) / t

    
    # Acceleration Function
    def _acceleration(v2, v1, t):
        return (v2 - v1) / t
    
    
    # Basic Speed Function
    def _basic_speed(Distance, Time):
        return Distance/Time
   
        
        

WaveForm=Wave()

# Process to begin frequency, the right way.
WaveLength = WaveForm._wavelength(False,1)
Cycles = WaveForm._CyclesPerUnitDistance(Hertz=True)
Frequency=WaveForm._frequency(Cycles, WaveLength)
Energy = WaveForm.energy(Frequency)
Speed = WaveForm.wave_momentum(Energy,Acceleration=True)
WaveVector = WaveForm._wavevector(WaveLength)
wave_function = WaveForm.wave_function(Speed, Frequency,WaveLength,WaveVector)

我只需要帮助弄清楚这是否是光子的正确答案。我计算波长,设置周期 == 每个周期 1 赫特,并定义频率,E = h * f 来定义粒子的质量然后我使用动量设置速度,但用加速度代替速度,看看我是否可以用它模拟一些东西。然后我定义一个波矢量并计算波函数。好吧,不是为了一个球体,而是为了一个光子抱歉,我把一个毫无意义的类 Sphere 放在那里有点困惑,抱歉已经有一段时间了。

python python-3.x physics qiskit
© www.soinside.com 2019 - 2024. All rights reserved.