Re: interpolating function
- To: mathgroup at smc.vnet.net
- Subject: [mg22258] Re: interpolating function
- From: "Atul Sharma" <atulksharma at yahoo.com>
- Date: Sat, 19 Feb 2000 01:34:05 -0500 (EST)
- References: <88jum7$9oe@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
There are several equivalent ways to do this. Below, I imposed conditions on the value of x, effectively overloading the function with different meanings depending on these conditions (using /; ). You could do the same with If, Which or related statements if you prefer. A. Sharma In[1]:= data1 = Table[{x, 1/x}, {x, 1, 10}]; data2 = Table[{x, 1/x^2}, {x, 10, 20}]; In[2]:= f1 = Interpolation[data1] f2 = Interpolation[data2] In[3]:= f[x_ /; x >= 1 && x <= 10] = f1[x] f[x_ /; x > 10 && x <= 20] = f2[x] In[4]:= Plot[f[x], {x, 1, 20}] Bernd Brandt wrote in message <88jum7$9oe at smc.vnet.net>... >Dear Mathgroup members, > >I have been plotting, using interpolating functions: > >Show[Plot[Con[x] /. sol1, {x, 0, 10}], Plot[Con[x] /. sol2, {x, 10, 12}]] > >I imagine there is a way to join up these two interpolating functions >to cover to complete domain {x, 0, 10} in one Interpolating function >object. However, I cannot find how to do this. > >Any suggestions would be appreciated. > >Thank you. > >Bernd >