Advertisement

该算法用于(全局最优化求解)

阅读量:
复制代码
    import matplotlib.pyplot as plt
    import numpy as np
    
    n_person = 2000
    n_times = 500
    
    t = np.arange(n_times)
    steps = 2 * np.random.randint(2, size=(n_person, n_times)) - 1
    
    amount = np.cumsum(steps, axis=1)
    sd_amount = amount *
    mean_sd_amount = sd_amount.mean(axis=0)
    
    plt.figure(figsize=(8, 6))
    plt.xlabel(r"$t$", fontsize=16)
    plt.tick_params(labelsize=12)
    plt.ylabel(r"$\sqrt{\langle (\delta x)^2 \rangle}$", fontsize=24)
    plt.plot(t, np.sqrt(mean_sd_amount), 'g.', t, np.sqrt(t), 'r-');
    
    
    AI写代码python
    
    运行

全部评论 (0)

还没有任何评论哟~