Giù Marcer
f60f1f65d3
A for-cycle has been implemented in order to produce a bunch of results with different numbers of function-calls which can now be plotted with plot.py, which has been added to the folder.
21 lines
695 B
Python
21 lines
695 B
Python
import matplotlib.pyplot as plt
|
||
import numpy as np
|
||
import sys
|
||
|
||
calls, I_MC, σ_MC, I_MI, σ_MI, I_VE, σ_VE = np.loadtxt(sys.stdin, unpack=True)
|
||
exact = 1.7182818285
|
||
|
||
plt.rcParams['font.size'] = 17
|
||
plt.figure()
|
||
plt.title('Plain MC', loc='right')
|
||
plt.ylabel('$I^{oss}$')
|
||
plt.xlabel('calls')
|
||
plt.axhline(y=exact, color='#c556ea', linestyle='-', label='Exact value')
|
||
|
||
plt.errorbar(calls, I_MC, linestyle='', marker='o', yerr=σ_MC, color='#92182b', label='Plain MC')
|
||
plt.errorbar(calls, I_MI, linestyle='', marker='o', yerr=σ_MI, color='black', label='MISER')
|
||
plt.errorbar(calls, I_VE, linestyle='', marker='o', yerr=σ_VE, color='gray', label='VEGAS')
|
||
|
||
plt.legend()
|
||
plt.show()
|