Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import cos, sin, pow, pi
- from numpy import zeros, array
- class Func:
- def __init__(self, n):
- self._f = zeros((n + 1, n + 1))
- self._n = n
- self._x = []
- self._y = []
- self._h = 1.0 / n
- for i in range(0, self._n + 1):
- self._x.append((1.0 / self._n) * i)
- self._y.append((1.0 / self._n) * i)
- self.CalcF()
- def CalcF(self):
- const = 2 * pi * pi
- for i in xrange(0, self._n + 1):
- one = sin(pi * self._x[i])
- for j in xrange(0, self._n + 1):
- two = sin(pi * self._y[j])
- self._f[i][j] = const * one * two
- return self._f
- def X(self):
- return self._x
- def Y(self):
- return self._y
- def F(self):
- return self._f
- def H(self):
- return self._h
Advertisement
Add Comment
Please, Sign In to add comment