<jupyter_start><jupyter_text>Definindo parametros<jupyter_code>t= tabela_11
t_f=np.max(t)
r=0
n_iterat = int(1e5)<jupyter_output><empty_output><jupyter_text>Definindo numero de iteracoes para o experimento<jupyter_code>experiment='n_iter'
sns.set_style("whitegrid")
sns.set_context("paper")

fig_1, ax_1 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
fig_2, ax_2 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
fig_3, ax_3 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
ax = [ax_1,ax_2,ax_3]
fig = [fig_1,fig_2,fig_3]
ax_order = ['sigma','gamma','mu']

n_iter_var = int(1e7)

Sigma, Gamma, Mu = get_parameters(t,t_f,r=0,n_iter=n_iter_var,verbose=False,progress=False)
x_values = list(range(1,n_iter_var+2))

ax[0].plot(x_values,Sigma,marker='')
ax[1].plot(x_values,Gamma,marker='')
ax[2].plot(x_values,Mu,marker='')

ax[0].set_ylabel("$\sigma$")
ax[1].set_ylabel("$\gamma$")
ax[2].set_ylabel("$\mu$")
for idx,i in enumerate(ax):
    i.set_xlabel("Iterações")
    #i.legend(loc='upper right',bbox_to_anchor=(1.21, 1.0),)
    i.set(xscale="log",yscale="linear")
    fig[idx].tight_layout(pad=1)
    fig[idx].savefig("./imgs/{}/{}_{}_var.png".format(experiment,ax_order[idx],experiment),dpi=200)

print("Valores finais:\n  Sigma = {}\n  Gamma = {}\n  Mu    = {}".format(Sigma[-1], Gamma[-1], Mu[-1] ))<jupyter_output>Valores finais:
  Sigma = 234.3553081455312
  Gamma = 1.8689701761596813
  Mu    = 0.17686932178030187<jupyter_text>Tempo de execução<jupyter_code>n_iter_var = [int(1e4),int(1e5),int(1e6),int(1e7)]
results = []
for i in n_iter_var[:]:
    start = time.time()
    _, _, _ = get_parameters(t,t_f,r=0,n_iter=i,verbose=False,progress=False)
    end = time.time()
    delta = end-start
    results.append(delta)

fig, ax = plt.subplots(1,1,dpi=100,figsize=(6,3.5))

sns.set_style("whitegrid")
sns.set_context("paper")

ax.plot(n_iter_var[:],results,marker='o')
#fig.tight_layout(pad=1)
ax.set_ylabel("Tempo[s]")
ax.set_xlabel("Iterações")
fig.savefig('./imgs/time_comparison.png',dpi=200)

fig_2, ax_2 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))

sns.set_style("whitegrid")
sns.set_context("paper")

ax_2.plot(n_iter_var[:],results,marker='o')
ax_2.set(xscale="log",yscale="linear")
#fig.tight_layout(pad=1)
ax_2.set_ylabel("Tempo[s]")
ax_2.set_xlabel("Iterações")
fig_2.savefig('./imgs/time_comparison_log.png',dpi=200)<jupyter_output><empty_output><jupyter_text>Variando r<jupyter_code>experiment='r'
fig_1, ax_1 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
fig_2, ax_2 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
fig_3, ax_3 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
ax = [ax_1,ax_2,ax_3]
fig = [fig_1,fig_2,fig_3]
ax_order = ['sigma','gamma','mu']

sns.set_style("whitegrid")
sns.set_context("paper")

for r_var in tqdm([0.,1.,2.,3.]):
    Sigma, Gamma, Mu = get_parameters(t,t_f,r_var,n_iter=n_iterat,verbose=False,progress=False)
    x_values = list(range(1,n_iterat+2))
    
    ax[0].plot(x_values,Sigma,label='r = {}'.format(r_var),marker='')
    ax[1].plot(x_values,Gamma,label='r = {}'.format(r_var),marker='')
    ax[2].plot(x_values,Mu,label='r = {}'.format(r_var),marker='')

