function value = uex ( x, problem ) %% UEX returns the value of the exact solution at a point X. % % Modified: % % 03 November 2006 % % Author: % % Max Gunzburger % Teresa Hodge % % MATLAB translation by John Burkardt % % Parameters: % % Input, real X, the evaluation point. % % Input, integer PROBLEM, indicates the problem being solved. % 1, U=1-x**4, P=1, Q=1, F=1.0+12.0*x**2-x**4. % 2, U=cos(0.5*pi*x), P=1, Q=0, F=0.25*pi*pi*cos(0.5*pi*x). % % Output, real VALUE, the exact value of U(X). % % % Test problem 1 % if ( problem == 1 ) value = 1.0 - x^4; % % Test problem 2 % elseif ( problem == 2 ) value = cos ( 0.5 * pi * x ); end