1

I am trying to linearize the following function, but, having difficulties.

Let,

$x = \frac{l}{m},$

where $l,m \in R^+$ and $l<m$

Assume $l$ is a variable, while, $m$ is a constant (parameter), which makes $x$ a variable. I want to find a linear approximation for the following:

$f(x) = \frac{x}{2m(1-x)}$

In other words, as $2$ and $m$ are constant, I am interested in

$g(x)=\frac{x}{1-x}$

I plotted the graph, but, it did not really help to derive something useful. Any help is appreciated.

tcokyasar
  • 147
  • Linear Approximation? You want to approximate the function using a straight line? – W. mu Jul 15 '18 at 02:50
  • Yes. Does it sound impossible? – tcokyasar Jul 15 '18 at 02:51
  • Of course, it's possible, but the error may be large. https://en.wikipedia.org/wiki/Approximation_theory – W. mu Jul 15 '18 at 03:04
  • If you are looking for the usual calculus approximation, then it will be $h(x)=x$. This can be found by the formula $f(x)≈f'(x_0)(x-x_0)+f(x_0)$ when $x≈x_0$. – YiFan Tey Jul 15 '18 at 09:53
  • @user496634 thanks for your comment. In my search for solutions, I confronted with the calculus approximation. Yet, I could not quite understand how it can make the function linear because the first derivative of the function still remains to be non-linear with squared $x$ terms. Additionally, I am lost with the term $x_0$. I am using this function in a MILP problem and I do solve for $x$ and other thousands of variables while there are several inequality constraints including $x$. If you may put your solution approach down, I will be thrilled to read it. – tcokyasar Jul 16 '18 at 01:53
  • @user8028576 out of sheer curiosity, may I know what level of mathematics you are at? (Just starting Calculus I? Finished Calculus?) It may also help me produce an answer understandable to you and best addresses your problem. – YiFan Tey Jul 16 '18 at 05:26
  • I am a PhD student in industrial engineering with all qualitative sciences (business administration and literature) background and working experience in banking industry. Never taken a semester long calc class. I know operations research pretty well, but, when it comes to math side of it, I just hit the wall. I understood all you explained though. Thank you very much for your contribution. – tcokyasar Jul 16 '18 at 12:24

3 Answers3

2

If, over a range $a\leq x \leq b$, you want the best linear approximation $A+Bx$ of $$f(x) = \frac{x}{2m(1-x)}$$ the solution is to minimize the norm $$F=\int_{a}^{b} \left(A+Bx-\frac{x}{2m(1-x)} \right)^2$$ with respect to parameters $A$ and $B$.

Integrating and then computing the partial derivatives $\frac{\partial F}{\partial A}$ and $\frac{\partial F}{\partial B}$ and setting them equal to $0$ leads to two linear equations in $(A,B)$ $$2m(b-a) A + m (b^2-a^2)B+(b-a)+\log \left(\frac{1-b}{1-a}\right)=0$$ $$6m(b^2-a^2)A+4m(b^3-a^3)B+3 (b-a) (a+b+2)+6\log \left(\frac{1-b}{1-a}\right)=0$$ which you can simplify factoring $(b-a)$ in several places. I let to you the pleasure of finding $A,B$ (but this is simple).

Around $x=0$, for $a=-b$, using Taylor series, we have $$A=\frac{b^2}{6 m}+\frac{b^4}{10 m}+O\left(b^6\right)\qquad B=\frac{1}{2 m}+\frac{3 b^2}{10 m}+\frac{3 b^4}{14 m}+O\left(b^6\right)\qquad F=\frac{2 b^5}{45 m^2}+O\left(b^7\right)$$

Taking an example using $a=-0.1$, $b=0.1$, $m=1$, this would lead to $$A=\frac{1}{2} \left(-1+5 \log \left(\frac{11}{10}\right)+5 \log \left(\frac{10}{9}\right)\right)\approx 0.00167674$$ $$B=-150 (1+10 \log (3)-5 \log (11))\approx 0.503022$$

  • Thanks a lot! This is what I was looking for. Yet, I need some verbal explanation to digest all this and make it useful for my case. First of all, I use the function $f(x)$ in a mixed integer (non)linear programming model and $f(x)$ is the term that makes it non. Again, $0\leq x<1$. So, I guess, I need to set $a=0$ and possibly $b=0.999$ as close as to $1$. Then, instead of having my $x$ as a variable in my problem, I would have $A$ and $B$. But, I still need $x$ as a variable because I have to use in some other equality constraints. So, what would you recommend in this case? – tcokyasar Jul 16 '18 at 00:55
  • Dr. Leibovici, if I understand your solution correctly with my limited math, I guess, you mean, I probably need to find $A$ and $B$ given that $a=0$ and (say) $b=0.999$. Then, plugging these in $f(x)=A+Bx$ will yield me an approximation of my original function, right? If I get it right until here, either this approximation does not really work or I miss something. I found $A=36.9472, B=-68.0547$ given that $a=0, b=0.999, m=1$. When I test the approximation with $x=0.6$, I get $f(x)_{approx} = −3.88562$ while $f(x)=0.75$. Furthermore, $f(x)\geq 0 $ must be held in any case. – tcokyasar Jul 16 '18 at 01:46
  • @user8028576. Linearization of any function is local and valid over a small range. – Claude Leibovici Jul 16 '18 at 03:05
  • Dr. Leibovici, so, do you mean $a=0$ and $b=0.999$ is a large range? If yes, how can I find the optimal range to make the approximation valid? I guess, I may create multiple equations of the above form with e.g., $a=0, b=0.1$, $a=0.1, b=0.2$ $...$ $a=0.9, b=0.999$. Right? But, is $0.1$ step size okay? – tcokyasar Jul 16 '18 at 03:38
  • @user8028576. For each ("small") range, you need to compute $A$ and $B$. – Claude Leibovici Jul 16 '18 at 03:51
  • Thank you very very much for your help! I will compute them for every 0.1 step size and see how accurate my results are. If they are close enough, I will be so happy. Btw, though I did not know how to write the norm integration formulation, when I made the plot, minimizing the squared difference was what I was thinking in my mind. Once again, I appreciate your contribution. – tcokyasar Jul 16 '18 at 03:58
  • @user8028576. This is equivalent to a linear regression using an infinite number of data points. – Claude Leibovici Jul 16 '18 at 04:06
