Example #1
0
 def plot(self):
     l = self.tree.leaves()
     for leaf in l:
         print leaf.boundary(), leaf.error()
     plotfunc(self.f, *self.tree.boundary())
     plottree(self.tree)
     plt.show()
     TreeGrapher([self.tree], "tree.pdf", unique=False, debug=False).graph()
Example #2
0
 def plot(self):
     l = self.tree_hp.leaves()
     dof = 0
     for leaf in l:
         dof = dof + leaf._p
         print leaf._p, leaf.boundary(), leaf.error()
     print dof, self.tree_hp.sum_of_leaves()
     plotfunc(self.f, *self.tree.boundary())
     plottree(self.tree_hp)
     plt.show()
     TreeGrapher([self.tree_hp], "tree_hp.pdf", unique=False, debug=True).graph()
     TreeGrapher([self.tree], "tree.pdf", unique=False, debug=True).graph()
Example #3
0
from error_functionals import TwoNormOrth as no
from error_functionals import TwoNorm as n
from plotter import plotfunc
import matplotlib.pyplot as plt
import numpy as np

f = lambda x: x ** 3
node = [0, 10]
e = n(f)
e2 = no(f)
pol, coeffs = e.bestpoly(node, d=17)
pol2, coeffs2 = e2.bestpoly(node, d=17)

plotfunc(lambda x: pol(x) - pol2(x), *node)
plt.show()