Setting up the Lagrangian Multipliers method for spherical coords

preet
Messages
96
Reaction score
0
This isn't really a homework question, but may be similar to a typical example problem so I posted it here.

Homework Statement


I want to find the max and min dot product of a 3d vector and all points in a sphere constrained by angles in spherical coordinates.

Homework Equations


A point on the sphere can be expressed using spherical parameters (R is constant) as:
x=R*sin\theta*cos\phi
y=R*sin\theta*sin\phi
z=R*cos\theta

The Attempt at a Solution


The dot product between any point on the sphere and a vector [A,B,C] can be written as:
f(\theta,\phi) = A*R*sin\theta*cos\phi + B*R*sin\theta*sin\phi + R*cos\theta

We can set some constraint \theta = \theta_A on f and then find the extrema to find the max and min.

From Wikipedia, I can set up Lagrange Multipliers with my function and the constraint using
\Lambda(x,y,\lambda) = f(x,y) + \lambda \cdot \Big(g(x,y)-c\Big),
and solve
\nabla_{x,y,\lambda} \Lambda(x , y, \lambda)=0.

The problem is I'm not sure how to set up the gradient. I know that the gradient has a slightly different definition in spherical coordinates. Which definition of the gradient should I be using here?
 
Physics news on Phys.org
preet said:
This isn't really a homework question, but may be similar to a typical example problem so I posted it here.

Homework Statement


I want to find the max and min dot product of a 3d vector and all points in a sphere constrained by angles in spherical coordinates.

Homework Equations


A point on the sphere can be expressed using spherical parameters (R is constant) as:
x=R*sin\theta*cos\phi
y=R*sin\theta*sin\phi
z=R*cos\theta

The Attempt at a Solution


The dot product between any point on the sphere and a vector [A,B,C] can be written as:
f(\theta,\phi) = A*R*sin\theta*cos\phi + B*R*sin\theta*sin\phi + R*cos\theta

I believe this should be
<br /> f(\theta, \phi) = AR\sin\theta \cos \phi + BR\sin\theta \sin\phi + CR\cos\theta<br />

We can set some constraint \theta = \theta_A on f and then find the extrema to find the max and min.

From Wikipedia, I can set up Lagrange Multipliers with my function and the constraint using
\Lambda(x,y,\lambda) = f(x,y) + \lambda \cdot \Big(g(x,y)-c\Big),
and solve
\nabla_{x,y,\lambda} \Lambda(x , y, \lambda)=0.

The problem is I'm not sure how to set up the gradient. I know that the gradient has a slightly different definition in spherical coordinates. Which definition of the gradient should I be using here?

You don't need a Lagrange multiplier here; you can just maximize f(\theta,\phi) subject to the limits on \theta and \phi. It is possible that extrema will occur on the boundary.

If you had kept the dot product in terms of cartesian coordinates then you would need a Lagrange multiplier to enforce the constraint x^2 + y^2 + z^2 = R^2, but when working in spherical coordinates that constraint is automatically enforced.

The form of the gradient here is <br /> \frac1R \frac{\partial f}{\partial \theta}\mathbf{e}_\theta + \frac{1}{R \sin \theta} \frac{\partial f}{\partial \phi}\mathbf{e}_\phi
 
Thanks for the reply.

You don't need a Lagrange multiplier here; you can just maximize f(θ,ϕ) subject to the limits on θ and ϕ. It is possible that extrema will occur on the boundary.

I misstated my original constraint. Its an inequality constraint of the form \theta_K \leq \theta \leq \theta_L (and \phi_M \leq \phi \leq \phi_N as well). I can take the partial derivates:

\frac{\partial f}{\partial \theta} and \frac{\partial f}{\partial \phi}

And set them = 0 to find critical points. Not really sure how to proceed with the inequality constraints I mentioned though. If the critical point lies within the range, that's fine... but it likely won't. What do I do in the general case (sorry if its obvious)?
 
If there aren't any critical points in the region, then it follows that the extreme values should lie on the boundary of the region (assuming it's a nice function).
 
preet said:
This isn't really a homework question, but may be similar to a typical example problem so I posted it here.

Homework Statement


I want to find the max and min dot product of a 3d vector and all points in a sphere constrained by angles in spherical coordinates.

Homework Equations


A point on the sphere can be expressed using spherical parameters (R is constant) as:
x=R*sin\theta*cos\phi
y=R*sin\theta*sin\phi
z=R*cos\theta

The Attempt at a Solution


The dot product between any point on the sphere and a vector [A,B,C] can be written as:
f(\theta,\phi) = A*R*sin\theta*cos\phi + B*R*sin\theta*sin\phi + R*cos\theta

We can set some constraint \theta = \theta_A on f and then find the extrema to find the max and min.

From Wikipedia, I can set up Lagrange Multipliers with my function and the constraint using
\Lambda(x,y,\lambda) = f(x,y) + \lambda \cdot \Big(g(x,y)-c\Big),
and solve
\nabla_{x,y,\lambda} \Lambda(x , y, \lambda)=0.

The problem is I'm not sure how to set up the gradient. I know that the gradient has a slightly different definition in spherical coordinates. Which definition of the gradient should I be using here?

The "gradient" referred to in that article is not the "gradient vector" as understood in physics; it is just the collection of partial derivatives. Therefore, in any coordinate system ##(u,v)##, with ##x = \xi(u,v)## and ##y = \eta(u,v)## and with new Lagrangian ##M(u,v,\lambda) = F(u,v) + \lambda G(u,v)## (where ##F(u,v) = f(\xi(u,v),\eta(u,v))##, etc) we just have
\frac{\partial M}{\partial u} = 0, \: \frac{\partial M}{\partial v} = 0.

However, these conditions do not hold in general in inequality-constrained problems; if fact, you need the so-called Karush-Kuhn-Tucker condtions. For a problem of the form
\min F(u,v)\\<br /> \text{subject to } \: G(u,v) = 0\\<br /> \text{and } \: a \leq u \leq b, \: c \leq v \leq d \\<br /> a,b,c,d \:\text{= constants}<br />
we have the following. Setting ##M = F + \lambda G##, the necessary conditions for ##(u,v)## to be a (local) constrained minimum are:
<br /> \begin{array}{l}<br /> \partial M/ \partial u \geq 0 \text{ if } u = a\\<br /> \partial M/ \partial u \leq 0 \text{ if } u = b\\<br /> \partial M/ \partial u = 0 \text{ if } a &lt; u &lt; b\\<br /> \\<br /> \partial M/ \partial v \geq 0 \text{ if } v = c\\<br /> \partial M/ \partial v \leq 0 \text{ if } v = d\\<br /> \partial M/ \partial v = 0 \text{ if } c &lt; v &lt; d<br /> \end{array}

For a maximization problem the inequalities should be swapped in the above.

To understand those conditions intuitively (and to help you to remember them) just think of minimizing a 1-variable function ##f(x)## on an interval ##[a,b]##. If the minimum occurs at the left-hand endpoint ##x = a## the function ##f## must be going up (increasing) near ##x = a##---or at least, not be strictly decreasing there. So, we need ##f'(a) \geq 0##. Similarly you need ##f'(b) \leq 0## at the right-hand endpoint ##x = b##. The inequalities should be opposite if you are maximizing instead of minimizing. The conditions given previously just apply these ideas to the multivariate version and use the Lagrangian instead of the function ##F## itself.
 
Last edited:
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top