1

I will present an elementary calculus solution. I will first rename your $g(x)$ into $f(x)$ because I can and because it looks nicer to the eye. It is apparent that the best linear approximation to any function at $x=0$ must be the tangent line to the function at $x=0$. In our case, since $f(0)=0$, our tangent line must pass through $(0,0)$ too and so it must be of the form $y=mx$. Since it is the tangent line, the gradient $m$ of this line must have the same "gradient" (i.e. rate of change) as $f$ at $0$. To find the gradient, thus, we set

$$ m = f'(0) $$

Where the RHS is the derivative at $0$; so the rate of change as previously mentioned. So now we just have to take the derivative of $f$ and evaluate it at $0$ to find $m$. I'm sure you know how to do this, but I'll put it here for completeness's sake:

$$\frac{d}{dx} \frac{x}{1-x} = \frac{(1-x)-(-1)x}{(1-x)^2}$$

Evaluated at $0$ this is $1$. So $m=1$ and the closest linear approximation would be $y=mx=x$.

YiFan Tey
  • 17,431
  • 4
  • 28
  • 66
  • you basically propose $F = \frac{x}{2m}$ as a n approximation to the original $f(x)$ given in the post. If I get it correctly, this approximation is not any close to $f(x)$. Let $x=0.9, m=1$, $f(x)=4.5$ and $F=0.45$. If I interpret it wrongly, please let me know. – tcokyasar Jul 16 '18 at 15:40
  • @user8028576 You are absolutely right that it is not a very good approximation. However, it is the best linear one, locally around $x=0$. This is unless, of course, you want to approximate it around a range around $x=0$, not just best at that point and it's "immediate vicinity". In that case, you can consider Leibovici's answer. You will see that in a small range immediately around $0$, my approximation is better; while in the range $a$ and $b$ in his answer his is generally better. – YiFan Tey Jul 16 '18 at 22:34
  • @user8028576 A helpful way to consider this is that my answer is the limit of Lebivoci's answer as $a$ and $b$ both approach $0$ (this is quite easy to prove). Around points extremely close to $0$, my approximation is extremely good; while his answer minimises the sum of the squared of the difference in values over a whole range $[a,b]$. One is an approximation at a point, the other is the approximation over a range. – YiFan Tey Jul 16 '18 at 22:40
  • @user8028576 I totally get the logic of both approximations. Your approximation draws a linear line starting from the origin and it does not really worry about minimizing the difference in the approximation and the actual. Your approximation is the easiest with a single $F=\frac{x}{2m} function. On the other hand, Leibovici's Taylor series draws a line for a "small" range of the whole plot that is as close as to the originial nonlinear line in that segmentation. Once I create "a lot of"of those lines with the given function, I will be able to approximate much more precisely. – tcokyasar Jul 17 '18 at 13:42
  • 1
    But, when I get much closer to the tails of the approximation, his approximation yields an infeasible (negative) solution. For example, $a=0, b=0.1, m=1$, then, when I search for $x=0.0001$, it will give me $F\approx -0.00088$. Yet, this situation is understandable. To deal with it, I will adjust the ranges according to my expectations of the results. For instance, if I know $x=0.0001$ is an expected result, then I will add shorter ranges, which is equivalent of saying a decimal adjustment. I think, I got it! I am happy. Thank you very much to all, as you thought me something very useful! – tcokyasar Jul 17 '18 at 13:47
0

$$\frac d{dx} \frac1 {1-x} = \frac1{(1-x)^2}$$ Additionally, since $\frac1{1-x} = \sum_{k=0}^{\infty}x^k$ clearly $$\frac1{(1-x)^2} = \sum_{k=1}^{\infty}kx^{k-1}$$Unfortunately, it does not really make sense to approximate linearly something like this in any global sense. Locally, evaluating $m = \frac1{(1-x_0)^2}$ would give you the slope of a line tangent to $\frac1{(1-x)}$ at point $x_0$ which locally approximates it linearly. I believe this is what you're asking.