added a simpler exact func

This commit is contained in:
Stephen McQuay 2011-03-22 14:20:48 -06:00
parent a3893d520d
commit f600f8a2f2

View File

@ -18,10 +18,19 @@ def rms(errors):
def exact_func(X): def exact_func(X):
""" """
the exact function used from baker's article (for testing) the exact function (2D) used from baker's article (for testing)
""" """
x ,y = X x ,y = X
answer = 1.0 + x*x + y*y # np.power((np.sin(x * np.pi) * np.cos(y * np.pi)), 2) answer = np.power((np.sin(x * np.pi) * np.cos(y * np.pi)), 2)
log.debug(answer)
return answer
def exact2D(X):
"""
A friendlier 2D func
"""
x ,y = X
answer = 1.0 + x*x + y*y
log.debug(answer) log.debug(answer)
return answer return answer
@ -43,6 +52,7 @@ def exact(X):
def improved_answer(answer, exact, verbose=False): def improved_answer(answer, exact, verbose=False):
if not answer['error']: if not answer['error']:
return True return True
log.debug('qlin: %s' % answer['qlin']) log.debug('qlin: %s' % answer['qlin'])
log.debug('error: %s' % answer['error']) log.debug('error: %s' % answer['error'])
log.debug('final: %s' % answer['final']) log.debug('final: %s' % answer['final'])