Hello,
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:
I'm applying discounts to vehicle prices. I have two types of discount: Volume and Age, such that
A. Volume = 10, Age = 10, discount = 100; Volume = 10, Age = 20, discount = 200;
B. Volume =20, Age = 10, discount = 200; Volume = 20 Age = 20, discount = 400;
I want to interpolate the following:
Volume = 15, Age =15 , discount = ??
On paper, what I would do is, using the formula yn =y0 + (x1 - xn) (y1 - y0/x1 - x0):
- From A, interpolate: Volume = 10, Age = 15, result = 150
- From B, interpolate: Volume = 20, Age = 15, result = 300
- From 1 and 2, interpolate Volume = 15, Age = 15, result = 225
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?
If you need more info, let me know and many thanks in advance for any help.