How to minimise this function?

In summary, the conversation discusses the calculation of the partial derivative of a function with respect to a certain variable and equating it to zero to minimize the function. The process involves breaking down the function into smaller parts, simplifying them, and solving for the missing variable.
  • #1
ecastro
254
8
I tried calculating the partial derivative of

##\varphi\left(x, y\right) = \sum_\lambda\left\{H\left(\lambda\right) \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2\right\}##

with respect to ##a_n## and equating it to zero to minimise the function (please check my computation).

\begin{eqnarray*}
\frac{\partial \varphi\left(x, y\right)}{\partial a_n} &=& \frac{\partial}{\partial a_n} \sum_\lambda\left\{H\left(\lambda\right) \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2\right\} \\
&=& \sum_\lambda \frac{\partial}{\partial a_n} \left\{H\left(\lambda\right) \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2\right\} \\
&=& \sum_\lambda H\left(\lambda\right) \frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2 + \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2 \frac{\partial}{\partial a_n} H\left(\lambda\right)
\end{eqnarray*}

Since ##H\left(\lambda\right)## is not a function of ##a_n##, its partial derivative is zero, and thus the second term vanishes. For the partial differentiation in the first term

\begin{eqnarray*}
\frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2 &=& 2\left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] \times \frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right].
\end{eqnarray*}

The second term of the previous equation is

\begin{eqnarray*}
\frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] &=& \frac{\partial}{\partial a_n} C_E\left(\lambda; x, y\right) + \frac{\partial}{\partial a_n} \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)
\end{eqnarray*}

The first term is not a function of ##a_n##, thus it also vanishes, while the second term is

\begin{eqnarray*}
\frac{\partial}{\partial a_n} \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) &=& \sum_n \left[\frac{\partial}{\partial a_n} a_n\left(x, y\right) e_n\left(\lambda\right)\right] \\
&=& \sum_n \left[a_n\left(x, y\right)\frac{\partial}{\partial a_n} e_n\left(\lambda\right) + e_n\left(\lambda\right) \frac{\partial}{\partial a_n} a_n\left(x, y\right)\right] \\
&=& \sum_n e_n\left(\lambda\right)
\end{eqnarray*}

Plugging-in everything back,

\begin{eqnarray*}
\frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] &=& \sum_n e_n\left(\lambda\right) \\
\frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2 &=& 2\left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] \times \sum_n e_n\left(\lambda\right) \\
\frac{\partial \varphi\left(x, y\right)}{\partial a_n} &=& \sum_\lambda H\left(\lambda\right) \times 2\left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] \times \sum_m e_m\left(\lambda\right) \\
&=& \sum_\lambda \left[2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) \sum_m e_m\left(\lambda\right) + 2 H\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) \sum_m e_m\left(\lambda\right)\right]
\end{eqnarray*}

Note that I changed the last summation from ##n## to ##m## to avoid confusion with the other summation.

From here, I need to equate it to zero to minimise the function and solve for ##a_n##, but I don't know how.
 
Physics news on Phys.org
  • #2
ecastro said:
Note that I changed the last summation from n to m to avoid confusion with the other summation.
Is that implied in the previous steps as well, or do you want to calculate the derivative with respect to the last element? Either way, the sum should go away, assuming
$$\frac \partial {\partial a_k} a_m \neq 1$$ in general.
 
  • #3
I actually don't know what I am doing... Sorry.

The range of values of ##m## and ##n## are the same, so is it unnecessary to change the variables?

I also just thought of that the partial derivative goes from every value of ##a_n##. So, the partial derivative goes as ##\frac{\partial}{\partial a_1}##, then ##\frac{\partial}{\partial a_2}##, and so on.

mfb said:
Either way, the sum should go away,

Yes, I thought so too. Then, correcting my computation for ##n = 1## as an example,

\begin{equation*}
\frac{\partial}{\partial a_1} \sum_{n = 1}^{+\infty} a_n\left(x, y\right) e_n\left(\lambda\right) = e_1\left(\lambda\right).
\end{equation*}

Is this correct?
 
  • #4
Right.

And it is useful to have separate names (n, m) everywhere.
 
  • #5
Thank you. The partial derivative of the function with respect to ##a_1## as an example is

\begin{eqnarray*}
\frac{\partial \varphi\left(x, y\right)}{\partial a_1} &=& \sum_\lambda H\left(\lambda\right) \left\{2 \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] \cdot e_1 \left(\lambda\right) \right\} \\
&=& \sum_\lambda \left[2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) + 2 H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]
\end{eqnarray*}

And equating this to zero to minimise it,

\begin{eqnarray*}
\sum_\lambda \left[2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) + 2 H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] &=& 0 \\
\sum_\lambda 2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) + \sum_\lambda 2 H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) &=& 0 \\
\sum_\lambda 2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) &=& - \sum_\lambda 2 H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) \\
\sum_\lambda H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) &=& - \sum_\lambda H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)
\end{eqnarray*}

The missing variable here are the ##a_n## which I can solve by taking the partial derivate of ##\varphi \left(x, y\right)## with respect to ##a_2##, ##a_3##, and so on. I wonder if this is possible on the right-hand side of the previous equation:

\begin{eqnarray*}
- \sum_\lambda H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) &=& - \sum_\lambda \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) H\left(\lambda\right) e_1\left(\lambda\right) \\
&=& - \sum_n \sum_\lambda a_n\left(x, y\right) e_n\left(\lambda\right) H\left(\lambda\right) e_1\left(\lambda\right) \\
&=& - \sum_n a_n\left(x, y\right) \sum_\lambda e_n\left(\lambda\right) H\left(\lambda\right) e_1\left(\lambda\right)
\end{eqnarray*}
 
  • #6
If n does not depend on ##\lambda##, that is fine.
 
  • #7
Alright. As far as I know, ##n## and ##\lambda## are independent from each other. Thank you for your help.
 

Related to How to minimise this function?

1. What is a function?

A function is a mathematical relationship between two or more variables, where each input (or independent variable) corresponds to exactly one output (or dependent variable).

2. How do you minimise a function?

To minimise a function, you need to find the value(s) of the input variable(s) that result in the smallest output value. This can be done by using various mathematical techniques, such as calculus or linear algebra.

3. Why would you want to minimise a function?

Minimising a function can be useful in many applications, such as optimization problems, data analysis, and machine learning. It helps to find the best possible solution or model that fits the given data or satisfies certain constraints.

4. What are some common methods for minimising a function?

Some common methods for minimising a function include gradient descent, Newton's method, and simulated annealing. These methods involve iteratively updating the input variable(s) to get closer to the minimum value of the function.

5. Are there any limitations to minimising a function?

Yes, there can be limitations to minimising a function. Some functions may not have a global minimum, or the minimum may not be reachable using the chosen minimisation method. Additionally, minimising a function may be computationally expensive for complex functions with many variables.

Similar threads

Replies
6
Views
812
Replies
3
Views
1K
Replies
2
Views
702
Replies
1
Views
1K
Replies
4
Views
490
Replies
1
Views
1K
Replies
3
Views
1K
Replies
8
Views
1K
Replies
3
Views
1K
Back
Top