+
    iA                        ^ RI Ht ^ RIHt ^ RIHt ^ RIHtHtHtH	t	 ^ RI
Ht ^ RIHtHt ^ RIHtHtHtHtHt ^ RIHt ^ R	IHt ^ R
IHtHtHtHtHtHt ^ RI H!t! ^ RI"H#t# ^ RI$H%t% ^ RI&H't' ^ RI(H)t) ^ RI H*t* ^ RI+t+^ RI,H-t-H.t. ]! R4      w  t/t0t1t2]! R4      t3R t4R t5R t6R t7R t8R t9R t:R t;R t<R t=R t>R  t?R! t@R" tAR# tBR$ tC]R% 4       tDR& tER' tF]R( 4       tGR# ))    )slow)diff)expand)EIRationalpi)S)Symbolsymbols)Abs	conjugateimresign)log)sqrt)acosasincossinatan2atan)	integrate)Matrix)simplify)trigsimp)
Quaternion)raisesN)permutationsproductzw:zphic                  b  a \        \        \        \        \        4      p W ,           \        ^\        ,          ^\        ,          ^\        ,          ^\        ,          4      8X  g   Q h\         P
                  ! \        ^4      ^,          \        ^4      ^,          \        ^4      ^,          3\        \        ^^4      ,          4      pV\        \        P                  \        P                  \        P                  \        P                  4      8X  g   Q h\        \        \        4      \        \        4      ) ^ .\        \        4      \        \        4      ^ .. RO.4      p\        \         P                   ! V4      4      pV\        \        ^4      \        \        \        4      ^,           4      ,          ^,          ^ ^ \        ^^\        \        4      ,          ,
          4      \#        \        \        4      4      ,          ^,          4      8X  g   Q h\%        RRR7      o\'        \(        V3R l4       R# )   ncFcommutativec                  8   < \        \        \        S \        4      # N)r   wxz)r%   s   b/var/www/html/photoedit/myenv/lib/python3.14/site-packages/sympy/algebras/tests/test_quaternion.py<lambda>.test_quaternion_construction.<locals>.<lambda>&   s    z!QA6    Nr   r      )r   r*   r+   yr,   from_axis_angler   r	   r   r
   Halfr   r   r"   r   r   from_rotation_matrixr   r   r   
