Re: Adding interpolated values to a list

• To: mathgroup at smc.vnet.net
• Subject: [mg21124] Re: [mg20961] Adding interpolated values to a list
• From: "Allan Hayes" <hay at haystack.demon.co.uk>
• Date: Fri, 17 Dec 1999 01:21:23 -0500 (EST)
• References: <831ij5\$dff@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Steve:

X = {2, 4, 6, 8, 10};
Y = {0, 10, 12, 2, 4};

ifn = Interpolation[Transpose[{X, Y}],
InterpolationOrder -> 1];

Ynew = Table[ifn[x], {x, 2, 10}]

{0, 5, 10, 11, 12, 7, 2, 3, 4}

or

ifn /@ Range[2, 10]

{0, 5, 10, 11, 12, 7, 2, 3, 4}

Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Steve" <com3 at *NOSPAM*ix.netcom.com> wrote in message
news:831ij5\$dff at smc.vnet.net...
> Greetings and thanks to all who have answered my questions in the
> past. This is a great lifeline to new users.
>
> I have recieved a large quantity of x, y ordered pairs from a
> colleague for which I need to compute interpolated values and then add
> these values (in proper sequence) to a list. A very simplified
> description of this follows.
>
> X={2,4,6,8,10}
> Y={0,10,12,2,4}
>
> Xnew={2,3,4,5,6,7,8,9,10}
> Ynew={0,5,10,11,12,7,2,3,4}
>
> X and Y are the original ordered pairs sent to me.
>
> Xnew is the new x vector that I would create (using Range).
> Ynew is the new y vector which corresponds to Xnew.
>
> Note that the ordered pairs (2,0), (4,10), (6,12), (8,2), and (10,4)
> are maintained in the new lists. Additionally, the linearly
> interpolated values are also included in Ynew so that a plot of the
> original data will lie on top of a plot of the new data when plotted
> on the same graph.
>
> Can someone help me set up the command(s) to compute Ynew ?
>
> Thanks in advance.
>
> Steve
>
>
> For any e-mail responses, please remove *NOSPAM* from my address.
>

```

• Prev by Date: Re: Q: efficient in-place list element replacement?
• Next by Date: Re: 2 coupled diff. eqns
• Previous by thread: Re: Adding interpolated values to a list
• Next by thread: stodola