title: c# n-linear interpolation
body: <p>Wondering if I'm barking up the wrong tree. I'd like a recursive function to give me the results of an n-linear interpolation, for example:</p>
  
  <p>I'm applying discounts to vehicle prices.
  I have two types of discount:  Volume and Age, such that</p>
  
  <p>A.
  Volume = 10, Age = 10, discount = 100;
  Volume = 10, Age = 20, discount = 200;</p>
  
  <p>B.
  Volume =20, Age = 10, discount = 200;
  Volume = 20 Age = 20, discount = 400;</p>
  
  <p>I want to interpolate the following:</p>
  
  <p>Volume = 15, Age =15 , discount = ??</p>
  
  <p>On paper, what I would do is, using the formula yn =y0 + (x1 - xn) (y1 - y0/x1 - x0):</p>
  
  <ol>
  <li>From A, interpolate:  Volume = 10, Age = 15, result = 150</li>
  <li>From B, interpolate:  Volume = 20, Age = 15, result = 300</li>
  <li>From 1 and 2, interpolate Volume = 15, Age = 15, result = 225</li>
  </ol>
  
  <p>Any ideas how to write that as a C# recursive function such that I can have any number of shocks ? Can it be represented that way?</p>
  
  <p>If you need more info, let me know and many thanks in advance for any help.</p>