ValueError)qq2Mq3r%   s       @r-   test_quaternion_constructionr<      su   1aAA5JqsAaC1ac2222		#	#T!WQYQ	4719$E$&x1~$5
7BAFFAFFFFAFF, , , , 	SCH9a(3s8SXq*A9MNA	*11!4	5BQSX\""1$aDQs3xZ,@c#h,OPQ,QS S S S 
%	(B
:67r0   c                     \        \        R 4      !  p \        \        \        \        \
        4      p\        W,          P                  4       ^,          V P                  4       ^,          VP                  4       ^,          ,          ,
          4      ^ 8X  g   Q h\        \        \        \        \
        ^R7      pW,          P                  4       V P                  4       8X  g   Q hR# )a:d)normN)r   r   r*   r+   r3   r,   r   r?   )q1r9   r;   s      r-   !test_quaternion_construction_normrA   )   s    	WU^	$B	Aq!Q	B25,,.!#rwwy!|bggil'BCDIII	Aq!QQ	'BG>>rwwy(((r0   c                      \        ^^ ^ ^ 4      p \         P                  ! R^\        P                  ,          ^,          4      pVP	                  4       pW,          V,          pW0,
          P                  4       R8  g   Q hR# )r2   g|=Nr2   r2   r2   )r   r4   mathr	   inverser?   )pr8   qitests       r-   test_issue_25254rI   3   s_     	1aAA""9a$''k!m<A	
B52:DXOO%&%r0   c                  j   \        \        \        \        \        4      p \         P
                  ! V P                  4       4      p\         P
                  ! V P                  R 4      4      pW,
          P                  4       '       g   Q hV P                  4       V,
          P                  4       '       g   Q hR# )TN)	r   r*   r+   r3   r,   from_Matrix	to_Matrixis_zero_quaternionvector_part)r8   q_fullq_vects      r-   test_to_and_from_MatrixrQ   =   sx    1aAA##AKKM2F##AKK$56FJ**,,,,MMOf$88::::r0   c                  ,   \        \        \        \        \        4      p \        \        R 4      !  pW,          P                  4       V P                  VP                  4       ,          8X  g   Q hW,          P                  4       VP                  V P                  4       ,          8X  g   Q hV P                  V P                  P                  ,          R,          p\        V P                  4       V P                  4       ^,          ,          4      pW#8X  g   Q hR# )r>   N)r2   NNrS   )r   r*   r+   r3   r,   r   rL   product_matrix_leftproduct_matrix_rightTr   to_rotation_matrixr?   )r@   r9   R1R2s       r-   test_product_matricesrZ   E   s    	Aq!Q	B	gen	&BG B$:$:R\\^$KKKKG B$;$;blln$LLLL

 
 2#:#:#<#<
<f	EB	"'')"'')Q,6	7B8O8r0   c                  P   RR\         ^,          \        ^4      ^,          \        ^4      ^,          ^ ^ 33R\         ^,          \        ^4      ^,          ^ \        ^4      ^,          ^ 33R\         ^,          \        ^4      ^,          ^ ^ \        ^4      ^,          33R\         R3R\         R3R\         R3R	\         ^ ^\        ^4      ,          ^\        ^4      ,          ^\        ^4      ,          33\        ^4      ^,          \        ^4      ^,          \        ^4      ^,          3\         ^,          ^,          \        P                  \        P                  \        P                  \        P                  33.	p V  F*  w  rp\        P
                  ! W4      \	        V!  8X  d   K*  Q h	  R# )
r2   Nr2   r   r   )r\   r   )r2   r   r   r   )r   r2   r   r1   )r   r2   r   r   r   r   r2   r   r   r   r   r2   rC   )r	   r   r
   r5   r   r4   )	test_dataaxisangleexpecteds       r-   test_quaternion_axis_anglerc   P   sE    	%	BqD4719d1gaiA67	BqD4719aaA67	BqD4719aDGAI67	B%	B%	B%	BAd1gIaQi$q'	:;
q'!)T!WQYQ		*BqDFQVVQVVQVVQVV4TU
I "+X))$6*h:OOOO "+r0   c                  >   \         P                  ! R\        ^4      4      p V P                  \	        \        ^4      ^,          4      8X  g   Q hV P
                  \        ^4      \        \        ^4      ^,          4      ,          ^,          8X  g   Q hV P                  \        ^4      \        \        ^4      ^,          4      ,          ^,          8X  g   Q hV P                  ^\        ^4      ,          \        \        ^4      ^,          4      ,          ^,          8X  g   Q hR# )r2   N)r2   r$      )
r   r4   r   ar   br   r   cd)results    r-   )test_quaternion_axis_angle_simplificationrk   b   s    ''	47;F88s4719~%%%88tBxDGAI.r111188tBxDGAI.q000088qbz#d1gai.03333r0   c            
      P  aa \        R RR7      p \        RRR7      p\        RRR7      o\        \        \        \        \
        4      oV S,           \        \        \        V 4      ,           \        \        V 4      ,           \        \
        4      8X  g   Q h^S,           \        ^\        ,           \        \        \
        4      8X  g   Q h\        S,           \        \        ^\        ,           \        \
        4      8X  g   Q hVS,           \        \        V,           \        \        \
        4      8X  g   Q h\        \        VV3R l4       \        \        VV3R	 l4       \        \        VV3R
 l4       S) \        \        ) \        ) \        ) \
        ) 4      8X  g   Q h\        ^^\        ,          ,           ^^\        ,          ,           ^ ^^\        ,          ,           RR7      p\        ^^^^4      pV^^\        ,          ,           ,           \        ^^\        ,          ,           ^^\        ,          ,           ^ ^^\        ,          ,           4      8X  g   Q hV^^\        ,          ,           ,           \        ^^^^4      8X  g   Q hV^^\        ,          ,           ,          \        ^^\        ,          ,           ^^\        ,          ,           ,          ^^\        ,          ,           ^^\        ,          ,           ,          ^ ^^\        ,          ,           ^^\        ,          ,           ,          4      8X  g   Q hV^^\        ,          ,           ,          \        R^^&R4      8X  g   Q h\        ^^^^4      p\        ^ ^ ^ ^ 4      pW$,           V8X  g   Q hW$,
          V8X  g   Q hW",
          V8X  g   Q hR# )rf   Tcomplexrg   realrh   Fr&   c                     < S S,           # r)    rh   r8   s   r-   r.   7test_quaternion_complex_real_addition.<locals>.<lambda>t   	    q1ur0   c                     < SS ,          # r)   rr   rs   s   r-   r.   rt   u   ru   r0   c                     < S S,          # r)   rr   rs   s   r-   r.   rt   v   ru   r0   
