Lagrange-multiplier constraint for collinear beads in 3d?

In summary, the conversation discusses a simulation involving objects represented by collinear beads connected by massless rods. The simulation involves calculating Jacobian matrices, using Lagrange multipliers, and finding constraint forces. In 2D, the simulation works well, but in 3D, there are issues with the collinear constraint. Attempts to constrain the problem using spherical coordinates have failed, potentially due to overconstraining the cartesian coordinates. The 3D version works well as long as everything is coplanar in z, but any variation in z causes instability.
  • #1
vputz
11
0

Homework Statement



I'm trying to write a Lagrange-multiplier constraint simulation along the lines of those described by Andrew Witkin here.

The basic idea for this simulation is that you have a number of objects represented by three collinear beads joined by massless rods; one of the two rods changes length, and the other has a fixed length (the beads are in liquid interacting via rotne-prager tensor interactions, but the physics is not the gist of this question). The simulation works by calculating the Jacobian matrix of the constraints, using it to calculate Lagrange multipliers, finding constraint forces, and proceeding.

So we have two constraints:

1) the two beads of the fixed-length leg must remain the same distance apart, and
2) the three beads must remain collinear.

Here's the rub: I have the thing working wonderfully in 2d, but cannot for the life of me get it to behave in 3d.

For terminology, we'll label the beads 1-3 and say that leg 1-2 is changing length and 2-3 is remaining fixed.

Homework Equations



In 2d, the first constraint is that [tex]r_23 = \delta[/tex], which we can rewrite as [tex]C=r_{23}^2 - \delta^2 = 0[/tex], or

[tex]C=((x_3-x_2)^2+(y_3-y_2)^2=0[/tex]

[tex]C = x_{3}^{2} - 2x_{2}x_{3} + x_{2}^{2} + y_{3}^2 - 2y_{2}y_{3} + y_2{^2} - \delta^2 = 0[/tex]

So the Jacobian [tex]J_i = \frac{\partial C}{\partial q_{i}}[/tex] is

[tex]J=[ 0, 0, 2x_{2}-2x_{3}, 2y_{2}-2y{3}, 2x_{3}-2x_{2}, 2y_{3}-2y{2} ][/tex]
and we can remove the spurious 2's to get

[tex]J=[ 0, 0, x_{2}-x_{3}, y_{2}-y_{3}, x_{3}-x_{2}, y_{3}-y_{2} ][/tex]


For the second constraint in 2d (collinear), I used equivalent slopes:

[tex]\frac{y_{\alpha}}{x_{\alpha}} = \frac{y_{\beta}}{x_{\beta}}[/tex]

[tex]C=y_{\alpha}x_{\beta}-y_{\beta}x_{\alpha} = 0[/tex]

[tex]C=(y_{3}-y_{2})(x_{2}-x_{1}) - (y_{2}-y_{1})(x_{3}-x_{2})[/tex]

[tex]C=y_{3}x_{2}-y_{3}x_{1}-y_{2}x_{2}+y_{2}x_{1}-y_{2}x_{3}+y_{2}x_{2}+y_{1}x_{3}+y_{1}x_{2}[/tex]

and so the Jacobian is

[tex]J=[y_{2}-y_{3}, x_{3}-x_{2}, y_{3}-y_{1}, x_{1}-x_{3}, y_{1}-y_{2}, x_{2}-x_{1}][/tex]

(hopefully I've transcribed all that correctly). Okay--so far in 2d, all this works beautifully.

...(continued)
 
Physics news on Phys.org
  • #2

The Attempt at a Solution



In 3d, things start going wrong. We can basically extend constraint (1) fairly trivially:

[tex]J=[ 0, 0, 0, x_{2}-x_{3}, y_{2}-y_{3}, z_{2}-z_{3}, x_{3}-x_2, y_3-y_2, z_3-z_2][/tex]

...but the collinear constraint is trickier (to me). So far my attempts have centred around treating the problem as if we were constraining the spherical coordinates [tex]\theta[/tex] and [tex]\phi[/tex], since we can use the 2d "slope" constraint as our [tex]\theta[/tex] constraint, since it works and doesn't depend on z at all:

[tex]J=[y_{2}-y_{3}, x_{3}-x_{2}, 0, y_{3}-y_{1}, x_{1}-x_{3}, 0, y_{1}-y_{2}, x_{2}-x_{1}, 0][/tex]

Things go wrong when I attempt to add a third constraint for [tex]\phi[/tex]. Attempts to do variations of [tex]z_{23}/r_{23}=z_{12}/r_{12}[/tex] fail--at best merely failing to constrain [tex]\phi[/tex] properly (at which point the two rods begin flexing like mad, which does interesting but nonphysical things to the simulation), and at worst interfering with the other constraints (in one case forcing the rods to elongate beyond the bounds of the simulation).

I'm not certain I understand what's going on. My best guess is that attempting to constrain it with separate constraints for [tex]\theta[/tex] and [tex]\phi[/tex] in cartesian coordinates is overconstraining the cartesian coords and going unstable. I'd like to find a nice way to either phrase it as one constraint equation or as three fairly independent ones. But I can't seem to manage it; I keep thinking in circles. Any good ideas?

Since this is an iterative computer simulation, keeping everything in cartesian is pretty much a must (there's a bunch of matrix math going on). Been hammering at this a while with no good results. The 3d version works just fine as long as everything is coplanar in z, but any variation in z makes it go berserk.

I even briefly tried leveraging [tex]A\cdotB=AB\cos\theta[/tex], setting [tex]\theta=0[/tex] to try and put everything on one constraint, which was almost interesting but since the Jacobian evaluated to zeros during the simulation turned out to be unuseful.
 
Last edited:

FAQ: Lagrange-multiplier constraint for collinear beads in 3d?

What is the Lagrange-multiplier constraint for collinear beads in 3d?

The Lagrange-multiplier constraint for collinear beads in 3d is a mathematical method used to solve optimization problems where the variables are subject to a constraint that they must lie on a straight line in three-dimensional space.

How is the Lagrange-multiplier constraint applied?

The Lagrange-multiplier constraint is applied by introducing a new variable, known as a Lagrange multiplier, into the equation. This multiplier acts as a penalty term that adjusts the objective function to satisfy the constraint.

What are the advantages of using the Lagrange-multiplier constraint?

One advantage of using the Lagrange-multiplier constraint is that it allows for the incorporation of constraints into the objective function without altering the optimization method. It also simplifies the optimization problem by reducing the number of variables.

Can the Lagrange-multiplier constraint be used for non-linear constraints?

Yes, the Lagrange-multiplier constraint can be used for both linear and non-linear constraints. It is a versatile method that can handle a wide range of constraints.

Are there any limitations to using the Lagrange-multiplier constraint?

One limitation of the Lagrange-multiplier constraint is that it may not always converge to the optimal solution. In some cases, it may also introduce additional complexity to the optimization problem. Additionally, the Lagrange multiplier must be chosen carefully to avoid numerical instabilities.

Similar threads

Replies
1
Views
2K
Replies
12
Views
2K
Replies
2
Views
2K
Replies
6
Views
3K
Replies
1
Views
964
Replies
3
Views
1K
Back
Top