ó
    ˆ*£hl  ã                   ón   • S r SSKJr  SSKJrJrJr  SSKJr  SSK	J
r
  SSKJr  SSKJr  SSKJr  SS	 jrg
)zX
This module implements a method to find
Euler-Lagrange Equations for given Lagrangian.
é    )Úcombinations_with_replacement)Ú
DerivativeÚFunctionÚdiff)ÚEq)ÚS)ÚSymbol©Úsympify)Úiterablec                 ó  • [        U5      (       a  [        U5      OU4nU(       d  [        U R                  [        5      5      nO,U H&  n[	        U[        5      (       a  M  [        SU-  5      e   [        U5      (       a  [        U5      OU4nU(       d  US   R                  nO[        S U 5       5      n[        S U 5       5      (       d  [        SU-  5      eU H%  nX#R                  :X  a  M  [        SU< SU< 35      e   [        U R                  [        5       Vs/ s H*  nUR                  U;   d  M  [        UR                  5      PM,     snS/-   5      n/ nU H˜  n[        X5      n[        SUS-   5       HC  n[!        X(5       H1  n	U["        R$                  U-  [        U [        U/U	Q76 /U	Q76 -  -   nM3     ME     ['        US5      n
[	        U
[&        5      (       d  M‡  UR)                  U
5        Mš     U$ s  snf )	a‘  
Find the Euler-Lagrange equations [1]_ for a given Lagrangian.

Parameters
==========

L : Expr
    The Lagrangian that should be a function of the functions listed
    in the second argument and their derivatives.

    For example, in the case of two functions $f(x,y)$, $g(x,y)$ and
    two independent variables $x$, $y$ the Lagrangian has the form:

        .. math:: L\left(f(x,y),g(x,y),\frac{\partial f(x,y)}{\partial x},
                  \frac{\partial f(x,y)}{\partial y},
                  \frac{\partial g(x,y)}{\partial x},
                  \frac{\partial g(x,y)}{\partial y},x,y\right)

    In many cases it is not necessary to provide anything, except the
    Lagrangian, it will be auto-detected (and an error raised if this
    cannot be done).

funcs : Function or an iterable of Functions
    The functions that the Lagrangian depends on. The Euler equations
    are differential equations for each of these functions.

vars : Symbol or an iterable of Symbols
    The Symbols that are the independent variables of the functions.

Returns
=======

eqns : list of Eq
    The list of differential equations, one for each function.

Examples
========

>>> from sympy import euler_equations, Symbol, Function
>>> x = Function('x')
>>> t = Symbol('t')
>>> L = (x(t).diff(t))**2/2 - x(t)**2/2
>>> euler_equations(L, x(t), t)
[Eq(-x(t) - Derivative(x(t), (t, 2)), 0)]
>>> u = Function('u')
>>> x = Symbol('x')
>>> L = (u(t, x).diff(t))**2/2 - (u(t, x).diff(x))**2/2
>>> euler_equations(L, u(t, x), [t, x])
[Eq(-Derivative(u(t, x), (t, 2)) + Derivative(u(t, x), (x, 2)), 0)]

References
==========

.. [1] https://en.wikipedia.org/wiki/Euler%E2%80%93Lagrange_equation

zFunction expected, got: %sr   c              3   ó8   #   • U  H  n[        U5      v •  M     g 7f©Nr
   )Ú.0Úvars     ÚQ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sympy/calculus/euler.pyÚ	<genexpr>Ú"euler_equations.<locals>.<genexpr>V   s   é € Ð2ªT c”W˜S—\�\ªTùs   ‚c              3   óB   #   • U  H  n[        U[        5      v •  M     g 7fr   )Ú
isinstancer	   )r   Úvs     r   r   r   X   s   é € Ð3ªd¨Œz˜!œV×$Ð$ªdùs   ‚z!Variables are not symbols, got %sz
Variables z do not match args: é   )r   ÚtupleÚatomsr   r   Ú	TypeErrorÚargsÚallÚ
ValueErrorÚmaxr   ÚexprÚlenÚ	variablesr   Úranger   r   ÚNegativeOner   Úappend)ÚLÚfuncsÚvarsÚfÚdÚorderÚeqnsÚeqÚiÚpÚnew_eqs              r   Úeuler_equationsr1      s¿  € ôt % UŸO™OŒE�%ŒL°%°€EæÜ�a—g‘gœhÓ'Ó(‰ãˆAÜ˜a¤×*Ó*ÜÐ <¸qÑ @ÓAÐAñ ô # 4Ÿ.™.Œ5�Œ;¨t¨g€DæØ�Q‰x�}‰}‰äÑ2©TÓ2Ó2ˆäÑ3©dÓ3×3Ñ3ÜÐ;¸dÑBÓCÐCãˆØ—v‘v�~ÝÃTÊ1ÐMÓNÐNñ ô ¨1¯7©7´:Ô+>ó ,Ò+> aØŸ6™6 U™?ó "”�Q—[‘[Ö!Ñ+>ñ ,Ø/0¨cñ2ó 3€Eð €DÛˆÜ�!‹ZˆÜ�q˜% !™)Ö$ˆAÜ2°4Ö;�Øœ!Ÿ-™-¨Ñ*¬4°´4¸°;¸A²;Ð+CÀÒ+CÑCÑC’ó <ñ %ô �B˜“ˆÜ�fœb×!Ó!Ø�K‰K˜Öñ ð €Kùò,s   Ä$HÄ<HN)© r2   )Ú__doc__Ú	itertoolsr   Úsympy.core.functionr   r   r   Úsympy.core.relationalr   Úsympy.core.singletonr   Úsympy.core.symbolr	   Úsympy.core.sympifyr   Úsympy.utilities.iterablesr   r1   r2   ó    r   Ú<module>r<      s*   ðñõ 4ß <Ñ <Ý $Ý "Ý $Ý &Ý .õ^r;   