Question: derivative after interpolating a data set

Hi there, I got a set of discrete Data as functions of 4 variables (x1,x2,x3,x4) . I would like to interpolate the data with respect to x2 and then get a continuous function f (x1,x2,x3,x4). Finally I would like to get the partial derivative of f wrt x2. How can I sort this out? x has the range [0,x0]. s is an arbitrary function of x. g is a function of (x1,x2,x3,x4) which is formed from solving the IVP numerically. x0:= 1/2: s:=x->x^2: sol:=(x2,x3,x4)->dsolve({y''(x1)-(x3^2+s(x1)*x4^2)*y(x1)=0,y(x2)=exp(-x2),y'(x2)=1/2},numeric,output=operator,range=0..x0): g:=(x1,x2,x3,x4)->eval(y(x1),sol(x2,x3,x4)): Now I get a function g(x1,x2,x3,x4) with discrete values. I would like to get a set of data which changed with the value of x2 uncontinuously. dx2 is the stepsize I chose randomly. dx2:=1/1000: Data:=(x1,x2,x3,x4)->[seq([x2+i*dx2,g(x1,x2+i*dx2,x3,x4)],i=-3..3)]: Then I hope to interpolate the Data set and get a continuous function f(x1,x2,x3,x4): f := (x1, x2, x3, x4) -> PolynomialInterpolation(Data(x1, x2, x3, x4), x2) : Finally I did the derivative of f(x1,x2,x3,x4) wrt x2 and substitute some values to test the validity, but got error message: dx2Data := (x1, x2, x3, x4) -> diff(f(x1, x2, x3, x4), x2): dx2Data((1/3)*x0, (1/3)*x0, 10, 1); Error, (in dx2Data) invalid input: diff received 1/6, which is not valid for its 2nd argument I guess that I did something wrong when interpolating the Data(x1,x2,x3,x4) and doing the differentiation wrt x2. Could anyone help? Thank you vary much.
Please Wait...