Esempio n. 1
0
def evalnfit(f, x, xx):
	"""\
	evalnfit(f, x, xx):
	f = function being tested
	x = grid points
	xx = points for interpolation
	returns y, yy where y = f(x) and yy are interpolated at xx
	"""
	assert isinstance(x, np.ndarray) and isinstance(xx, np.ndarray)
	
	y = np.empty(x.shape)
	for i,g in enumerate(x):
		y[i] = f(x[i])
		
	yy = lgrng.interp(x, y, xx)
	return y, yy
Esempio n. 2
0
import numpy as np
from matplotlib import pyplot as plt

import sys, os

sys.path.append(os.getcwd() + "/..")

import gridpts
import lgrng

x = gridpts.cheb(20)
y = np.sin(np.sin(x))
plt.plot(x, y, "ro")

xx = gridpts.unif(200)
xx = xx * 0.999 + 1e-6
yy = lgrng.interp(x, y, xx)
plt.plot(xx, yy, "k")
plt.axis("tight")
plt.show()