# Approximation of function on interval

I'm looking for an accurate but as simple as possible approximation of

$S(x,\lambda) = \frac{1}{(1-x) [x-(1-\lambda )]}\left((1+\lambda ) \left(\frac{x(1+\lambda)}{1-\lambda }\right)^{\frac{x(1-\lambda )-(1-\lambda )}{x(1+\lambda )-(1-\lambda )}}-\lambda -x\right)$

for $x \in (0,1), \lambda \in (0,1)$.

Does such a thing exist, and how can one find it? From what I've tried, Taylor expansion does not seem very effective in approximating the function in question... any other ideas? Many thanks!

-
Oh dear. How exactly did you end up with this beast? –  Ｊ. Ｍ. Jul 24 '12 at 13:17
How accurate/fast does the approximation have to be? What is the application for it? –  Shaktal Jul 24 '12 at 13:22
It's an expression for "the gains of waiting" in an economics article. To be precise, it measures how much it pays for a consumer to delay his purchase, given that firms sample prices from an equilibrium distribution function $G(p)$. $\lambda$ is a parameter of the model and $x$ a variable I'd like to solve for. –  Martin Jul 24 '12 at 13:26
Ideally I'd just like some kind of low degree polynomial, algebraic fraction or logarithmic function such that I can solve $S(x,\lambda) = W(x)$ for nice sample functions $W(x)$. I have not an extensive math background. –  Martin Jul 24 '12 at 13:28

The graph of $S$ as a function of $x$ looks very much like a hyperbola, which suggests using the approximation $S(x,\lambda)\approx a+\frac{b}{x+c}$ where $a,b,c$ depend on $\lambda$ in some way.

I first tried to fit a hyperbola to the data $$S(0)=\frac{\lambda}{1-\lambda},\quad S'(0)=-\frac{\lambda(1+2\lambda)}{(1-\lambda)^2}, \quad S(1)=\frac{1}{2\lambda^2}\left(2\lambda-(1-\lambda^2)\ln\frac{1+\lambda}{1-\lambda}\right)$$ by solving the system $a+b/c=S(0)$, $-b/c^2=S'(0)$, and $a+b/(1+c)=S(1)$. Unfortunately this results in a substantial underestimate. The reason is that $S'(0)$ is a poor indicator of the behavior of the curve: $S'$ changes rapidly near $0$.

Then I fit the model $a+b/(x+c)$ to three points $S(0), S(1/3), S(1)$, and this worked much better.

Here is the comparison for $\lambda=0.17$ ($S$ in red, approximation in blue):

For $\lambda=0.37$

For $\lambda=0.87$

The coefficients $a,b,c$ are ugly, so I did not reproduce them here. The ugliness does not matter much if you work with specific $\lambda$. If you also need reasonably simple dependency on $\lambda$, let us know: maybe someone will come up with a better way to get $a,b,c$.

Here is an approximation with simple dependency on $\lambda$. I found it more convenient to work with $\tilde S=1-\frac{1-\lambda}{\lambda}S$, since this function is increasing from $0$ to something in the range 0.3..1, which is to say it has a milder dependency on $\lambda$ than the original one. I picked the model $\tilde S\approx \alpha x/(\beta x+\gamma)$ where $\alpha,\beta,\gamma$ are linear functions of $\lambda$. Here is one possibility: $$\tilde S\approx \frac{(1+2\lambda)x}{(2+\lambda)x+1-\lambda}$$ This approximation is not great, but you can tweak the six (well, actually five) numeric parameters to make it look better.
I very much like the idea of fitting S(x,.) to specific, simpler functions of x. Thank you very much for putting in the effort!A simple dependency on $\lambda$ would of course be nice, but what really matters is a simple dependency on $x$ which is robust to changes in $\lambda$. In particular, a good approximation for $\lambda \approx 0$ and $\lambda \approx 1$ would be nice. I will toy around some more based on your approach! –  Martin Jul 27 '12 at 9:52
Thanks Leonid. I tried your suggestion but it only seems to give a good approximation for $\lambda$ close to zero (assuming that $S = \frac{\lambda}{1-\lambda}(1-\tilde{S})$). I think I found a reasonably good approximation (with a complicated dependency on $\lambda$) to be $S(x,\lambda) = \frac{a}{x^{0.8}+b}$, with $b = \frac{2\lambda - (1-\lambda^2)Log\left(\frac{1+\lambda}{1-\lambda}\right)}{\frac{2\lambda^3}{1-\l‌​ambda}-2\lambda - (1-\lambda^2)Log\left(\frac{1+\lambda}{1-\lambda}\right)}$ and $a = \lambda b$. This function has only an exact fit for $S(0;\lambda)$ and $S(1;\lambda)$. –  Martin Jul 30 '12 at 9:48
There is a typo in the denominator and the website doesn't let me change it. It should be $\frac{2\lambda^3}{1-\lambda}-[2\lambda-(1-\lambda^2)Log\left(\frac{1+\lambda}{1‌​-\lambda}\right)].$ –  Martin Jul 30 '12 at 10:12