function retval = midprob3(fa,fpa,fppa,fb,fpb,a,b)
% usage: poly = midprob3(fa,fpa,fppa,fb,fpb,a,b)
% description: returns cofficients of a quartic
% polynomial in (x-a) that interpolates f(x),
% f'(x), f''(x) at x=a and f(x), f'(x) at x=b.

retval = zeros(1,5);
bma = b - a;
fab = (fb-fa)/bma;
retval(5) = fa;
retval(4) = fpa;
retval(3) = fppa/2;
retval(2) = (fab-fpa-bma*fppa/2)/bma^2;
retval(1) = (fpb+2*fpa-3*fab+bma*fppa/2)/bma^3;
% correct the coefficient of (x-a)^3
retval(2) = retval(2)-bma*retval(1);
