+
    ‹°³jýv  ã                  óØ  € ^ RI Ht ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHtHt ^ RIHt ^ R	IHt ^ R
IHt ^RIHt ^RIHtHt ^RIHt ^RIHtHt ^RIHtH t  R1R./t!R t" ! R R]4      t#R t$ ! R R]#]4      t%]%;t&t'](3R lt)](3R lt*R2R lt+R t,R t-R t.R t/R t0R t1]! R3R 7      R! 4       t2R4R# lt3R$ t4R%R"R&R'/R( lt5R5R) lt6R6R* lt7R+ t8R, t9R- t:R7R. lt;R8R/ lt<R0 t=R# )9é    )ÚannotationsN)ÚBasic)ÚS)ÚSymbol)Úsympify)ÚcosÚsin)Údoctest_depends_on)Úsympy_deprecation_warning)Úis_sequence)Ú
ShapeError)Ú	_choleskyÚ_LDLdecomposition)Ú
MatrixBase)ÚMutableRepMatrixÚ	RepMatrix)Ú_lower_triangular_solveÚ_upper_triangular_solveÚnumpyc                ó   € V P                   # )zReturns True if x is zero.)Úis_zero)Úxs   &ÚU/home/luca/screen-checking/.venv/lib/python3.14/site-packages/sympy/matrices/dense.pyÚ_iszeror      s   € à�9‰9Ðó    c                  óü   € ] tR t^t$ RtRtR]R&   Rt^t]	R 4       t
R tR tR	 tRR
 ltRR ltR tR t]P                  ]n        ]P                  ]n        ]P                  ]n        ]P                  ]n        RtR# )ÚDenseMatrixzJMatrix implementation based on DomainMatrix as the internal representationFÚboolÚis_MatrixExprg…ëQ¸$@c                	ó>   € \        R RRR7       V P                  4       # )zy
            The private _mat attribute of Matrix is deprecated. Use the
            .flat() method instead.
            z1.9z$deprecated-private-matrix-attributes)Údeprecated_since_versionÚactive_deprecations_target)r   Úflat©Úselfs   &r   Ú_matÚDenseMatrix._mat*   s%   € ä!ðð &+Ø'Mõ	
ð �y‰y‹{Ðr   c                	ó’   € V P                  VP                  R R4      VP                  R\        4      VP                  RR4      R7      # )ÚmethodÚGEÚ
iszerofuncÚtry_block_diagF)r)   r+   r,   )ÚinvÚgetr   )r%   Úkwargss   &,r   Ú_eval_inverseÚDenseMatrix._eval_inverse7   sD   € Ø�x‰x˜vŸz™z¨(°DÓ9Ø#)§:¡:¨l¼GÓ#DØ'-§z¡zÐ2BÀEÓ'Jð ó Lð 	Lr   c                ó`   € ^RI Hp VP                  V P                  P	                  4       4      # )z4Returns an Immutable version of this Matrix
        )ÚImmutableDenseMatrix)Ú	immutabler3   Ú_fromrepÚ_repÚcopy)r%   Úclss   & r   Úas_immutableÚDenseMatrix.as_immutable<   s!   € õ 	;Ø�|‰|˜DŸI™IŸN™NÓ,Ó-Ð-r   c                ó   € \        V 4      # )zêReturns a mutable version of this matrix

Examples
========

>>> from sympy import ImmutableMatrix
>>> X = ImmutableMatrix([[1, 2], [3, 4]])
>>> Y = X.as_mutable()
>>> Y[1, 1] = 5 # Can set values in Y
>>> Y
Matrix([
[1, 2],
[3, 5]])
)ÚMatrixr$   s   &r   Ú
as_mutableÚDenseMatrix.as_mutableB   s   € ô �d‹|Ðr   c                	ó   € \        WR 7      # ©)Ú	hermitian)r   ©r%   rA   s   &&r   ÚcholeskyÚDenseMatrix.choleskyS   s   € Ü˜Ô3Ð3r   c                	ó   € \        WR 7      # r@   )r   rB   s   &&r   ÚLDLdecompositionÚDenseMatrix.LDLdecompositionV   s   € Ü  Ô;Ð;r   c                	ó   € \        W4      # ©N)r   ©r%   Úrhss   &&r   Úlower_triangular_solveÚ"DenseMatrix.lower_triangular_solveY   ó   € Ü& tÓ1Ð1r   c                	ó   € \        W4      # rI   )r   rJ   s   &&r   Úupper_triangular_solveÚ"DenseMatrix.upper_triangular_solve\   rN   r   © N©T)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__Ú_op_priorityÚ_class_priorityÚpropertyr&   r0   r9   r=   rC   rF   rL   rP   r   r   r   r   Ú__static_attributes__rR   r   r   r   r      s‘   ‡ ÙTð  €M�4Óà€LØ€Oàñ
ó ð
òLò
.òô"4ô<ò2ò2ð &/×%6Ñ%6€HÔØ%6×%>Ñ%>ÐÔØ%<×%DÑ%DÐÔ"Ø%<×%DÑ%DÐ×"Ð"r   r   c                ó   € \        V RR4      '       d   V P                  4       # \        V \        4      '       d   V # \	        V R4      '       dA   V P                  4       p\        VP                  4      ^ 8X  d   \        V4      # \        V 4      # V # )z0Return a matrix as a Matrix, otherwise return x.Ú	is_MatrixFÚ	__array__)
Úgetattrr=   Ú
isinstancer   Úhasattrr`   ÚlenÚshaper   r<   )r   Úas   & r   Ú_force_mutablerg   e   sp   € äˆq�+˜u×%Ò%Ø�|‰|‹~ÐÜ	�A”u×	Ò	ØˆÜ	��K×	 Ò	 Ø�K‰K‹MˆÜˆq�w‰w‹<˜1ÔÜ˜1“:ÐÜ�a‹yÐØ€Hr   c                  ó   € ] tR t^stR tRtR# )ÚMutableDenseMatrixc                ó€   € ^ RI Hp V P                  4       P                  4        F  w  w  r4pV! V3/ VB WV3&   K  	  R# )z·Applies simplify to the elements of a matrix in place.

This is a shortcut for M.applyfunc(lambda x: simplify(x, ratio, measure))

See Also
========

sympy.simplify.simplify.simplify
)ÚsimplifyN)Úsympy.simplify.simplifyrk   ÚtodokÚitems)r%   r/   Ú	_simplifyÚiÚjÚelements   &,    r   rk   ÚMutableDenseMatrix.simplifyu   s<   € õ 	BØ#Ÿz™z›|×1Ñ1Ö3‰O‰FˆQ�GÙ" 7Ñ5¨fÑ5ˆD�A�‹Jó  4r   rR   N)rT   rU   rV   rW   rk   r]   rR   r   r   ri   ri   s   s   † ö6r   ri   c                óf   € ^ RI Hp V! \        V 4      V4      p\        V 4       F	  w  rEWSV&   K  	  V# )z]Converts Python list of SymPy expressions to a NumPy array.

See Also
========

matrix2numpy
©Úempty)r   rv   rd   Ú	enumerate)ÚlÚdtyperv   rf   rp   Úss   &&    r   Ú
list2numpyr{   Œ   s3   € õ ÙŒc�!‹f�eÓ€AÜ˜!–‰ˆØˆ!‹ñ à€Hr   c                óÄ   € ^ RI Hp V! V P                  V4      p\        V P                  4       F-  p\        V P
                  4       F  pWV3,          W4V3&   K  	  K/  	  V# )zIConverts SymPy's matrix to a NumPy array.

See Also
========

list2numpy
ru   )r   rv   re   ÚrangeÚrowsÚcols)Úmry   rv   rf   rp   rq   s   &&    r   Úmatrix2numpyr�   ›   sS   € õ Ùˆa�g‰g�uÓ€AÜ�1—6‘6Ž]ˆÜ�q—v‘v–ˆAØ˜1˜•gˆA�ˆd‹Gó ñ ð €Hr   c                óä  € \        V\        4      '       d   V^8  d   \        RP                  V4      4      hW8X  d   \        RP                  W4      4      hW3 FO  p\        V\        4      '       d   V^ 8  g   WC^,
          8”  g   K/  \        RP                  V^,
          W4      4      h	  \	        V4      p\        V4      p\        V4      p\        V4      pWWW 3&   WWW3&   WgW3&   V) WqV 3&   V# )aµ
  Returns a a Givens rotation matrix, a a rotation in the
plane spanned by two coordinates axes.

Explanation
===========

The Givens rotation corresponds to a generalization of rotation
matrices to any number of dimensions, given by:

.. math::
    G(i, j, \theta) =
        \begin{bmatrix}
            1   & \cdots &    0   & \cdots &    0   & \cdots &    0   \\
            \vdots & \ddots & \vdots &        & \vdots &        & \vdots \\
            0   & \cdots &    c   & \cdots &   -s   & \cdots &    0   \\
            \vdots &        & \vdots & \ddots & \vdots &        & \vdots \\
            0   & \cdots &    s   & \cdots &    c   & \cdots &    0   \\
            \vdots &        & \vdots &        & \vdots & \ddots & \vdots \\
            0   & \cdots &    0   & \cdots &    0   & \cdots &    1
        \end{bmatrix}

Where $c = \cos(\theta)$ and $s = \sin(\theta)$ appear at the intersections
``i``\th and ``j``\th rows and columns.

For fixed ``i > j``\, the non-zero elements of a Givens matrix are
given by:

- $g_{kk} = 1$ for $k \ne i,\,j$
- $g_{kk} = c$ for $k = i,\,j$
- $g_{ji} = -g_{ij} = -s$

Parameters
==========

i : int between ``0`` and ``dim - 1``
    Represents first axis
j : int between ``0`` and ``dim - 1``
    Represents second axis
dim : int bigger than 1
    Number of dimensions. Defaults to 3.

Examples
========

>>> from sympy import pi, rot_givens

A counterclockwise rotation of pi/3 (60 degrees) around
the third axis (z-axis):

>>> rot_givens(1, 0, pi/3)
Matrix([
[      1/2, -sqrt(3)/2, 0],
[sqrt(3)/2,        1/2, 0],
[        0,          0, 1]])

If we rotate by pi/2 (90 degrees):

>>> rot_givens(1, 0, pi/2)
Matrix([
[0, -1, 0],
[1,  0, 0],
[0,  0, 1]])

This can be generalized to any number
of dimensions:

>>> rot_givens(1, 0, pi/2, dim=4)
Matrix([
[0, -1, 0, 0],
[1,  0, 0, 0],
[0,  0, 1, 0],
[0,  0, 0, 1]])

References
==========

.. [1] https://en.wikipedia.org/wiki/Givens_rotation

See Also
========

rot_axis1: Returns a rotation matrix for a rotation of theta (in radians)
    about the 1-axis (clockwise around the x axis)
rot_axis2: Returns a rotation matrix for a rotation of theta (in radians)
    about the 2-axis (clockwise around the y axis)
rot_axis3: Returns a rotation matrix for a rotation of theta (in radians)
    about the 3-axis (clockwise around the z axis)
rot_ccw_axis1: Returns a rotation matrix for a rotation of theta (in radians)
    about the 1-axis (counterclockwise around the x axis)
rot_ccw_axis2: Returns a rotation matrix for a rotation of theta (in radians)
    about the 2-axis (counterclockwise around the y axis)
rot_ccw_axis3: Returns a rotation matrix for a rotation of theta (in radians)
    about the 3-axis (counterclockwise around the z axis)
z/dim must be an integer biggen than one, got {}.z'i and j must be different, got ({}, {})z=i and j must be integers between 0 and {}, got i={} and j={}.)rb   ÚintÚ
ValueErrorÚformatr   r   r	   Úeye)rp   rq   ÚthetaÚdimÚijÚcrz   ÚMs   &&&&    r   Ú
rot_givensrŒ   ±   sõ   € ô~ �cœ3×Ò 3¨¤7Üð #ß#)¡6¨#£;ó0ð 	0ð 	„vÜð (ß(.©¨q«ó6ð 	6ð ‹fˆÜ˜"œc×"Ò" b¨1¤f°¸1µW¶Üð 6ß6<±f¸SÀ½UÀAÓ6IóKð Kñ ô
 �E‹N€EÜˆE‹
€AÜˆE‹
€AÜˆC‹€AØ€a€d�GØ€a€d�GØ€a€d�GØˆb€Aˆ€d�GØ€Hr   c                ó    € \        ^ ^V ^R7      # )aâ  Returns a rotation matrix for a rotation of theta (in radians)
about the 3-axis.

Explanation
===========

For a right-handed coordinate system, this corresponds to a
clockwise rotation around the `z`-axis, given by:

.. math::

    R  = \begin{bmatrix}
             \cos(\theta) & \sin(\theta) & 0 \\
            -\sin(\theta) & \cos(\theta) & 0 \\
                        0 &            0 & 1
        \end{bmatrix}

Examples
========

>>> from sympy import pi, rot_axis3

A rotation of pi/3 (60 degrees):

>>> theta = pi/3
>>> rot_axis3(theta)
Matrix([
[       1/2, sqrt(3)/2, 0],
[-sqrt(3)/2,       1/2, 0],
[         0,         0, 1]])

If we rotate by pi/2 (90 degrees):

>>> rot_axis3(pi/2)
Matrix([
[ 0, 1, 0],
[-1, 0, 0],
[ 0, 0, 1]])

See Also
========

rot_givens: Returns a Givens rotation matrix (generalized rotation for
    any number of dimensions)
rot_ccw_axis3: Returns a rotation matrix for a rotation of theta (in radians)
    about the 3-axis (counterclockwise around the z axis)
rot_axis1: Returns a rotation matrix for a rotation of theta (in radians)
    about the 1-axis (clockwise around the x axis)
rot_axis2: Returns a rotation matrix for a rotation of theta (in radians)
    about the 2-axis (clockwise around the y axis)
©rˆ   ©rŒ   ©r‡   s   &r   Ú	rot_axis3r‘   (  ó   € ôh �a˜˜E qÔ)Ð)r   c                ó    € \        ^^ V ^R7      # )aé  Returns a rotation matrix for a rotation of theta (in radians)
about the 2-axis.

Explanation
===========

For a right-handed coordinate system, this corresponds to a
clockwise rotation around the `y`-axis, given by:

.. math::

    R  = \begin{bmatrix}
            \cos(\theta) & 0 & -\sin(\theta) \\
                       0 & 1 &             0 \\
            \sin(\theta) & 0 &  \cos(\theta)
        \end{bmatrix}

Examples
========

>>> from sympy import pi, rot_axis2

A rotation of pi/3 (60 degrees):

>>> theta = pi/3
>>> rot_axis2(theta)
Matrix([
[      1/2, 0, -sqrt(3)/2],
[        0, 1,          0],
[sqrt(3)/2, 0,        1/2]])

If we rotate by pi/2 (90 degrees):

>>> rot_axis2(pi/2)
Matrix([
[0, 0, -1],
[0, 1,  0],
[1, 0,  0]])

See Also
========

rot_givens: Returns a Givens rotation matrix (generalized rotation for
    any number of dimensions)
rot_ccw_axis2: Returns a rotation matrix for a rotation of theta (in radians)
    about the 2-axis (clockwise around the y axis)
rot_axis1: Returns a rotation matrix for a rotation of theta (in radians)
    about the 1-axis (counterclockwise around the x axis)
rot_axis3: Returns a rotation matrix for a rotation of theta (in radians)
    about the 3-axis (counterclockwise around the z axis)
rŽ   r�   r�   s   &r   Ú	rot_axis2r”   _  r’   r   c                ó    € \        ^^V ^R7      # )aâ  Returns a rotation matrix for a rotation of theta (in radians)
about the 1-axis.

Explanation
===========

For a right-handed coordinate system, this corresponds to a
clockwise rotation around the `x`-axis, given by:

.. math::

    R  = \begin{bmatrix}
            1 &             0 &            0 \\
            0 &  \cos(\theta) & \sin(\theta) \\
            0 & -\sin(\theta) & \cos(\theta)
        \end{bmatrix}

Examples
========

>>> from sympy import pi, rot_axis1

A rotation of pi/3 (60 degrees):

>>> theta = pi/3
>>> rot_axis1(theta)
Matrix([
[1,          0,         0],
[0,        1/2, sqrt(3)/2],
[0, -sqrt(3)/2,       1/2]])

If we rotate by pi/2 (90 degrees):

>>> rot_axis1(pi/2)
Matrix([
[1,  0, 0],
[0,  0, 1],
[0, -1, 0]])

See Also
========

rot_givens: Returns a Givens rotation matrix (generalized rotation for
    any number of dimensions)
rot_ccw_axis1: Returns a rotation matrix for a rotation of theta (in radians)
    about the 1-axis (counterclockwise around the x axis)
rot_axis2: Returns a rotation matrix for a rotation of theta (in radians)
    about the 2-axis (clockwise around the y axis)
rot_axis3: Returns a rotation matrix for a rotation of theta (in radians)
    about the 3-axis (clockwise around the z axis)
rŽ   r�   r�   s   &r   Ú	rot_axis1r–   –  r’   r   c                ó    € \        ^^ V ^R7      # )a   Returns a rotation matrix for a rotation of theta (in radians)
about the 3-axis.

Explanation
===========

For a right-handed coordinate system, this corresponds to a
counterclockwise rotation around the `z`-axis, given by:

.. math::

    R  = \begin{bmatrix}
            \cos(\theta) & -\sin(\theta) & 0 \\
            \sin(\theta) &  \cos(\theta) & 0 \\
                       0 &             0 & 1
        \end{bmatrix}

Examples
========

>>> from sympy import pi, rot_ccw_axis3

A rotation of pi/3 (60 degrees):

>>> theta = pi/3
>>> rot_ccw_axis3(theta)
Matrix([
[      1/2, -sqrt(3)/2, 0],
[sqrt(3)/2,        1/2, 0],
[        0,          0, 1]])

If we rotate by pi/2 (90 degrees):

>>> rot_ccw_axis3(pi/2)
Matrix([
[0, -1, 0],
[1,  0, 0],
[0,  0, 1]])

See Also
========

rot_givens: Returns a Givens rotation matrix (generalized rotation for
    any number of dimensions)
rot_axis3: Returns a rotation matrix for a rotation of theta (in radians)
    about the 3-axis (clockwise around the z axis)
rot_ccw_axis1: Returns a rotation matrix for a rotation of theta (in radians)
    about the 1-axis (counterclockwise around the x axis)
rot_ccw_axis2: Returns a rotation matrix for a rotation of theta (in radians)
    about the 2-axis (counterclockwise around the y axis)
rŽ   r�   r�   s   &r   Úrot_ccw_axis3r˜   Í  r’   r   c                ó    € \        ^ ^V ^R7      # )a  Returns a rotation matrix for a rotation of theta (in radians)
about the 2-axis.

Explanation
===========

For a right-handed coordinate system, this corresponds to a
counterclockwise rotation around the `y`-axis, given by:

.. math::

    R  = \begin{bmatrix}
             \cos(\theta) & 0 & \sin(\theta) \\
                        0 & 1 &            0 \\
            -\sin(\theta) & 0 & \cos(\theta)
        \end{bmatrix}

Examples
========

>>> from sympy import pi, rot_ccw_axis2

A rotation of pi/3 (60 degrees):

>>> theta = pi/3
>>> rot_ccw_axis2(theta)
Matrix([
[       1/2, 0, sqrt(3)/2],
[         0, 1,         0],
[-sqrt(3)/2, 0,       1/2]])

If we rotate by pi/2 (90 degrees):

>>> rot_ccw_axis2(pi/2)
Matrix([
[ 0,  0,  1],
[ 0,  1,  0],
[-1,  0,  0]])

See Also
========

rot_givens: Returns a Givens rotation matrix (generalized rotation for
    any number of dimensions)
rot_axis2: Returns a rotation matrix for a rotation of theta (in radians)
    about the 2-axis (clockwise around the y axis)
rot_ccw_axis1: Returns a rotation matrix for a rotation of theta (in radians)
    about the 1-axis (counterclockwise around the x axis)
rot_ccw_axis3: Returns a rotation matrix for a rotation of theta (in radians)
    about the 3-axis (counterclockwise around the z axis)
rŽ   r�   r�   s   &r   Úrot_ccw_axis2rš     r’   r   c                ó    € \        ^^V ^R7      # )a   Returns a rotation matrix for a rotation of theta (in radians)
about the 1-axis.

Explanation
===========

For a right-handed coordinate system, this corresponds to a
counterclockwise rotation around the `x`-axis, given by:

.. math::

    R  = \begin{bmatrix}
            1 &            0 &             0 \\
            0 & \cos(\theta) & -\sin(\theta) \\
            0 & \sin(\theta) &  \cos(\theta)
        \end{bmatrix}

Examples
========

>>> from sympy import pi, rot_ccw_axis1

A rotation of pi/3 (60 degrees):

>>> theta = pi/3
>>> rot_ccw_axis1(theta)
Matrix([
[1,         0,          0],
[0,       1/2, -sqrt(3)/2],
[0, sqrt(3)/2,        1/2]])

If we rotate by pi/2 (90 degrees):

>>> rot_ccw_axis1(pi/2)
Matrix([
[1, 0,  0],
[0, 0, -1],
[0, 1,  0]])

See Also
========

rot_givens: Returns a Givens rotation matrix (generalized rotation for
    any number of dimensions)
rot_axis1: Returns a rotation matrix for a rotation of theta (in radians)
    about the 1-axis (clockwise around the x axis)
rot_ccw_axis2: Returns a rotation matrix for a rotation of theta (in radians)
    about the 2-axis (counterclockwise around the y axis)
rot_ccw_axis3: Returns a rotation matrix for a rotation of theta (in radians)
    about the 3-axis (counterclockwise around the z axis)
rŽ   r�   r�   s   &r   Úrot_ccw_axis1rœ   ;  r’   r   )Úmodulesc                ó´   € ^ RI HpHp V! V\        R7      pV! V4       F5  p\	        V : RRP                  \        \        V4      4      : 23/ VB WV&   K7  	  V# )a�  Create a numpy ndarray of symbols (as an object array).

The created symbols are named ``prefix_i1_i2_``...  You should thus provide a
non-empty prefix if you want your symbols to be unique for different output
arrays, as SymPy symbols with identical names are the same object.

Parameters
----------

prefix : string
  A prefix prepended to the name of every symbol.

shape : int or tuple
  Shape of the created array.  If an int, the array is one-dimensional; for
  more than one dimension the shape must be a tuple.

\*\*kwargs : dict
  keyword arguments passed on to Symbol

Examples
========
These doctests require numpy.

>>> from sympy import symarray
>>> symarray('', 3)
[_0 _1 _2]

If you want multiple symarrays to contain distinct symbols, you *must*
provide unique prefixes:

>>> a = symarray('', 3)
>>> b = symarray('', 3)
>>> a[0] == b[0]
True
>>> a = symarray('a', 3)
>>> b = symarray('b', 3)
>>> a[0] == b[0]
False

Creating symarrays with a prefix:

>>> symarray('a', 3)
[a_0 a_1 a_2]

For more than one dimension, the shape must be given as a tuple:

>>> symarray('a', (2, 3))
[[a_0_0 a_0_1 a_0_2]
 [a_1_0 a_1_1 a_1_2]]
>>> symarray('a', (2, 3, 2))
[[[a_0_0_0 a_0_0_1]
  [a_0_1_0 a_0_1_1]
  [a_0_2_0 a_0_2_1]]
<BLANKLINE>
 [[a_1_0_0 a_1_0_1]
  [a_1_1_0 a_1_1_1]
  [a_1_2_0 a_1_2_1]]]

For setting assumptions of the underlying Symbols:

>>> [s.is_real for s in symarray('a', 2, real=True)]
[True, True]
)rv   Úndindex)ry   Ú_)r   rv   rŸ   Úobjectr   ÚjoinÚmapÚstr)Úprefixre   r/   rv   rŸ   ÚarrÚindexs   &&,    r   Úsymarrayr¨   r  sS   € ÷B %Ù
�œVÔ
$€CÙ˜–ˆÜ£v¨s¯x©x¼¼CÀ»Õ/HÐIñ &Ø$ñ&ˆ‹
ñ  ð €Jr   Tc                ó°   a a€ \        \        \        S 4      4      o V'       g	   VV 3R lpMVV 3R lp\        S 4      p\	        WDV4      P                  4       # )aÐ  Given linear difference operator L of order 'k' and homogeneous
equation Ly = 0 we want to compute kernel of L, which is a set
of 'k' sequences: a(n), b(n), ... z(n).

Solutions of L are linearly independent iff their Casoratian,
denoted as C(a, b, ..., z), do not vanish for n = 0.

Casoratian is defined by k x k determinant::

           +  a(n)     b(n)     . . . z(n)     +
           |  a(n+1)   b(n+1)   . . . z(n+1)   |
           |    .         .     .        .     |
           |    .         .       .      .     |
           |    .         .         .    .     |
           +  a(n+k-1) b(n+k-1) . . . z(n+k-1) +

It proves very useful in rsolve_hyper() where it is applied
to a generating set of a recurrence to factor out linearly
dependent solutions and return a basis:

>>> from sympy import Symbol, casoratian, factorial
>>> n = Symbol('n', integer=True)

Exponential and factorial are linearly independent:

>>> casoratian([2**n, factorial(n)], n) != 0
True

c                óD   <€ SV,          P                  SSV ,           4      # rI   ©Úsubs©rp   rq   ÚnÚseqss   &&€€r   Ú<lambda>Úcasoratian.<locals>.<lambda>á  s   ø€ ˜˜a�Ÿ™ a¨¨Q­Ô/r   c                ó6   <€ SV,          P                  SV 4      # rI   r«   r­   s   &&€€r   r°   r±   ã  s   ø€ ˜˜a�Ÿ™ a¨Ô+r   )Úlistr£   r   rd   r<   Údet)r¯   r®   ÚzeroÚfÚks   ff&  r   Ú
casoratianr¸   ¿  sA   ù€ ô> ””G˜TÓ"Ó#€DçÝ/‰å+ˆäˆD‹	€Aä�!˜‹?×ÑÓ Ð r   c                 ó.   € \         P                  ! V / VB # )zHCreate square identity matrix n x n

See Also
========

diag
zeros
ones
)r<   r†   ©Úargsr/   s   *,r   r†   r†   ê  s   € ô �:Š:�tÐ&˜vÑ&Ð&r   ÚstrictÚunpackFc                ó6   € \         P                  ! VRV RV/VB # )aã  Returns a matrix with the provided values placed on the
diagonal. If non-square matrices are included, they will
produce a block-diagonal matrix.

Examples
========

This version of diag is a thin wrapper to Matrix.diag that differs
in that it treats all lists like matrices -- even when a single list
is given. If this is not desired, either put a `*` before the list or
set `unpack=True`.

>>> from sympy import diag

>>> diag([1, 2, 3], unpack=True)  # = diag(1,2,3) or diag(*[1,2,3])
Matrix([
[1, 0, 0],
[0, 2, 0],
[0, 0, 3]])

>>> diag([1, 2, 3])  # a column vector
Matrix([
[1],
[2],
[3]])

See Also
========
.matrixbase.MatrixBase.eye
.matrixbase.MatrixBase.diagonal
.matrixbase.MatrixBase.diag
.expressions.blockmatrix.BlockMatrix
r¼   r½   )r<   Údiag)r¼   r½   Úvaluesr/   s   $$*,r   r¿   r¿   ø  s#   € ôD �;Š;˜ÐG vÐG°fÐGÀÑGÐGr   c                ó2   € \         P                  ! V RVRR/ # )a¬  Apply the Gram-Schmidt process to a set of vectors.

Parameters
==========

vlist : List of Matrix
    Vectors to be orthogonalized for.

orthonormal : Bool, optional
    If true, return an orthonormal basis.

Returns
=======

vlist : List of Matrix
    Orthogonalized vectors

Notes
=====

This routine is mostly duplicate from ``Matrix.orthogonalize``,
except for some difference that this always raises error when
linearly dependent vectors are found, and the keyword ``normalize``
has been named as ``orthonormal`` in this function.

See Also
========

.matrixbase.MatrixBase.orthogonalize

References
==========

.. [1] https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process
Ú	normalizeÚ	rankcheckT)ri   Úorthogonalize)ÚvlistÚorthonormals   &&r   ÚGramSchmidtrÇ     s+   € ôH ×+Ò+Ø	ðØ%ðØ15ñð r   c                óØ  € \        V\        4      '       dQ   ^VP                  9  d   \        R4      hVP                  ^8X  d   VP
                  pVP                  4       ^ ,          p\        V4      '       d    \        V4      pV'       g   \        R4      hM\        R4      h\        V R4      '       g   \        RV ,          4      h\        V4      pWC,           p\        V4      p\        V4       F\  w  rx\        VR4      '       g   \        RV ,          4      h\        V4       F$  p	VP                  W,          4      WgW”,           3&   K&  	  K^  	  \        V4       FR  p	\        W“4       F@  p
V P                  W,          4      P                  W,          4      WiV,           W¤,           3&   KB  	  KT  	  \        V4       F+  p	\        V	^,           V4       F  p
WiV
3,          WjV	3&   K  	  K-  	  V# )a~  Compute Hessian matrix for a function f wrt parameters in varlist
which may be given as a sequence or a row/column vector. A list of
constraints may optionally be given.

Examples
========

>>> from sympy import Function, hessian, pprint
>>> from sympy.abc import x, y
>>> f = Function('f')(x, y)
>>> g1 = Function('g')(x, y)
>>> g2 = x**2 + 3*y
>>> pprint(hessian(f, (x, y), [g1, g2]))
[                   d               d            ]
[     0        0    --(g(x, y))     --(g(x, y))  ]
[                   dx              dy           ]
[                                                ]
[     0        0        2*x              3       ]
[                                                ]
[                     2               2          ]
[d                   d               d           ]
[--(g(x, y))  2*x   ---(f(x, y))   -----(f(x, y))]
[dx                   2            dy dx         ]
[                   dx                           ]
[                                                ]
[                     2               2          ]
[d                   d               d           ]
[--(g(x, y))   3   -----(f(x, y))   ---(f(x, y)) ]
[dy                dy dx              2          ]
[                                   dy           ]

References
==========

.. [1] https://en.wikipedia.org/wiki/Hessian_matrix

See Also
========

sympy.matrices.matrixbase.MatrixBase.jacobian
wronskian
z)`varlist` must be a column or row vector.z `len(varlist)` must not be zero.z*Improper variable list in hessian functionÚdiffz'Function `f` (%s) is not differentiable)rb   r   re   r   r   ÚTÚtolistr   rd   r„   ra   Úzerosrw   r}   rÉ   )r¶   ÚvarlistÚconstraintsr®   r€   ÚNÚoutr·   Úgrp   rq   s   &&&        r   ÚhessianrÒ   F  s—  € ôX �'œ:×&Ò&Ø�G—M‘MÔ!ÜÐHÓIÐIØ�<‰<˜1ÔØ—i‘iˆGØ—.‘.Ó" 1Õ%ˆÜ�7×ÒÜ�‹LˆßÜÐ?Ó@Ð@ð ô ÐEÓFÐFÜ�1�f×ÒäÐBÀQÕFÓGÐGÜˆKÓ€AØ	�€AÜ
�‹(€CÜ˜+Ö&‰ˆÜ�q˜&×!Ò!äÐFÈÕJÓKÐKÜ�q–ˆAØŸF™F 7¥:Ó.ˆC�1•5�‹Mó ñ	 'ô �1ŽXˆÜ�q–ˆAØ !§¡ w¥zÓ 2× 7Ñ 7¸½
Ó CˆC�A•�q•u�Óó ñ ô �1ŽXˆÜ�q˜1•u˜a–ˆAØ˜q˜D�	ˆC�1�‹Ió !ñ ð €Jr   c                ó.   € \         P                  WR7      # )zÂ
Create a Jordan block:

Examples
========

>>> from sympy import jordan_cell
>>> from sympy.abc import x
>>> jordan_cell(x, 4)
Matrix([
[x, 1, 0, 0],
[0, x, 1, 0],
[0, 0, x, 1],
[0, 0, 0, x]])
)ÚsizeÚ
eigenvalue)r<   Újordan_block)Úeigenvalr®   s   &&r   Újordan_cellrØ   “  s   € ô" ×Ñ AÐÓ;Ð;r   c                ó$   € V P                  V4      # )a]  Return the Hadamard product (elementwise product) of A and B

>>> from sympy import Matrix, matrix_multiply_elementwise
>>> A = Matrix([[0, 1, 2], [3, 4, 5]])
>>> B = Matrix([[1, 10, 100], [100, 10, 1]])
>>> matrix_multiply_elementwise(A, B)
Matrix([
[  0, 10, 200],
[300, 40,   5]])

See Also
========

sympy.matrices.matrixbase.MatrixBase.__mul__
)Úmultiply_elementwise)ÚAÚBs   &&r   Úmatrix_multiply_elementwiserÝ   §  s   € ð  ×!Ñ! !Ó$Ð$r   c                 ód   € RV9   d   VP                  R4      VR&   \        P                  ! V / VB # )zžReturns a matrix of ones with ``rows`` rows and ``cols`` columns;
if ``cols`` is omitted a square matrix will be returned.

See Also
========

zeros
eye
diag
rŠ   r   )Úpopr<   Úonesrº   s   *,r   rà   rà   º  s0   € ð ˆf„}ØŸ™ C›ˆˆv‰ä�;Š;˜Ð' Ñ'Ð'r   c                ó  € T;'       g    \         P                  ! V4      pVf   T pV'       d   W8w  d   \        RW3,          4      h\        W,          4      pV^d8w  d3   VP	                  V\        \        V4      V,          ^d,          4      4      p\        W4      p	V'       g.   V F%  p
\        W¡4      w  r¼VP                  W#4      W›V3&   K'  	  V	# V F3  p
\        W¡4      w  r¼W¼8:  g   K  VP                  W#4      ;W›V3&   WœV3&   K5  	  V	# )a  Create random matrix with dimensions ``r`` x ``c``. If ``c`` is omitted
the matrix will be square. If ``symmetric`` is True the matrix must be
square. If ``percent`` is less than 100 then only approximately the given
percentage of elements will be non-zero.

The pseudo-random number generator used to generate matrix is chosen in the
following way.

* If ``prng`` is supplied, it will be used as random number generator.
  It should be an instance of ``random.Random``, or at least have
  ``randint`` and ``shuffle`` methods with same signatures.
* if ``prng`` is not supplied but ``seed`` is supplied, then new
  ``random.Random`` with given ``seed`` will be created;
* otherwise, a new ``random.Random`` with default seed will be used.

Examples
========

>>> from sympy import randMatrix
>>> randMatrix(3) # doctest:+SKIP
[25, 45, 27]
[44, 54,  9]
[23, 96, 46]
>>> randMatrix(3, 2) # doctest:+SKIP
[87, 29]
[23, 37]
[90, 26]
>>> randMatrix(3, 3, 0, 2) # doctest:+SKIP
[0, 2, 0]
[2, 0, 1]
[0, 0, 1]
>>> randMatrix(3, symmetric=True) # doctest:+SKIP
[85, 26, 29]
[26, 71, 43]
[29, 43, 57]
>>> A = randMatrix(3, seed=1)
>>> B = randMatrix(3, seed=2)
>>> A == B
False
>>> A == randMatrix(3, seed=1)
True
>>> randMatrix(3, symmetric=True, percent=50) # doctest:+SKIP
[77, 70,  0],
[70,  0,  0],
[ 0,  0, 88]
z4For symmetric matrices, r must equal c, but %i != %i)
ÚrandomÚRandomr„   r}   Úsamplerƒ   rd   rÌ   ÚdivmodÚrandint)ÚrrŠ   ÚminÚmaxÚseedÚ	symmetricÚpercentÚprngr‰   r€   Úijkrp   rq   s   &&&&&&&&     r   Ú
randMatrixrï   Ì  só   € ðb ×&Ð&”6—=’= Ó&€Dà‚yØˆç�Q”VÜÐOÐSTÐRXÕXÓYÐYä	ˆq�u‹€BØ�#„~Ø�[‰[˜œS¤ R£¨¥°CÕ!7Ó8Ó9ˆäˆa‹€AçÛˆCÜ˜#“>‰DˆAØ—l‘l 3Ó,ˆA�ˆd‹Gñ ð €Hó ˆCÜ˜#“>‰DˆAØŽvØ$(§L¡L°Ó$:Ð:��Q�$‘˜!˜q˜D›'ñ ð
 €Hr   c                óÎ   a a€ S  Uu. uF  p\        V4      NK  	  upo \        S 4      pV^ 8X  d   \        P                  # \	        WDV V3R l4      pVP                  V4      # u upi )a:  
Compute Wronskian for [] of functions

::

                     | f1       f2        ...   fn      |
                     | f1'      f2'       ...   fn'     |
                     |  .        .        .      .      |
    W(f1, ..., fn) = |  .        .         .     .      |
                     |  .        .          .    .      |
                     |  (n)      (n)            (n)     |
                     | D   (f1) D   (f2)  ...  D   (fn) |

see: https://en.wikipedia.org/wiki/Wronskian

See Also
========

sympy.matrices.matrixbase.MatrixBase.jacobian
hessian
c                ó6   <€ SV ,          P                  SV4      # rI   )rÉ   )rp   rq   Ú	functionsÚvars   &&€€r   r°   Úwronskian.<locals>.<lambda>3  s   ø€  )¨A¥,×"3Ñ"3°C¸Ô";r   )r   rd   r   ÚOner<   r´   )rò   ró   r)   r¶   r®   ÚWs   ff&   r   Ú	wronskianr÷     sV   ù€ ñ. &/Ó/¡Y ”˜–¡YÑ/€IÜˆI‹€AØˆA„vÜ�u‰uˆÜˆqÕ;Ó<€AØ�5‰5�‹=Ðùò 0s   ‡A"c                 ód   € RV9   d   VP                  R4      VR&   \        P                  ! V / VB # )zžReturns a matrix of zeros with ``rows`` rows and ``cols`` columns;
if ``cols`` is omitted a square matrix will be returned.

See Also
========

ones
eye
diag
rŠ   r   )rß   r<   rÌ   rº   s   *,r   rÌ   rÌ   7  s0   € ð ˆf„}ØŸ™ C›ˆˆv‰ä�<Š<˜Ð( Ñ(Ð(r   )r¨   )é   )r   rS   )F)rR   )Nr   éc   NFéd   N)Úbareiss)>Ú
__future__r   râ   Úsympy.core.basicr   Úsympy.core.singletonr   Úsympy.core.symbolr   Úsympy.core.sympifyr   Ú(sympy.functions.elementary.trigonometricr   r	   Úsympy.utilities.decoratorr
   Úsympy.utilities.exceptionsr   Úsympy.utilities.iterablesr   Ú
exceptionsr   Údecompositionsr   r   Ú
matrixbaser   Ú	repmatrixr   r   Úsolversr   r   Ú__doctest_requires__r   r   rg   ri   ÚMutableMatrixr<   r¡   r{   r�   rŒ   r‘   r”   r–   r˜   rš   rœ   r¨   r¸   r†   r¿   rÇ   rÒ   rØ   rÝ   rà   rï   r÷   rÌ   rR   r   r   Ú<module>r     s!  ðÝ "Û å "Ý "Ý $Ý &ß =Ý 8Ý @Ý 1å "ß 8Ý "ß 2ß Eð &¨ yÐ1Ð òô
FE�)ô FEòRô6˜Ð&6ô 6ð" ,Ð +€�ð ô ð !ô ô,tòn4*òn4*òn4*òn4*òn4*òn4*ñn ˜JÔ'ñEó (ðEôX(!òV'ð"H˜ð "H eô "HôJ&ôRJòZ<ò(%ò&(ô$IôXô>)r   