# problem in Interpolation

I made a force diagram into a matrix. How can I have find a value in y for a number in x? I know for 0.1 for example the force becomes 500, or for 0.3 it becomes -500 How do I know how much it will be for .1234

p = ( {
{0, 0},
{.2, 1000},
{.4, 0},
{.6, -1000},
{.8, 0}
} );
ListLinePlot[p]


• i use this but it give me wrong answers Interpolation[p, .1] – Scott Constantine Dec 1 '20 at 17:48

Clear["Global*"]

p = {{0, 0}, {.2, 1000}, {.4, 0}, {.6, -1000}, {.8, 0}};

f = Interpolation[p];

f[0.1234]

(* 962.25 *)

Plot[f[x], {x, 0, 0.8},
Epilog -> {AbsolutePointSize[6],
Red, Point[p], Green, Point[{#, f[#]} &[0.1234]]}]


Edit: If you want linear interpolation change the InterpolationOrder to 1

f2 = Interpolation[p, InterpolationOrder -> 1];

f2[0.1234]

(* 617. *)

Plot[f2[x], {x, 0, 0.8},
Epilog -> {AbsolutePointSize[6], Red, Point[p], Green,
Point[{#, f2[#]} &[0.1234]]}]


• that's my problem, my digram is liner not like something you say, in fact I have diagram and I want Interpolation it – Scott Constantine Dec 1 '20 at 18:04
• tanks a lot, i have jus on more questions ,My steps for t are 0.1 from zero to two. How can I write this formula? c = Subscript[t, i] + Subscript[t, i + 1] c=t(i)+t(i+1) – Scott Constantine Dec 1 '20 at 18:46
• Your comment doesn't make any sense to me. You have not explained how c or t relates to anything previously discussed. If t is the domain of f, the interval {0.1, 2} extends well beyond the basis for the interpolation (i.e., {0, 0.8}`) and would require extrapolation rather than interpolation. If so, what is the expected behavior outside of the origin range? Linear? Periodic? You want to know "how to write a formula" but you have not said what the formula is to represent other than the formula that you gave. Please formulate your question better and post as a new question. – Bob Hanlon Dec 1 '20 at 20:55
• Hi, I said my question has nothing to do with the previous one,Suppose I have this formula t={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} How to calculate c=t(i)+t(i+1) – Scott Constantine Dec 1 '20 at 22:13
• New questions should not be asked in comments. – Bob Hanlon Dec 1 '20 at 22:17