3

Suppose I have an increasing step function $E_c$ given by $$E_c(\phi) = \sum_{i=1}^n E_i \theta(\phi - \phi_i),$$ where $\theta$ is the Heaviside step function and $E_i$, $\phi$, and $\phi_i$ are all and real and $n$ is a small integer, approximately 6. (Also, $E_i > 0$ and $ 0 < \phi_i \leq 2\pi$.)

I want to find a line such that the area between the line and the step function is minimized. That is, I want to find $m$ and $\phi_0$ to minimize $A$, where $$A = \int_0^{2\pi} |E_c - m(\phi - \phi_0)|d\phi.$$

Does anyone know whether methods have already been developed to do this? Thanks!

  • The minimal area or the minimal square displacement? Because if you are looking for least squares, then you get basic fitting and a closed form solution. – orion Jun 29 '15 at 13:51
  • I'm looking for the line that minimizes the area, which I defined above. – Eliott Rosenberg Jun 29 '15 at 13:55
  • Ok, just checking. Because you have linear and step functions, this will reduce to a linear programming problem, which has well known solutions. I'll elaborate in the answer. – orion Jun 29 '15 at 13:57
  • 1
    Sorry, it turns out you can't get around nonlinear terms when your line intersects the step function. I think the best bet is just to do it numerically: design a function for your integral (that's just a sum of triangles and rectangles), and push it into a general purpose minimizer in any of the existing software packages. It's minimization over 2 variables, it shouldn't have any problems with it. – orion Jun 29 '15 at 14:18

1 Answers1

0

You can formulate the problem as follows

$$\min A \rightarrow \min \bigg(\int_0^{2\pi} \big(E_c - m\phi - k\big)^2d\phi \bigg)$$

and partitioning your domain $$\min \bigg(\int_0^{\phi_1} \big(- m\phi - k\big)^2d\phi + \int_{\phi_1}^{\phi_2} \big(E_1- m\phi - k\big)^2d\phi +\int_{\phi_2}^{\phi_3} \big(E_1+E_2- m\phi - k\big)^2d\phi+...+\int_{\phi_n}^{2\pi} \big(E_1+E_2+...+E_n- m\phi - k\big)^2d\phi \bigg)$$

By doing the integrations

$$\int_0^{\phi_1} \big(- m\phi - k\big)^2d\phi =k^2\phi_1+km\phi_1^2+\frac{m^2\phi_1^3}3$$ $$\int_{\phi_1}^{\phi_2} \big(E_1- m\phi - k\big)^2d\phi=\frac{(E_1-m\phi_1)^3-(E_1-m\phi_2)^3}{3m}$$ $$\int_{\phi_2}^{\phi_3} \big(E_1+E_2- m\phi - k\big)^2d\phi=\frac{(E_1+E_2-m\phi_2)^3-(E_1+E_2+m\phi_3)^3}{3m}$$ $$...$$ $$\int_{\phi_n}^{2\pi} \big(E_1+E_2+...+E_n- m\phi - k\big)^2d\phi=\frac{(E_1+E_2+...+E_n-m\phi_n)^3-(E_1+E_2+...+E_n+2m\pi)^3}{3m}$$ Now we can take the partial derivatives w.r.t. $m$ and $k$ and solve for minimum value.

AnilB
  • 4,202
  • Why is the line that minimizes the integral of the difference squared the same as the line that minimizes the integral of the absolute value of the difference? – Eliott Rosenberg Jul 04 '15 at 10:36
  • If you minimize the distance between the line and the step function you also minimize the area between them – AnilB Jul 04 '15 at 15:15
  • Yes, but you're minimizing the square of the distance between them, integrated over phi. – Eliott Rosenberg Jul 06 '15 at 06:50
  • @EliottRosenberg I got your point. Actually it is a simple trick used in optimization. You can check below answers: http://math.stackexchange.com/a/74560/64096 and http://math.stackexchange.com/a/1324591/64096 – AnilB Jul 06 '15 at 18:44