real_fieldNi)r   r   r*   r+   r3   r,   r   r   r   r   r7   )rf   rg   r@   r9   q0rh   r8   s        @@r-   %test_quaternion_complex_real_additionr|   i   s   T"A$A'A1aAAq5Jq2a5y!be)Q::::q5Jq1uaA....q5Jq!a%A....q5Jq1uaA....
:}%
:}%
:}%2QBQB++++	A!GQ1WaQqSu	EB	Aq!Q	BQqS>ZAaCQqS!Q1WEEEEQqS>Z1a3333QqS>AaC!ac'"Q1Wq1Q3w$7Q1Wq1Q3w<OPQ Q QQqS>ZRR8888	Aq!Q	B	Aq!Q	B7b==7b==7b==r0   c                      \         P                  ! R\        4      p V P                  \        ^ 4      \        ^^ ^ ^ 4      8X  g   Q hR# )r   Nr1   )r   r4   r"   subsr8   s    r-   test_quaternion_subsr      s7    ""9c2A66#q>Z1a3333r0   c            
         \        \        ^4      ^ ^ \        ^4      4      P                  4       \        \        ^4      P                  4       ^ ^ \        ^4      P                  4       4      8X  g   Q h\        ^\        ^4      ,          ^ ^ ^\        ^4      ,          4      P                  4       \        ^\        ^4      ,          P                  4       ^ ^ ^\        ^4      ,          P                  4       4      8X  g   Q hR# )r$   N)r   r   evalfrr   r0   r-   test_quaternion_evalfr      s    tAw1d1g.446tAw}}1d1gmmo>? @ ?qay!Q$q'	288:$q'	((*Aq1T!W92C2C2EFG H Gr0   c                  &  aaa \        \        \        \        \        4      p \        ^^^^4      o\        ^ ^ ^ ^ 4      o\        V 4      \        \        \        ) \        ) \        ) 4      8X  g   Q hV P                  4       \        \        ^,          \        ^,          ,           \        ^,          ,           \        ^,          ,           4      8X  g   Q hV P                  4       \        \        \        \        \        4      \        \        ^,          \        ^,          ,           \        ^,          ,           \        ^,          ,           4      ,          8X  g   Q hV P                  4       \        \        \        ) \        ) \        ) 4      \        ^,          \        ^,          ,           \        ^,          ,           \        ^,          ,           ,          8X  g   Q hV P                  4       V P                  R4      8X  g   Q h\        \        V3R l4       V P                  ^4      \        \        ^,          \        ^,          ,
          \        ^,          ,
          \        ^,          ,
          ^\        ,          \        ,          ^\        ,          \        ,          ^\        ,          \        ,          4      8X  g   Q hV ^,          \        \        ^,          \        ^,          ,
          \        ^,          ,
          \        ^,          ,
          ^\        ,          \        ,          ^\        ,          \        ,          ^\        ,          \        ,          4      8X  g   Q hSP                  R4      \        \        R^4      \        R^4      \        R^4      \        R^4      4      8X  g   Q hSR,          \        \        R^4      \        R^4      \        R^4      \        R^4      4      8X  g   Q hSP                  R4      \        8X  g   Q h\        \        V3R l4       SP!                  4       \        \"        \%        \        ^4      4      ,          ^\        ^4      ,          \"        ,          \'        \        ^4      4      ,          ^,          ^\        ^4      ,          \"        ,          \'        \        ^4      4      ,          ^,          ^\        ^4      ,          \"        ,          \'        \        ^4      4      ,          ^,          4      8X  g   Q hSP)                  4       \        \)        \        ^4      4      ^\        ^4      ,          \+        \        ^4      ^,          4      ,          ^,          ^\        ^4      ,          \+        \        ^4      ^,          4      ,          ^,          ^\        ^4      ,          \+        \        ^4      ^,          4      ,          ^,          4      8X  g   Q hSP-                  ^4      \        ^\%        ^\+        \        ^4      ^,          4      ,          4      ,          ^<\        ^4      ,          \'        ^\+        \        ^4      ^,          4      ,          4      ,          ^,          ^Z\        ^4      ,          \'        ^\+        \        ^4      ^,          4      ,          4      ,          ^,          ^x\        ^4      ,          \'        ^\+        \        ^4      ^,          4      ,          4      ,          ^,          4      8X  g   Q h\/        \        \        \        \        \        4      \        4      \        ^^^^4      8X  g   Q h\1        \        \        \        \        \        4      \        4      \        \        ^,          ^,          \        ^,          ^,          \        ^,          ^,          \        ^,          ^,          4      8X  g   Q h\        ^\        \        ^,          \        ^,          4      P1                  \        4      \        \        \        ^,          ^,          \        ^,          ^,          \        ^,          ^,          4      8X  g   Q h\        \'        \        4      \%        \        4      \'        ^\        ,          4      \%        ^\        ,          4      4      P1                  \        4      \        \%        \        4      ) \'        \        4      \%        ^\        ,          4      ) ^,          \'        ^\        ,          4      ^,          4      8X  g   Q h\        \        ^,          \        ^,          \        ^,          \        \        ,          \        ,          4      P1                  \        \        4      \        \        ^,          \        ,          ^,          \        \        ^,          ,          ^,          \        \        ,          \        ^,          ,          \        ^,          \        ^,          ,          \        ,          ^,          4      8X  g   Q h\         P2                  ! RS4      \4        P6                  ^,          ^\5        ^4      ^,          38X  g   Q h\9        R4      o\        \        VV3R l4       \9        RRR7      o\        \        VV3R l4       \        ^^^7^4      P;                  4       ^8X  g   Q h\        \        \        \        \        4      P;                  4       \        8X  g   Q h\        ^^^7^4      P=                  4       \        ^ ^^7^4      8X  g   Q h\        \        \        \        \        4      P=                  4       \        ^ \        \        \        4      8X  g   Q hSP?                  4       \        ^ ^\        ^4      ,          ^,          ^\        ^4      ,          ^,          ^\        ^4      ,          ^,          4      8X  g   Q hSP?                  4       P                  ^4      \        R^ ^ ^ 4      8X  g   Q hSP?                  4       P;                  4       ^ 8X  g   Q hV P?                  4       \        ^ \        \        \        ^,          \        ^,          ,           \        ^,          ,           4      ,          \        \        \        ^,          \        ^,          ,           \        ^,          ,           4      ,          \        \        \        ^,          \        ^,          ,           \        ^,          ,           4      ,          4      8X  g   Q hSPA                  4       RJ g   Q hSPA                  4       RJ g   Q h\        ^ ^ ^ ^4      PA                  4       RJ g   Q h\        ^ ^^
