# siconos.kernel.LagrangianR (Python class)¶

class siconos.kernel.LagrangianR(lagType: RELATION::SUBTYPES)[source]

Bases: siconos.kernel.Relation

Lagrangian (Non Linear) Relation (generic interface)

Relations for Lagrangian Dynamical Systems. This class is only an interface for specific (Linear, scleronomic, rheomomic …) Lagrangian Relations (see derived classes).

Class name = type+subType.

If $$y = h(t,q,\dot q,\ldots)$$ describes the constraint (the relation) , all the gradients of h are handled by the following SimpleMatrix and SiconosVector objects.

• The Jacobian of the constraints with respect to the coodinates $$q$$

i.e. $$\nabla^T_q h(t,q,\dot q,\ldots)$$ is stored in SP::SimpleMatrix _jachq .

This Jacobian is mainly used for Newton linearization and to compute the time- derivative of the constraint $$y = h(q,\ldots)$$ that is $$\dot y (t) = \nabla^T_q h(t,q,\dot q,\ldots) (q) \dot q +\ldots$$ This object can also store more general linearized part of the gap function. If $$y=h(q)$$ models a gap function, then the time–derivative can be generically written as $$\dot y (t) = H(q,\ldots) \dot q +\ldots.$$ The matrix $$H(q,\ldots)$$ is also stored in SP::SimpleMatrix _jachq

• The Jacobian of the constraints with respect to the generalized velocities $$\dot q$$ i.e. $$\nabla^\top_{\dot q} h(t,q,\dot q,\ldots)$$ is stored in SP::SimpleMatrix _jachqDot
• The time-derivative of Jacobian of the constraints with respect to the generalized coordinates $$q$$ i.e. $$\frac{d}{dt} \nabla^\top_{q} h(t,q,\dot q,\ldots).$$. This value is useful to compute the second-order time–derivative of the constraints with respect to time.

In corresponding derived classes, h and Jacobians are connected to plug-in functions (user-defined).

Generated class (swig), based on C++ header Program listing for file kernel/src/modelingTools/LagrangianR.hpp.

C() -> array_like (np.float64, 2D)[source]
checkSize(inter: Interaction) → void[source]

checkSize(Interaction inter)=0 -> None

check sizes of the relation specific operators.

Parameters: inter – an Interaction using this relation
computeJacg(time: double, inter: Interaction) → void[source]

computeJacg(double time, Interaction inter)=0 -> None

computeJach(time: double, inter: Interaction) → void[source]

computeJach(double time, Interaction inter)=0 -> None

compute all the H Jacobian

Parameters: time – the current time inter – the interaction using this relation
display() → None[source]

main relation members display

dotJachq() -> array_like (np.float64, 2D)[source]
initialize(Interaction inter) → None[source]

initialize components specific to derived classes.

Parameters: inter – the interaction using this relation
jachlambda() -> array_like (np.float64, 2D)[source]
jachq() -> array_like (np.float64, 2D)[source]

get a pointer on matrix Jach[index]

Returns: a pointer on a SimpleMatrix
jachqDot() -> array_like (np.float64, 2D)[source]
setJachqPtr(array_like (np.float64, 2D) newPtr) → None[source]

set Jach[index] to pointer newPtr (pointer link)

Parameters: newPtr – the new matrix