# Class LagrangianR¶

class LagrangianR : public 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 timederivative 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 timederivative of the constraints with respect to time.

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

Public Functions

virtual ~LagrangianR()

destructor

virtual void checkSize(Interaction &inter) = 0

check sizes of the relation specific operators.

Parameters
• inter: an Interaction using this relation

virtual void computeJach(double time, Interaction &inter) = 0

compute all the H Jacobian

Parameters
• time: the current time

• inter: the interaction using this relation

void display() const

main relation members display

virtual void initialize(Interaction &inter)

initialize components specific to derived classes.

Parameters
• inter: the interaction using this relation

SP::SimpleMatrix jachq() const

get a pointer on matrix Jach[index]

Return

a pointer on a SimpleMatrix

void setJachqPtr(SP::SimpleMatrix newPtr)

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

Parameters
• newPtr: the new matrix