double precision function f3(problem,x,y,n,c0) implicit none double precision x,y,c0 integer problem,n double precision pi pi = 3.141592653589793 c n=1: y=0 -diff(u,[y]) c n=2: x=1 diff(u,[x]) c n=3: y=1 diff(u,[y]) c n=4: x=0 -diff(u,[x]) if(problem .eq. 1) then if(n .eq. 1) then f3 = -x*exp(x*y) else if(n .eq. 2) then f3 = y*exp(x*y) else if(n .eq. 3) then f3 = x*exp(x*y) else f3 = -y*exp(x*y) endif else if (problem .eq. 2) then if(n .eq. 1) then f3 = -2*sin(c0*pi*x)**2*sin(c0*pi*y)*cos(c0*pi*y)*c0*pi else if(n .eq. 2) then f3 = 2*sin(c0*pi*x)*sin(c0*pi*y)**2*cos(c0*pi*x)*c0*pi else if(n .eq. 3) then f3 = 2*sin(c0*pi*x)**2*sin(c0*pi*y)*cos(c0*pi*y)*c0*pi else f3 = -2*sin(c0*pi*x)*sin(c0*pi*y)**2*cos(c0*pi*x)*c0*pi endif else if (problem .eq. 3) then f3 = 0 else write(*,*)'Problem for f3() not implemented.' f3 = 0 endif return end