00001 #ifndef _INTEGRALTESTFUNCTIONS_
00002 # define _INTEGRALTESTFUNCTIONS_
00003
00004 template<int DIM>
00005 struct IntegralTestFunction : public Function {
00006 virtual void SetParameters(double *) {;}
00007 virtual double Eval(double *x) { double q=1.0 ; for (int i=0; i<DIM; i++) q *=x[i]*(1+x[i]*(-3+x[i]*2)) ; return q ;}
00008 } ;
00009
00010
00011
00012 struct IntegroDiffTestFunction : public Function {
00013 double alpha ;
00014 virtual void SetParameters(double *p) {alpha=*p; }
00015 virtual double Eval(double *x) {return exp((x[0]*x[0] + x[1]*x[1])*alpha); }
00016 } ;
00017
00018
00019
00020 template<int DIM>
00021 struct IntegroDiffTestKFunction : public Function {
00022 virtual void SetParameters(double *) {;}
00023 virtual double Eval (double *x){double q=1.0; for (int i=0; i<DIM; i++) q *= x[i]*(1-x[i]*x[i]); return q;}
00024 } ;
00025
00026
00027
00028 template<int DIM>
00029 struct IntegroDiffTestRHSFunction : public IntegroDiffTestKFunction<DIM> {
00030 virtual double Eval(double *x) {
00031 double r=x[0]*x[0] + x[1]*x[1], a=((exp(alpha)-1)/alpha -1)/(2*alpha) ;
00032 return -4*alpha*exp(r*alpha)*(1+alpha*r) + 40000*a*a*x[0]*(1-x[0]*x[0])*x[1]*(1-x[1]*x[1]) ;
00033 }
00034 } ;
00035
00036
00037
00038
00039 struct IntegroDiffTest2Function : public Function {
00040 virtual void SetParameters(double *) {;}
00041 virtual double Eval(double *xx) {
00042 double x=xx[0],y=xx[1] ;
00043 return x*(1-x)*y*(1-y)/(1+20*((x-1./3)*(x-1./3) + (y-1./8)*(y-1./8))) ;
00044 }
00045 } ;
00046
00047
00048
00049 struct IntegroDiffTestK2Function : public Function {
00050 virtual void SetParameters(double *) {;}
00051 virtual double Eval(double *x) {
00052 double x1=x[0],x2=x[1],y1=x[2],y2=x[3] ;
00053 return sin( (1-x1)*(1-x2)*(1-y1)*(1-y2) ) * (1 + 20*((y1-1./3)*(y1-1./3) + (y2-1./8)*(y2-1./8))) ;
00054 }
00055 } ;
00056
00057
00058
00059 struct IntegroDiffTestRHS2Function : public Function {
00060 virtual void SetParameters(double *) {;}
00061 virtual double Eval(double *xx) {
00062 double X =(1-xx[0])*(1-xx[1]),x=xx[0],y=xx[1],
00063 x2=x*x, x3=x2*x, x4=x3*x,
00064 y2=y*y, y3=y2*y, y4=y3*y,
00065 X2=X*X, X3=X2*X, X4=X3*X, X5=X4*X,
00066 n =(509 + 2880*x2 - 1920*x +2880*y2 - 720*y),
00067 z =( 718199*y + 107399*x
00068 +24883200*(x*y4 + x2*y3 -x2*y4 -y2*x4 -x*y3 +y*x4)
00069 +38707200*y2*x3 -12441600*y4*y
00070 + 8294400*x4*x2 -38707200*y*x3
00071 + 8294400*y4*y2 + 2728800*y3
00072 + 2067840*y4 -31605120*x2*y2
00073 +15603840*x4 -19353600*x4*x
00074 - 5116800*x3 + 464761*x2
00075 - 1367639*y2 +15016320*x*y2
00076 - 8795520*x*y +25384320*x2*y),
00077 k=(X/144 + X5/376320 +X4*X5/6322821120.
00078 + X5*X5*X3/358676398080000. ) -
00079 (X3/5400 + X4*X3/40824000 + X5*X5*X/1322204083200.) ;
00080
00081 return -288*z/(n*n*n) + 1000*k ;
00082 }
00083 } ;
00084
00085
00086
00087
00088 struct IntegroDiffTestRHSTest2Function : public Function {
00089 virtual void SetParameters(double *) {;}
00090 virtual double Eval(double *xx) {
00091 double X=(1-xx[0])*(1-xx[1]) ;
00092 return (X/144 + X*X*X*X*X/376320 +X*X*X*X*X*X*X*X*X/6322821120.
00093 + X*X*X*X*X*X*X*X*X*X*X*X*X/358676398080000. ) -
00094 (X*X*X/5400 + X*X*X*X*X*X*X/40824000 + X*X*X*X*X*X*X*X*X*X*X/1322204083200.) ;
00095 }
00096 } ;
00097
00098
00099 #endif