


SETFUN_LAP_1D Sets functions and coefficients for lap_1d, precolap_1d
[uex,uexx,ff,nu,gam]=setfun_lap_1d
Output: uex =@(x)[....] function handle to the expression of exact
solution
uexx =@(x)[....] function handle to the expression of the first
derivative of the exact solution
ff =@(x)[....] function handle to the expression of function
at right hand side
nu = viscosity coefficient (constant>0)
gam = coefficient of zero-order term (constant >=0)

0001 function [uex,uexx,ff,nu,gam]=setfun_lap_1d 0002 % SETFUN_LAP_1D Sets functions and coefficients for lap_1d, precolap_1d 0003 % 0004 % [uex,uexx,ff,nu,gam]=setfun_lap_1d 0005 % 0006 % Output: uex =@(x)[....] function handle to the expression of exact 0007 % solution 0008 % uexx =@(x)[....] function handle to the expression of the first 0009 % derivative of the exact solution 0010 % ff =@(x)[....] function handle to the expression of function 0011 % at right hand side 0012 % nu = viscosity coefficient (constant>0) 0013 % gam = coefficient of zero-order term (constant >=0) 0014 % 0015 0016 % Written by Paola Gervasio 0017 % $Date: 2007/04/01$ 0018 0019 syms x 0020 nu=1;gam=0; 0021 Uex=cos((1+x)*pi*3).*sin((0.5+x)*pi/5)+sin(pi/10); % exact solution 0022 Uexx=diff(Uex,x); % first derivative of exact solution 0023 Ff=(gam*(Uex)-diff(nu*(Uexx))); % right hand side 0024 %Ff=1+0*x; 0025 0026 uex=vectorize(char(Uex)); 0027 uexx=vectorize(char(Uexx)); 0028 ff=vectorize(char(Ff)); 0029 0030 uex=@(x)[eval(uex)]; 0031 uexx=@(x)[eval(uexx)]; 0032 ff=@(x)[eval(ff)]; 0033