ax[0].set_ylabel("$\sigma$")
ax[1].set_ylabel("$\gamma$")
ax[2].set_ylabel("$\mu$")
for idx,i in enumerate(ax):
    i.set_xlabel("Iterações")
    i.legend(loc='upper right',bbox_to_anchor=(1.21, 1.0),)
    i.set(xscale="log",yscale="linear")
    fig[idx].tight_layout(pad=1)
    fig[idx].savefig("./imgs/{}/{}_{}_var.png".format(experiment,ax_order[idx],experiment),dpi=200)<jupyter_output>100%|████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:06<00:00,  1.59s/it]<jupyter_text>Variando $\mu$<jupyter_code>experiment='mu'
fig_1, ax_1 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
fig_2, ax_2 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
fig_3, ax_3 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
ax = [ax_1,ax_2,ax_3]
fig = [fig_1,fig_2,fig_3]
ax_order = ['sigma','gamma','mu']
#fig.subplots_adjust(hspace=0.4)
sns.set_style("whitegrid")
sns.set_context("paper")

for mu_var in tqdm(np.linspace(0,10,5)):
    Sigma, Gamma, Mu = get_parameters(t,t_f,r,mu_0=mu_var,n_iter=n_iterat,verbose=False,progress=False)
    x_values = list(range(1,n_iterat+2))
    
    ax[0].plot(x_values,Sigma,label='$\mu_0$ ='+' {}'.format(mu_var),marker='')
    ax[1].plot(x_values,Gamma,label='$\mu_0$ ='+' {}'.format(mu_var),marker='')
    ax[2].plot(x_values,Mu,label='$\mu_0$ ='+' {}'.format(mu_var),marker='')

ax[0].set_ylabel("$\sigma$")
ax[1].set_ylabel("$\gamma$")
ax[2].set_ylabel("$\mu$")
for idx,i in enumerate(ax):
    i.set_xlabel("Iterações")
    i.legend(loc='upper right',bbox_to_anchor=(1.21, 1.0),)
    i.set(xscale="log",yscale="linear")
    fig[idx].tight_layout(pad=1)
    fig[idx].savefig("./imgs/{}/{}_{}_var.png".format(experiment,ax_order[idx],experiment),dpi=200)<jupyter_output>100%|████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:04<00:00,  1.10it/s]<jupyter_text>Variando $\gamma$<jupyter_code>experiment='gamma'
fig_1, ax_1 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
fig_2, ax_2 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
fig_3, ax_3 = plt.subplots(1,1,dpi=100,figsize=(6,3.5))
ax = [ax_1,ax_2,ax_3]
fig = [fig_1,fig_2,fig_3]
ax_order = ['sigma','gamma','mu']
#fig.subplots_adjust(hspace=0.4)
sns.set_style("whitegrid")
sns.set_context("paper")

for gamma_var in tqdm(np.linspace(2.5,100,4)):
    Sigma, Gamma, Mu = get_parameters(t,t_f,r,gamma_0=gamma_var,n_iter=n_iterat,verbose=False,progress=False)
    x_values = list(range(1,n_iterat+2))
    
    ax[0].plot(x_values,Sigma,label='$\gamma_0$ ='+' {}'.format(gamma_var),marker='')
    ax[1].plot(x_values,Gamma,label='$\gamma_0$ ='+' {}'.format(gamma_var),marker='')
    ax[2].plot(x_values,Mu,label='$\gamma_0$ ='+' {}'.format(gamma_var),marker='')

ax[0].set_ylabel("$\sigma$")
ax[1].set_ylabel("$\gamma$")
ax[2].set_ylabel("$\mu$")
for idx,i in enumerate(ax):
    i.set_xlabel("Iterações")
    i.legend(loc='upper right',bbox_to_anchor=(1.21, 1.0),)
    i.set(xscale="log",yscale="linear")
    fig[idx].tight_layout(pad=1)
    fig[idx].savefig("./imgs/{}/{}_{}_var.png".format(experiment,ax_order[idx],experiment),dpi=200)<jupyter_output>100%|████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:03<00:00,  1.09it/s]
StarcoderdataJupyterStructuredCleanDedup