This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""1回反復したときの「|w> の振幅」と「それ以外の振幅」を計算して返す""" | |
def calc_amplitude(n, w_amp, other_amp): | |
# |w>の符号を反転させる | |
w_amp = -w_amp | |
# 振幅の平均を求める | |
mu = (other_amp*(2**n-1) + w_amp) / (2**n) | |
# 平均周りで振幅を反転させる | |
w_amp = mu + (mu - w_amp) |
OlderNewer