In [34]:
from __future__ import division
%matplotlib inline
import numpy as np
import assign1 as a
import math
import matplotlib.pyplot as plt
In [2]:
x,y,exact = a.exact(128)
In [3]:
fdm = np.zeros([100,128])
In [73]:
for i in range(100):
fdm[i] = a.get_border(a.fdm(32,32,i*10,False))
In [5]:
a.scatter_plot(x,y,exact,fdm[0])
In [6]:
a.scatter_plot(x,y,exact,fdm[1])
In [7]:
a.scatter_plot(x,y,exact,fdm[5])
In [8]:
a.scatter_plot(x,y,exact,fdm[10])
In [9]:
a.scatter_plot(x,y,exact,fdm[20])
In [10]:
a.scatter_plot(x,y,exact,fdm[50])
In [11]:
a.scatter_plot(x,y,exact,fdm[80])
In [12]:
a.scatter_plot(x,y,exact,fdm[99])
In [13]:
a.error(exact, fdm[0])
Out[13]:
In [14]:
a.error(exact, fdm[1])
Out[14]:
In [15]:
a.error(exact, fdm[2])
Out[15]:
In [16]:
a.error(exact, fdm[4])
Out[16]:
In [17]:
a.error(exact, fdm[8])
Out[17]:
In [18]:
a.error(exact, fdm[16])
Out[18]:
In [19]:
a.error(exact, fdm[32])
Out[19]:
In [20]:
a.error(exact, fdm[64])
Out[20]:
In [21]:
a.error(exact, fdm[99])
Out[21]:
Error function put in test: error_rel
.
In [22]:
a.error_rel(exact, fdm[0])
Out[22]:
In [23]:
a.error_rel(exact, fdm[1])
Out[23]:
In [24]:
a.error_rel(exact, fdm[2])
Out[24]:
In [25]:
a.error_rel(exact, fdm[4])
Out[25]:
In [26]:
a.error_rel(exact, fdm[8])
Out[26]:
In [27]:
a.error_rel(exact, fdm[16])
Out[27]:
In [28]:
a.error_rel(exact, fdm[32])
Out[28]:
In [29]:
a.error_rel(exact, fdm[64])
Out[29]:
In [30]:
a.error_rel(exact, fdm[99])
Out[30]:
In [33]:
a.error_rel(exact, a.get_border(a.fdm(32,32,2000)))
Out[33]:
In [36]:
error_rel = [a.error_rel(exact, fdm[i]) for i in range(100)]
In [37]:
len(error_rel)
Out[37]:
In [67]:
errors = [a.error(exact, fdm[i]) for i in range(100)]
In [75]:
fig = plt.figure(figsize=(13,4), dpi=100)
ax = fig.gca()
ax.plot(error_rel, '-o', ms=5, lw=2, alpha=1, mfc='orange')
ax.grid()
plt.ylabel('Modified Relative Error')
plt.xlabel('Iterations (x10)')
plt.show()
In [74]:
fig = plt.figure(figsize=(13,4), dpi=100)
ax = fig.gca()
ax.plot(errors, '-o', ms=5, lw=2, alpha=1, mfc='orange')
ax.grid()
plt.ylabel('Relative Error')
plt.xlabel('Iterations (x10)')
plt.show()
In [71]:
range(1,10,2)
Out[71]:
In [76]:
a.scatter_plot(x,y,exact,a.get_border(a.fdm(32,32,2000)))
In [77]:
fdm2000 = a.get_border(a.fdm(32,32,2000))
In [78]:
a.error(exact,fdm2000)
Out[78]:
In [79]:
a.error_rel(exact,fdm2000)
Out[79]:
In [80]:
a.error(exact,fdm[20])
Out[80]:
In [81]:
a.error_rel(exact,fdm[20])
Out[81]:
In [ ]: