+
    izF                     b    ^ RI HtHtHt ^ RIHt ^ RIHt ^ RI	H
t
 R.t ! R R]]4      tR tR# )	    )sympifyAddImmutableMatrix)
EvalfMixin)	Printable)prec_to_dpsDyadicc                      a  ] tR t^t o RtRtR t]R 4       tR t	]	t
R t]tR t]tR tR	 tR
 tR tR tR tR tR tR tR t]tRR ltRR ltR tR tR tR tR t R t!R t"Rt#V t$R# )r	   a]  A Dyadic object.

See:
https://en.wikipedia.org/wiki/Dyadic_tensor
Kane, T., Levinson, D. Dynamics Theory and Applications. 1985 McGraw-Hill

A more powerful way to represent a rigid body's inertia. While it is more
complex, by choosing Dyadic components to be in body fixed basis vectors,
the resulting matrix is equivalent to the inertia tensor.

Fc                   . V n         V^ 8X  d   . p\        V4      ^ 8w  Ed_   ^ p\        V P                   4       F  w  r4\        V^ ,          ^,          4      \        V P                   V,          ^,          4      8X  g   KF  \        V^ ,          ^,          4      \        V P                   V,          ^,          4      8X  g   K  V P                   V,          ^ ,          V^ ,          ^ ,          ,           V^ ,          ^,          V^ ,          ^,          3V P                   V&   VP	                  V^ ,          4       ^p M	  V^8w  g   EK2  V P                   P                  V^ ,          4       VP	                  V^ ,          4       EKo  ^ pV\        V P                   4      8  d   V P                   V,          ^ ,          ^ 8H  V P                   V,          ^,          ^ 8H  ,          V P                   V,          ^,          ^ 8H  ,          '       d6   V P                   P	                  V P                   V,          4       V^,          pV^,          pK  R# )z
Just like Vector's init, you should not call this unless creating a
zero dyadic.

zd = Dyadic(0)

Stores a Dyadic as a list of lists; the inner list has the measure
number and the two unit vectors; the outerlist holds each unique
unit vector pair.

N)argslen	enumeratestrremoveappend)selfinlistaddedivs   &&   Y/var/www/html/photoedit/myenv/lib/python3.14/site-packages/sympy/physics/vector/dyadic.py__init__Dyadic.__init__   s    	Q;F&kQE!$)),1&#diil1o*>>VAYq\*c$))A,q/.BB$(IIaLOfQil$B$*1IaL&)A,$@DIIaLMM&),E - z		  +fQi(#dii. 1aA%$))A,q/Q*>?YYq\!_)+ +		  1.QFA !    c                    \         # )zReturns the class Dyadic. )r	   r   s   &r   funcDyadic.func@   s	     r   c                d    \        V4      p\        V P                  VP                  ,           4      # )zThe add operator for Dyadic. )_check_dyadicr	   r   r   others   &&r   __add__Dyadic.__add__E   s$    e$dii%**,--r   c                    \        V P                  4      p\        V4      p\        \	        V4      4       F8  pWV,          ^ ,          ,          W#,          ^,          W#,          ^,          3W#&   K:  	  \        V4      # )a%  Multiplies the Dyadic by a sympifyable expression.

Parameters
==========

other : Sympafiable
    The scalar to multiply this Dyadic with

Examples
========

>>> from sympy.physics.vector import ReferenceFrame, outer
>>> N = ReferenceFrame('N')
>>> d = outer(N.x, N.x)
>>> 5 * d
5*(N.x|N.x)

)listr   r   ranger   r	   )r   r"   newlistr   s   &&  r   __mul__Dyadic.__mul__L   sa    & tyy/s7|$A!*Q-/A!*Q-)GJ % gr   c                B   ^ RI HpHp \        V\        4      '       d   \        V4      p\	        ^ 4      pV P                   F{  pVP                   Fh  pWE^ ,          V^ ,          ,          V^,          P                  V^,          4      ,          V^,          P                  V^,          4      ,          ,          pKj  	  K}  	  V# V! V4      pV! ^ 4      pV P                   F=  pWE^ ,          V^,          ,          V^,          P                  V4      ,          ,          pK?  	  V# )az  The inner product operator for a Dyadic and a Dyadic or Vector.

Parameters
==========

other : Dyadic or Vector
    The other Dyadic or Vector to take the inner product with

Examples
========

>>> from sympy.physics.vector import ReferenceFrame, outer
>>> N = ReferenceFrame('N')
>>> D1 = outer(N.x, N.y)
>>> D2 = outer(N.y, N.y)
>>> D1.dot(D2)
(N.x|N.y)
>>> D1.dot(N.y)
N.x

)Vector_check_vector)	sympy.physics.vector.vectorr,   r-   
isinstancer	   r    r   dotouter)r   r"   r,   r-   olr   v2s   &&     r   r0   
Dyadic.doth   s    , 	FeV$$!%(EBYY**BA$A,!A$((2a5/:adjjA>OPPB %  		 "%(EBYYdQqTkQqTXXe_55 	r   c                2    V P                  ^V,          4      # )z0Divides the Dyadic by a sympifyable expression. )r)   r!   s   &&r   __truediv__Dyadic.__truediv__   s    ||AI&&r   c                "   V^ 8X  d   \        ^ 4      p\        V4      pV P                  . 8X  d   VP                  . 8X  d   R# V P                  . 8X  g   VP                  . 8X  d   R# \        V P                  4      \        VP                  4      8H  # )zKTests for equality.

Is currently weak; needs stronger comparison testing

TF)r	   r    r   setr!   s   &&r   __eq__Dyadic.__eq__   sk     A:1IEe$IIO%**"2ii2o5::#3499~UZZ00r   c                    W8X  * # N r!   s   &&r   __ne__Dyadic.__ne__   s      r   c                    V R,          #    r>   r   s   &r   __neg__Dyadic.__neg__   s    byr   c                2   V P                   p\        V4      ^ 8X  d   \        ^ 4      # . pV EF  pV^ ,          ^8X  dU   VP                  RVP	                  V^,          4      ,           R,           VP	                  V^,          4      ,           4       Kf  V^ ,          R
8X  dU   VP                  RVP	                  V^,          4      ,           R,           VP	                  V^,          4      ,           4       K  V^ ,          ^ 8w  g   K  VP	                  V^ ,          4      p\        V^ ,          \        4      '       d
   RV,          pVP                  R4      '       d   VR,          pRpMRpVP                  We,           VP	                  V^,          4      ,           R,           VP	                  V^,          4      ,           4       EK  	  RP                  V4      pVP                  R4      '       d   VR,          pV# VP                  R	4      '       d
   VR,          pV# )r    + z\otimes  - (%s)-rC   NN    NN rD   )	r   r   r   r   _printr/   r   
startswithjoinr   printerarr2   r   arg_str	str_startoutstrs   &&      r   _latexDyadic._latex   s   YYr7a<q6MAtqy		%'..1"66D!..1./ 0 1		%!..1./%& "..1./ 0 1!..1.adC(($w.G%%c**%bkG %I %I		)-qt0DD%&(/qt(<= >- 0 U##BZF  s##BZFr   c                4   aa V o ! VV3R  lR4      pV! 4       # )c                   4   <a  ] tR t^t o ^ tVV3R ltRtV tR# )Dyadic._pretty.<locals>.Fakec                >  < SP                   pSp\        V4      ^ 8X  d   \        ^ 4      # SP                  '       d   RMRp. pV EF  pV^ ,          ^8X  dD   VP	                  RVP                  V^,          4      VVP                  V^,          4      .4       KU  V^ ,          R
8X  dD   VP	                  RVP                  V^,          4      VVP                  V^,          4      .4       K  V^ ,          ^ 8w  g   K  \        V^ ,          \        4      '       d/   VP                  V^ ,          4      P                  4       ^ ,          pMVP                  V^ ,          4      pVP                  R4      '       d   VR,          pRp	MRp	VP	                  WRVP                  V^,          4      VVP                  V^,          4      .4       EK  	  RP                  V4      p
V
P                  R4      '       d   V
R	,          p
V
# V
P                  R4      '       d
   V
R,          p
V
# )r   u   ⊗|rH   rI   rK   rL   rP   rM   rN   rD   )r   r   r   _use_unicodeextenddoprintr/   r   rQ   parensrR   rS   )r   r   kwargsrV   mppbarr2   r   rW   rX   rY   erU   s   &*,        r   render#Dyadic._pretty.<locals>.Fake.render   s   VVr7a<q6M-4-A-A-A)sAtqy		5"%++ad"3"%"%++ad"3#5 6 1		5"%++ad"3"%"%++ad"3#5 6 1%adC00&)jj !!'&&,fhq'2G '*kk!A$&7G"--c22&-bkG(-I(-I		9s"%++ad"3"%"%++ad"3#5 69 B $$U++#BZF  &&s++#BZFr   r>   N)__name__
__module____qualname____firstlineno__baselineri   __static_attributes____classdictcell__)__classdict__rh   rU   s   @r   Faker^      s     H- -r   rs   r>   )r   rU   rs   rh   s   &f @r   _prettyDyadic._pretty   s    0	 0	b vr   c                "    RV ,          V,           # rB   r>   r!   s   &&r   __rsub__Dyadic.__rsub__  s    T	U""r   c                d   V P                   p\        V4      ^ 8X  d   VP                  ^ 4      # . pV EF  pV^ ,          ^8X  d\   VP                  RVP                  V^,          4      ,           R,           VP                  V^,          4      ,           R,           4       Km  V^ ,          R8X  d\   VP                  RVP                  V^,          4      ,           R,           VP                  V^,          4      ,           R,           4       K  V^ ,          ^ 8w  g   K  VP                  V^ ,          4      p\	        V^ ,          \
        4      '       d
   RV,          pV^ ,          R8X  d   VR,          pRpMR	pVP                  We,           R
,           VP                  V^,          4      ,           R,           VP                  V^,          4      ,           R,           4       EK  	  RP                  V4      pVP                  R	4      '       d   VR,          pV# VP                  R4      '       d
   VR,          pV# )zPrinting method. z + (r`   )z - (rJ   rK   rL   rI   rH   z*(rM   rN   rP   rD   )r   r   rQ   r   r/   r   rS   rR   rT   s   &&      r   	_sympystrDyadic._sympystr  s   YYr7a<>>!$$Atqy		&7>>!A$#77#=!..1./145 6 1		&7>>!A$#77#=!..1./145 6 1!..1.adC(($w.G1:$%bkG %I %I		)-4!..1./ 'qt 457:; <) . U##BZF  s##BZFr   c                2    V P                  VR,          4      # )zThe subtraction operator. rD   )r#   r!   s   &&r   __sub__Dyadic.__sub__*  s    ||EBJ''r   c                    ^ RI Hp V! V4      p\        ^ 4      pV P                   FE  pW4^ ,          V^,          P	                  V^,          P                  V4      4      ,          ,          pKG  	  V# )a:  Returns the dyadic resulting from the dyadic vector cross product:
Dyadic x Vector.

Parameters
==========
other : Vector
    Vector to cross with.

Examples
========
>>> from sympy.physics.vector import ReferenceFrame, outer, cross
>>> N = ReferenceFrame('N')
>>> d = outer(N.x, N.x)
>>> cross(d, N.y)
(N.x|N.z)

)r-   )r.   r-   r	   r   r1   cross)r   r"   r-   r2   r   s   &&   r   r   Dyadic.cross.  sX    $ 	>e$AYAA$!A$**adjj&79::B 	r   Nc                     ^ RI Hp V! WV4      # )ag  Expresses this Dyadic in alternate frame(s)

The first frame is the list side expression, the second frame is the
right side; if Dyadic is in form A.x|B.y, you can express it in two
different frames. If no second frame is given, the Dyadic is
expressed in only one frame.

Calls the global express function

Parameters
==========

frame1 : ReferenceFrame
    The frame to express the left side of the Dyadic in
frame2 : ReferenceFrame
    If provided, the frame to express the right side of the Dyadic in

Examples
========

>>> from sympy.physics.vector import ReferenceFrame, outer, dynamicsymbols
>>> from sympy.physics.vector import init_vprinting
>>> init_vprinting(pretty_print=False)
>>> N = ReferenceFrame('N')
>>> q = dynamicsymbols('q')
>>> B = N.orientnew('B', 'Axis', [q, N.z])
>>> d = outer(N.x, N.x)
>>> d.express(B, N)
cos(q)*(B.x|N.x) - sin(q)*(B.y|N.x)

)express)sympy.physics.vector.functionsr   )r   frame1frame2r   s   &&& r   r   Dyadic.expressJ  s    @ 	;tV,,r   c           
         Vf   Tp\        V UUu. uF+  pV F"  qCP                  V 4      P                  V4      NK$  	  K-  	  upp4      P                  ^^4      # u uppi )ai  Returns the matrix form of the dyadic with respect to one or two
reference frames.

Parameters
----------
reference_frame : ReferenceFrame
    The reference frame that the rows and columns of the matrix
    correspond to. If a second reference frame is provided, this
    only corresponds to the rows of the matrix.
second_reference_frame : ReferenceFrame, optional, default=None
    The reference frame that the columns of the matrix correspond
    to.

Returns
-------
matrix : ImmutableMatrix, shape(3,3)
    The matrix that gives the 2D tensor form.

Examples
========

>>> from sympy import symbols, trigsimp
>>> from sympy.physics.vector import ReferenceFrame
>>> from sympy.physics.mechanics import inertia
>>> Ixx, Iyy, Izz, Ixy, Iyz, Ixz = symbols('Ixx, Iyy, Izz, Ixy, Iyz, Ixz')
>>> N = ReferenceFrame('N')
>>> inertia_dyadic = inertia(N, Ixx, Iyy, Izz, Ixy, Iyz, Ixz)
>>> inertia_dyadic.to_matrix(N)
Matrix([
[Ixx, Ixy, Ixz],
[Ixy, Iyy, Iyz],
[Ixz, Iyz, Izz]])
>>> beta = symbols('beta')
>>> A = N.orientnew('A', 'Axis', (beta, N.x))
>>> trigsimp(inertia_dyadic.to_matrix(A))
Matrix([
[                           Ixx,                                           Ixy*cos(beta) + Ixz*sin(beta),                                           -Ixy*sin(beta) + Ixz*cos(beta)],
[ Ixy*cos(beta) + Ixz*sin(beta), Iyy*cos(2*beta)/2 + Iyy/2 + Iyz*sin(2*beta) - Izz*cos(2*beta)/2 + Izz/2,                 -Iyy*sin(2*beta)/2 + Iyz*cos(2*beta) + Izz*sin(2*beta)/2],
[-Ixy*sin(beta) + Ixz*cos(beta),                -Iyy*sin(2*beta)/2 + Iyz*cos(2*beta) + Izz*sin(2*beta)/2, -Iyy*cos(2*beta)/2 + Iyy/2 - Iyz*sin(2*beta) + Izz*cos(2*beta)/2 + Izz/2]])

)Matrixr0   reshape)r   reference_framesecond_reference_framer   js   &&&  r   	to_matrixDyadic.to_matrixm  sd    V ")%4"? .?a, HIuuT{q), *? . //6wq!}	= .s   1A
c                    \        V P                   Uu. uF7  p\        V^ ,          P                  ! R/ VB V^,          V^,          3.4      NK9  	  up\        ^ 4      4      # u upi )z(Calls .doit() on each term in the Dyadicr>   )sumr   r	   doit)r   hintsr   s   &, r   r   Dyadic.doit  sa    !YY(& QqTYY//1qt<=>&()/4 	4 (   =A"c                    ^ RI Hp V! W4      # )a'  Take the time derivative of this Dyadic in a frame.

This function calls the global time_derivative method

Parameters
==========

frame : ReferenceFrame
    The frame to take the time derivative in

Examples
========

>>> from sympy.physics.vector import ReferenceFrame, outer, dynamicsymbols
>>> from sympy.physics.vector import init_vprinting
>>> init_vprinting(pretty_print=False)
>>> N = ReferenceFrame('N')
>>> q = dynamicsymbols('q')
>>> B = N.orientnew('B', 'Axis', [q, N.z])
>>> d = outer(N.x, N.x)
>>> d.dt(B)
- q'*(N.y|N.x) - q'*(N.x|N.y)

)time_derivative)r   r   )r   framer   s   && r   dt	Dyadic.dt  s    2 	Ct++r   c                    \        ^ 4      pV P                   F<  pV\        V^ ,          P                  4       V^,          V^,          3.4      ,          pK>  	  V# )zReturns a simplified Dyadic.)r	   r   simplify)r   outr   s   &  r   r   Dyadic.simplify  sI    QiA6AaDMMOQqT1Q489::C 
r   c                    \        V P                   Uu. uF7  p\        V^ ,          P                  ! V/ VB V^,          V^,          3.4      NK9  	  up\        ^ 4      4      # u upi )zSubstitution on the Dyadic.

Examples
========

>>> from sympy.physics.vector import ReferenceFrame
>>> from sympy import Symbol
>>> N = ReferenceFrame('N')
>>> s = Symbol('s')
>>> a = s*(N.x|N.x)
>>> a.subs({s: 2})
2*(N.x|N.x)

)r   r   r	   subs)r   r   re   r   s   &*, r   r   Dyadic.subs  se      !YY(& QqTYY771qtDEF&()/4 	4 (r   c                    \        V4      '       g   \        R4      h\        ^ 4      pV P                   F*  w  r4pW!! V4      VP	                  V4      ,          ,          pK,  	  V# )z/Apply a function to each component of a Dyadic.z`f` must be callable.)callable	TypeErrorr	   r   r1   )r   fr   abcs   &&    r   	applyfuncDyadic.applyfunc  sR    {{344QiyyGA!1Q41771:&&C !
r   c                   V P                   '       g   V # . p\        V4      pV P                    FD  p\        V4      pV^ ,          P                  VR7      V^ &   VP	                  \        V4      4       KF  	  \        V4      # )r   )n)r   r   r&   evalfr   tupler	   )r   precnew_argsdpsr   
new_inlists   &&    r   _eval_evalfDyadic._eval_evalf  sl    yyyK$iiFfJ"1IOOcO2JqMOOE*-.   hr   c                    . pV P                    FC  p\        V4      pV^ ,          P                  V4      V^ &   VP                  \	        V4      4       KE  	  \        V4      # )a  
Replace occurrences of objects within the measure numbers of the
Dyadic.

Parameters
==========

rule : dict-like
    Expresses a replacement rule.

Returns
=======

Dyadic
    Result of the replacement.

Examples
========

>>> from sympy import symbols, pi
>>> from sympy.physics.vector import ReferenceFrame, outer
>>> N = ReferenceFrame('N')
>>> D = outer(N.x, N.x)
>>> x, y, z = symbols('x y z')
>>> ((1 + x*y) * D).xreplace({x: pi})
(pi*y + 1)*(N.x|N.x)
>>> ((1 + x*y) * D).xreplace({x: pi, y: 2})
(1 + 2*pi)*(N.x|N.x)

Replacements occur only if an entire node in the expression tree is
matched:

>>> ((x*y + z) * D).xreplace({x*y: pi})
(z + pi)*(N.x|N.x)
>>> ((x*y*z) * D).xreplace({x*y: pi})
x*y*z*(N.x|N.x)

)r   r&   xreplacer   r   r	   )r   ruler   r   r   s   &&   r   r   Dyadic.xreplace  sW    P iiFfJ&qM2248JqMOOE*-.   hr   )r   r=   )%rk   rl   rm   rn   __doc__	is_numberr   propertyr   r#   __radd__r)   __rmul__r0   __and__r6   r:   r?   rE   rZ   rt   rw   r{   r~   r   __xor__r   r   r   r   r   r   r   r   r   rp   rq   )rr   s   @r   r	   r	      s     
 I$L  .
 H4 H"J G'1 !"H4l#"H(4 G!-F/=b4
,84&	 -  - r   c                 H    \        V \        4      '       g   \        R 4      hV # )zA Dyadic must be supplied)r/   r	   r   )r"   s   &r   r    r      s     eV$$344Lr   N)sympyr   r   r   r   sympy.core.evalfr   sympy.printing.defaultsr   mpmath.libmp.libmpfr   __all__r	   r    r>   r   r   <module>r      s3    9 9 ' - + *P Y
 P fr   