^4      PA                  4       RJ g   Q h\        \        ^^
^4      PA                  4       e   Q hSPC                  4       ^\E        \        ^4      4      ,          8X  g   Q hV PC                  4       ^\G        \        \        ^,          \        ^,          ,           \        ^,          ,           4      \        4      ,          8X  g   Q h\         PH                  ! S\        ^^^^4      4      RJ g   Q h\         PH                  ! S\        ^RRR4      4      RJ g   Q h\         PH                  ! S\        ^^^^4      4      RJ g   Q h\         PH                  ! S\        ^^^^4      4      RJ g   Q h\         PH                  ! S\        \        ^^^4      4      RJ g   Q h\         PH                  ! S\        ^^^^4      4      RJ g   Q h\         PH                  ! S\        \        \        \        \        4      4      e   Q h\        \        VV3R
 l4       \         PJ                  ! \        ^ ^^^4      \        ^ ^^^4      \        ^ ^^^4      4      RJ g   Q h\         PJ                  ! \        ^ ^ ^ ^ 4      \        ^ ^^^4      \        ^ ^^^4      4      RJ g   Q h\         PJ                  ! \        ^ ^^^4      \        ^ ^^^4      \        ^ ^ ^^4      4      RJ g   Q h\         PJ                  ! \        ^ ^^^4      \        ^ ^\        ^4      \        ^ ^^^4      4       e   Q h\        \        VV3R l4       \        ^ ^^^4      PM                  \        ^ ^^^4      4      RJ g   Q h\        ^ ^^^4      PM                  \        ^ ^^^4      4      RJ g   Q h\        ^ ^^^4      PM                  \        \        \        \        ^4      4      e   Q h\        \        VV3R l4       \        ^ ^^^4      PO                  \        ^ R^^ 4      4      RJ g   Q h\        ^ ^^^4      PO                  \        ^ ^^^4      4      RJ g   Q h\        ^ ^^^4      PO                  \        \        \        \        ^4      4      e   Q h\        \        VV3R l4       SPQ                  4       \        ^ ^\        R4      ,          ^,          ^\        R4      ,          ^,          ^\        R4      ,          ^,          4      8X  g   Q h\        ^ ^^	^4      PQ                  4       \        ^ ^^	^4      8X  g   Q h\        ^^^	^4      PS                  4       \)        \        ^z4      4      8X  g   Q h\        ^^^ ^4      PS                  4       \)        \        ^4      4      8X  g   Q hSPU                  4       RJ g   Q hSPU                  4       RJ g   Q h\        \        ^ ^ ^ 4      PU                  4       e   Q hR	# )r2   c                  $   < S P                  4       # r)   rE   r{   s   r-   r.   +test_quaternion_functions.<locals>.<lambda>   s    rzz|r0   c                     < S R,          # )g      ?      rr   )r@   s   r-   r.   r      s	    b4jr0   nc                     < SS ,          # r)   rr   r   r@   s   r-   r.   r      	    b!er0   T)integerc                     < SS ,          # r)   rr   r   s   r-   r.   r      r   r0   FNc                  2   < \         P                  ! SS 4      # r)   )r   arc_coplanarr{   r@   s   r-   r.   r      s    z66r2>r0   c            	      L   < \         P                  ! S \        ^ ^^^4      S4      # )r   )r   vector_coplanarr   s   r-   r.   r      s     ""2z!Q1'=rBr0   c                  &   < S P                  S4      # r)   )parallelr   s   r-   r.   r     s    r{{2r0   c                  &   < S P                  S4      # r)   )
