Re: problems with the definition of a function

*To*: mathgroup at smc.vnet.net*Subject*: [mg36670] Re: problems with the definition of a function*From*: mnewstein at juno.com (Maurice Newstein)*Date*: Wed, 18 Sep 2002 02:10:02 -0400 (EDT)*References*: <am3n85$6tk$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

bagarell at unipa.it (fabio bagarello) wrote in message news:<am3n85$6tk$1 at smc.vnet.net>... > Hi there!! > I have quite an easy and annoying problem with mathematica: > I need to define a function f(x,y) which takes some values for > x=0,2pi,4pi (indepently of y) and has a different expression for all > the other values of y. This is easily done for one-dimensional > functions but I am in serious troubles for my two-dimensional problem: > any suggestion? > Thanks a lot, > Fabio There were some typos in my last message. It should have read: Let the known values of the function at x={0,2Pi,4Pi} be {f0,f2,f4}. Your conditions can be met by f(x,y)=x(x-2Pi)(x-4Pi)g(y)+h(x), where {h(0),h(2Pi),h(4Pi)}={f0,f2,f4}. An h(x) can be found by quadratic interpolation: h[x]= a + bx + cx^2; Solve[{a==f0,a+2Pi b +(2Pi)^2 c==f2, a+4Pi b+(4Pi)^2 c==f4},{a,b,c}] {{b -> -(3*f0 - 4*f2 + f4)/(4*Pi), c -> -(-f0 + 2*f2 - f4)/(8*Pi^2), a -> f0}}