orthogonalr   s   r-   r.   r     s    r}}R0r0   if  ir   rC   )+r   r*   r+   r3   r,   r   r?   r   	normalizerE   powr   r7   r   NotImplemented	TypeErrorexpr   r   r   r   r   pow_cos_sinr   r   rotate_pointr
   Oner   scalar_partrN   r`   is_purera   r   r   r   r   r   r   index_vectormensorrM   )r8   r   r{   r@   s    @@@r-   test_quaternion_functionsr      s   1aAA	Aq!Q	B	Aq!Q	BQ<:a!aR!4444668tAqD1a4K!Q$.A56666;;=Jq!Q2T!Q$A+1:LqRSt:S5TTTTT99;*QQB3q!tad{QT7IAqD7PQQQQ99;!%%)###
:+,558z!Q$A+1"4q!t";QqSUAaCE1Q3q5QQQQq6Z1q!tad 2QT 91Q3q5!A#a%1QOOOO66":S8B,hr3.?"cART T T T8zS8B,hr3.?"cART T T T66$<>)))
9()668q3tBx= 48|a#d2h-/"448|a#d2h-/"448|a#d2h-/"466 6 6
 668s48}48|d48B;//"448|d48B;//"448|d48B;//"466 6 6 >>!rCDb"--..DH}s1tDHRK'8#899B>DH}s1tDHRK'8#899B>T"X~AT"Xb[(9$9 ::R?AA A A 
1aA&*jAq!.DDDDZ1a+Q/q!taxA1a4!8QTAX67 7 7 aAqD!Q$'11!4q!Q$q&!Q$q&!Q$q&)* * * c!fc!fc!A#hAaC9CCAFAwAQqS	!S1XaZ89 9 9 adAqD!Q$!A.88A>q!tAvax1a41Q3q!t8QT!Q$Yq[];< < < ""9b1aeeaiAaD1H5MMMMsA
9m$sD!A
9m$b"b!$002b888aAq!--/1444b"b!$002jBA6NNNNaAq!--/:aAq3IIII779
1aRjmQtBxZ]Ad2hJrMRRRR779==z"aA6666779  "a'''FFH
1#$T!Q$A+1*<%=#=#$T!Q$A+1*<%=#=#$T!Q$A+1*<%=#=? ? @ ?
 ::<4::<5   aAq!))+t333aB"**,444aB"**,44488:4R>))))779%QTAqD[1a4%7 8!<<<<<""2z!Q1'=>$FFF""2z!RR'@ATIII""2z!QB'?@DHHH""2z!Q1'=>$FFF""2z!Q1'=>$FFF""2z!Q1'=>%GGG""2z!Q1'=>FFF
:>?%%1aR 1aA1aA  $(( ( ( %%1aA
1aA 6
1aA8NPSWX X X%%1aA
1aA 6
1aA8NPSXY Y Y%%1aA1aA1aA  $(( ( ( : C D aAq!**:aAq+ABdJJJaAq!**:aAq+ABeKKKaAq!**:aAq+ABJJJ
:./aAq!,,Z2q!-DEMMMaAq!,,Z1a-CDMMMaAq!,,Z1a-CDLLL
:01??
	1T#Y;r>	$s)B	$s)B!    aAq!..0Jq!Q4JJJJaAq!((*c$s)n<<<aAq!((*c$r(m;;;  "d***  "e+++aAq!446>>>r0   c                  B   \        ^^^^4      p V P                  4       ^\        ^4      ,          ^,          ^\        ^4      ,          ^,          ^\        ^4      ,          ^,          3^\        \        ^4      ^,          4      ,          38X  g   Q hV P	                  4       \        \        R^4      \        ^^4      \        ^^4      .\        ^^4      \        R^4      \        ^^4      .\        ^^4      \        ^^4      \        ^^4      ..4      8X  g   Q hV P	                  R4      \        \        R^4      \        ^^4      \        ^^4      \        ^^4      .\        ^^4      \        R^4      \        ^^4      \        P                  .\        ^^4      \        ^^4      \        ^^4      \        R^4      .\        P                  \        P                  \        P                  \        P                  ..4      8X  g   Q h\        RRR7      p\        \        V^,          4      ^ ^ \        V^,          4      4      p\        VP	                  4       4      \        \        V4      \        V4      ) ^ .\        V4      \        V4      ^ .. RO.4      8X  g   Q hVP                  4       ^ ^ \        V^,          4      \        \        V^,          4      4      ,          3^\        \        V^,          4      4      ,          38X  g   Q h\        VP	                  R4      4      \        \        V4      \        V4      ) ^ \        V4      \        V4      ,
          ^,           .\        V4      \        V4      ^ \        V4      ) \        V4      ,
          ^,           .. R	O. R
O.4      8X  g   Q hR# )r2   thetaTro   Nr   r   rC   r1   r]   r^   )r   to_axis_angler   r   rW   r   r   r
   Zeror   r   r   r   r   r   )r@   r   r9   s      r-   test_quaternion_conversionsr     s   	Aq!Q	B1tBx<?#$tBx<?#$tBx<?#4 $%tDHRK'8#8": : : :
 !!#Xb!_hq"oxB7GHa^Xb!_hq!nEa^Xb"%5x2GI JJ K J
 !!),"a(1b/8B3CXaQR^T!Q"a(1a.!&&I!Q"b!18Ar?HRQROT/	1 22 3 2 G$'E	CaL!QE!G	5BB))+,03E
SZK/K03E
SZ/K/K8M 1N N N N
 1aU1Wc#eAg,6G)G"H#$T#eAg,%7#7"9 9 9 9 B)))45E
SZKCJU,Ca,GHE
SZSZK#e*,Dq,HI//	A1 :2 2 2 2r0   c                     \        \        \        \        \        4      p V P                  R R7      V P                  4       ^,          ,          p\        V P                  RR7      V P                  4       ^,          ,          4      pW8X  g   Q hR# )T)homogeneousFN)r   r*   r+   r3   r,   rW   r?   r   )r8   rX   rY   s      r-    test_rotation_matrix_homogeneousr   ;  sd    1aAA	
		$		/!&&(A+	=B	!&&5&9AFFHaKG	HB8O8r0   c            
     D   \        \        \        ^,          4      \        \        ^,          4      ^ ^ 4      p \	        V P                  4       4      \        . RO^ \        \        4      \        \        4      ) .^ \        \        4      \        \        4      ..4      8X  g   Q hR# )a  
There was a sign mistake in the definition,
of the rotation matrix. This tests that particular sign mistake.
See issue 1593 for reference.
See wikipedia
https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Quaternion-derived_rotation_matrix
for the correct definition
Nr\   )r   r   r"   r   r   rW   r   r   s    r-    test_quaternion_rotation_iss1593r   B  sy     	3s1u:s3q5z1a0AA((*+v(CHs3xi(CHs3x(7* 0+ + , +r0   c            	      2   \        ^^\        ,          ,           ^^\        ,          ,           ^ ^^\        ,          ,           RR7      p \        ^^^^4      p\        ^^^\        4      p\         P                  ! \	        ^4      \        P
                  4      ^8X  g   Q h\         P                  ! \	        ^4      V 4      \        ^^\        ,          ,           ^^\        ,          ,           ^ ^^ \        ,          ,           4      8X  g   Q hVP                  ^4      \        ^^^^
4      8X  g   Q hVP                  V4      \        R	\        ,          ^,
          ^\        ,          ^,
          ^	^\        ,          ,
          \        ^,           4      8X  g   Q hVP                  V4      W,          8X  g   Q h\        RRR7      p\        \        V4      \        V4      ^ ^ 4      p\        \        RRR7      !  pW5,          WE,          8X  g   Q hWS,          WT,          8X  g   Q hR# )
re   Frx   r,   Trm   zq:4ro   Nrz   )
r   r   r3   _generic_mulr
   r   mulr   r   r   )r@   r9   r;   r,   z_quatr8   s         r-   test_quaternion_multiplicationr   R  s   	A!GQ1WaQqSu	EB	Aq!Q	B	Aq!Q	B""1Q4/1444##AaD"-rBqDy!bd(ArBqDy9: ; :66!9
1aB////66":BqD1HacAgq1Q3wAFFFF66":T"A1r!ua+FGE-.A5FJ5AJr0   c                    a \        ^ ^ ^ ^ 4      o\        \        V3R l4       \        ^^^^4      p V P                  4       w  r\         P                  ! RW34      \
        P                  ^,          ^\        ^4      ^,          38X  g   Q h\        R^^^4      p \        ^4      ) ^,          \        ^4      ) ^,          \        ^4      ) ^,          3p^\        ,          ^,          pW3V P                  4       8X  g   Q hR# )r   c                     < ^S ,          # )r2   rr   r   s   r-   r.   "test_issue_16318.<locals>.<lambda>i  s	    qtr0   NrC   r   )	r   r   r7   r   r   r
   r   r   r	   )r8   r`   ra   r{   s      @r-   test_issue_16318r   f  s    	Aq!Q	B
:|$1aAAOO%MT""9tm<AqQRtVWx@XXXX2q!QA!WHQJa
T!WHQJ/DbDFE=AOO----r0   c                  @   \        \        \        \        \        4      p V P                  4       p. ROpY" Uu. uF  q3P                  4       NK  	  up,          pV F;  pV P                  V4      p\        \         P                  ! WC4      4      pWQ8X  d   K;  Q h	  R# u upi )zxyN)r   zyxzyzzxz)
r   r*   r+   r3   r,   r   upperto_eulerr   
from_euler)r8   q_normalizedseqsseqeuler_from_qq_backs         r-   test_to_eulerr   u  s|    1aAA;;=L'DD)DSYY[D))Dzz#*//BC%%%  *s   Bc                     \         P                  ! \        ^ ^ 3R4      p \        V P	                  R4      RR7      \        ^ ^ 38X  g   Q hR# )zS
There was a mistake in the degenerate case testing
See issue 24504 for reference.
r   Tr   N)r   r   r"   r   r   r   s    r-   test_to_euler_iss24504r     s@    
 	sAqk51AAJJu%t4aCCCr0   c                     R  p V ! \         ^,          ^ ^ 3R4       V ! \         ^,          ^ ^ 3R4       V ! \         ^,          \         ^ 3R4       V ! \         ^,          \         ^ 3R4       V ! \         ^,          \         ^,          ^ 3R4       V ! \         ^,          \         ) ^,          ^ 3R4       V ! \         ^,          \         ^,          ^ 3R4       V ! \         ^,          \         ) ^,          ^ 3R4       R# )c                 b    \         P                  ! W4      pVP                  V4      V 8X  g   Q hR # r)   )r   r   r   )anglesr   r8   s   && r-   test_one_case<test_to_euler_numerical_singilarities.<locals>.test_one_case  s(    !!&.zz#&(((r0   r   ZYZr   ZYXN)r	   )r   s    r-   %test_to_euler_numerical_singilaritiesr     s    )
 2a4!Q-'2a4!Q-'2a4"a.%(2a4"a.%( 2a4"Q$"E*2a42#a%#U+2a4"Q$"E*2a42#a%#U+r0   c            	      `  a V3R  lp R F  p\        V4       F  pR F  pV'       d+   RP                  V^ ,          V^,          V^ ,          .4      oMRP                  V4      o\        . RO^R7       F,  p\        V!  pVP	                  4       '       d   K$  V ! V4       K.  	  K  	  K  	  K  	  R# )c                 .  < \        V P                  SR R 4      4      p\        V P                  SRR4      4      p\        W,
          4      P                  4       pV F6  pV\        ,           ^\        ,          ,          \        ,
          pVR8  d   K6  Q h	  R# )TFgư>N)r   r   r   r   r	   )r8   angles1angles2angle_errorsangle_errorr   s   &    r-   r   ,test_to_euler_options.<locals>.test_one_case  sv    Ct45C670668'K&+B7"<K&&& (r0    )repeatN)xyzXYZ)TF)r   r   r2   )r    joinr!   r   rM   )r   r   	seq_tuple	symmetricelementsr8   r   s         @r-   test_to_euler_optionsr     s    ' %c*I*	''9Q<1y|"LMC''),C '
1 =H"H-A//11%a( !> + + r0   )Hsympy.testing.pytestr   sympy.core.functionr   r   sympy.core.numbersr   r   r   r	   sympy.core.singletonr
   sympy.core.symbolr   r   $sympy.functions.elementary.complexesr   r   r   r   r   &sympy.functions.elementary.exponentialr   (sympy.functions.elementary.miscellaneousr   (sympy.functions.elementary.trigonometricr   r   r   r   r   r   sympy.integrals.integralsr   sympy.matrices.denser   sympy.simplifyr   sympy.simplify.trigsimpr   sympy.algebras.quaternionr   r   rD   	itertoolsr    r!   r*   r+   r3   r,   r"   r<   rA   rI   rQ   rZ   rc   rk   r|   r   r   r   r   r   r   r   r   r   r   r   r   rr   r0   r-   <module>r      s    % $ & 3 3 " / O O 6 9 X X / ' # , 0 '  +U^
1aen8$)';P$4B4
H}?~#2L, (. 
& 
&D,& ) )r0   