
    sg[                        d dl Z d dlZd dlZd dlmZ d dlmZmZmZ d dl	m
Z
mZ d dlmZ d dlmZmZmZmZ d dlmZmZmZmZmZmZmZmZmZmZ d dlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z% d d	l&m'Z' d d
l(m)Z) d dl*m+Z+ d dl,m-Z-m.Z.m/Z/m0Z0m1Z1 d dl2m3Z3 d dl4m5Z5 d dl6m7Z8 d dl9m:Z: d dlm;Z; d dlm<Z< d dl=m>Z>  e>d      Z?ddhZ@ddhZAg ddfdZBd ZCd ZDd ZEd ZFd  ZGd! ZHd" ZId# ZJd$ ZKd% ZLd& ZMed'        ZNd( ZOd) ZPd* ZQd d+lRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcmdZdmeZemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZumvZvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d, Zd d-lmZ d d.lmZ d d/lmZmZ d d0lmZmZmZmZ d d1lmZmZmZ d2 Zd d3lmZ d4 Zd d5lmZ d6 Zd d7lmZmZ d8 Zd d9lmZ d: Zd d;lmZ d d<lmZ d= Zed>        Zed?        Zd d@lmZ d dAlmZ d dBlmZ d dClmZ dD ZdE ZedF        ZdG ZdH ZdI ZdJ ZdK ZdL ZdM Zd dNlmZ d dOlmZmZ d dPlmZ d dQlmZmZ d dRlmZ d dSlmZ dT ZedU        ZedV        ZedW        Zd dXlmZ d dYlmZ dZ Zd d[lmZ d d\lmZ d] Zd^ Zd_ Zd` Zy)a    N)meter)XFAILraisesignore_warnings)AtomBasic)SingletonRegistry)StrDummySymbolWild)
EIpioozoonanIntegerRationalFloatAlgebraicNumber)EqualityGreaterThanLessThan
RelationalStrictGreaterThanStrictLessThan
Unequality)Add)Mul)Pow)
DerivativeFunctionFunctionClassLambdaWildFunction)Interval)	vectorize)gmpy)SymPyDeprecationWarning)S)symbols)import_modulecloudpickle_assumptions_mhashis_EmptySetexpr_free_symbolsT c                    	 t         t              rdD ]  	t        t         	fd        dt        j                  t        j
                  ddg}t        r|j                  t        g       |D ]  		|v rt        	      rt         t              r$ 	       }n_t        j                  	      r!	j                  	j                               }n)t        j                  t        j                   	            }t               }t        |      }t!        |      t!        |      k(  sJ |s	fd} | ||        || |        y)z2 Check that pickling and copying round-trips.
    )r      c                  0    t        j                         S N)pickledumps)aprotocols   V/var/www/html/venv/lib/python3.12/site-packages/sympy/utilities/tests/test_pickling.py<lambda>zcheck.<locals>.<lambda>4   s    Q0I              c                    |D ]  }|t         v r!t        | |      st        ||      r%J |       |t        v s|v r:t        t              5  t        | |      t        ||      k(  sJ |       	 d d d        rt        | |      st        | |      }t        |d      rt        ||      sJ |       t        ||      |k(  rJ t        ||      d|d        y # 1 sw Y   xY w)N__call__z != z, protocol: )not_equal_attrshasattrdeprecated_attrsr   r*   getattr)r:   bdiattr
deprecatedr;   s        r<   czcheck.<locals>.cO   s     q'q!}&q!}/a/}**a:o()@A A&q!}1=@q@=A A A"1a=D"44&q!}/a/}&q!}4pRYZ[]^R_aego6pp4q
A As   !CC#	N)
isinstancer   r   NotImplementedErrorcopydeepcopyr.   extendcallabletypeinspectismoduleloadsr9   r8   dirset)
r:   exclude
check_attrrL   	protocolsrH   d1d2rM   r;   s
   `  `     @r<   checkr_   .   s    !U 	KH&(IJ	K DIIt}}a3I+' &wH!T"Ah'x~~a01AV\\!X67AVV2w#b'!!!	q  	
!Q	!QM&r>   c                  t    t         t               t        t               t        t        fD ]  } t	        |         y r7   )r   r   r	   r+   r_   rM   s    r<   test_core_basicrb   g   s*    DFE57,=qA ar>   c                  ,    t        t        d             y Nx)r_   r
   r3   r>   r<   test_core_Strrf   k   s    	#c(Or>   c                      t         t        dd      t        t        dd      t        t        d      fD ]  } t        |         y )Nre   F)commutative_issue_3130)r   r   r   r_   ra   s    r<   test_core_symbolrj   n   s=     U3E2F=e4dDIG ar>   c                      t        d      t        dd      t        d      fD ]  } t        |         t        t	        t        d            fD ]  } t        | d        y )Nr?   r@   z1.2Fr[   )r   r   r   r_   r   sqrtra   s    r<   test_core_numbersrn   w   sT    aj(1a.%,7 atAw78 #aE"#r>   c                  6    t        d      dz   } t        |        y )Nre   g      ?)r   r_   )ys    r<   test_core_float_copyrq   ~   s    scA	!Hr>   c                  4   t        d      } t        d      }t        t        | |      t        t        | |      t        t        | |      t        t	        | |      t
        t        | |      t        t        | |      t        t        | |      fD ]  }t        |        y )Nre   rp   )	r   r   r   r   r   r   r   r   r_   )re   rp   rM   s      r<   test_core_relationalrs      s    sAsAA[A5FA
Jq!4D!21a!8.Q"J
1a0@B  	a	r>   c                  ^    t        d      } t        t        | d      fD ]  }t        |        y Nre   rA   )r   r   r_   re   rM   s     r<   test_core_addrw      ,    sA3q!9 ar>   c                  ^    t        d      } t        t        | d      fD ]  }t        |        y ru   )r   r    r_   rv   s     r<   test_core_mulrz      rx   r>   c                  ^    t        d      } t        t        | d      fD ]  }t        |        y ru   )r   r!   r_   rv   s     r<   test_core_powerr|      rx   r>   c                      t        d      } t        t        |       t        t        t        t
        fD ]  }t        |        y rd   )r   r"   r#   r$   r%   r&   r_   )re   fs     r<   test_core_functionr      s5    sA*Q-=& ar>   c                      t        d      } t        t        d            }|j                  t               t        | |       y )Nr~      rZ   )r#   listrangeappendr.   r_   )r~   rZ   s     r<   test_core_undefinedfunctionsr      s0    A58nG NN;	!Wr>   c                  0    t        d      } t        |        y )Nr~   )r#   r_   )r~   s    r<   !test_core_undefinedfunctions_failr      s     	A	!Hr>   c                  H    t         t        dd      fD ]  } t        |         y )Nr   r?   )r'   r_   ra   s    r<   test_core_intervalr      s#    A' ar>   c                  F    t         t        d      fD ]  } t        |         y )Nr   )r(   r_   ra   s    r<   test_core_multidimensionalr      s!    1& ar>   c                  "   g d} t         j                   t         j                  g}|| D cg c]  fd	 c}z  }t        r|d gz  }t        d      t        d      t        d      t	        dd      t
        t        t        t        t         t        t        t        j                  t        j                  t        j                  t        j                  t        j                   t        j"                  fD ]  }|D ]  } ||      |u rJ   y c c}w )N)r   r5   r?   r@   rA   c                 V    t        j                  t        j                  |             S r7   )r8   rW   r9   )re   protos    r<   r=   z!test_Singletons.<locals>.<lambda>   s    &,,v||Au'=> r>   c                 R    t         j                  t         j                  |             S r7   )r.   rW   r9   )re   s    r<   r=   z!test_Singletons.<locals>.<lambda>   s    k//0A0A!0DE r>   r   r5   r?   )rP   rQ   r.   r   r   r   r   r   r   r   r   r+   GoldenRatioTribonacciConstant
EulerGammaCatalanEmptySetIdentityFunction)r\   copiersr   objfuncs     `  r<   test_Singletonsr      s    Iyy$--(G"$ ? $ $GEFFWQZXa^RAS#q}}a.B.BLL!))QZZ1C1CE $  	$D9###	$$$s   D);	Piecewise
lowergammaacosh
chebyshevu
chebyshevtlnchebyshevt_rootlegendre	Heaviside	bernoullicothtanhassoc_legendresignargasin
DiracDeltarerfAbs
uppergammabinomialsinhcoscotacosacotgammabellhermiteharmonicLambertWzetalog	factorialasinhacothcoshdirichlet_etaEijkloggammaerfceilingim	fibonacci
tribonacci	conjugatetanchebyshevu_rootflooratanhrm   sinatanfflucasatan2	polygammaexpc                     g t         t        t        t        t        t
        t        t        t        t        t        t        t        t        t        t        t         t"        t$        t&        t(        t*        t,        t.        t        t0        t2        t4        t6        t8        t:        t<        t>        t@        tB        tD        tF        tH        tJ        tL        tN        tP        tR        } tT        tV        tX        tZ        t\        t^        t`        tb        td        tf        th        f}tk        d      \  }}}tl        tn        tq        |||      ts        d|dk  f|dz  |dk  f|dz  df      tt        f}| D ]   }tw        |        ||      }tw        |       " |D ]!  }tw        |        |||      }tw        |       # |D ]  }tw        |        y )Nx,y,zr   r   r?   r5   r@   T)<r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r,   r   r   r   r   r   r_   )one_vartwo_varre   rp   zothersclsrM   s           r<   test_functionsr      s   Mu Mb M) MY M	 M4 M MMMM'M)+M-0M26M8;M=@MBFMHLMMM!M#+M-1M36M8AMCHM M M 'M )1M 36M 8?M ACM ENM 	M "	M $'	M ).	M 05	M 7:	M <@	M BG	M IL	MG
 2z:z89gx=GgGAq!Q11r6{QT16NQT4LAF  c
Fa  c
1Ia  c
r>   )GeometryEntity)Point)CircleEllipse)LineLinearEntityRaySegment)PolygonRegularPolygonTrianglec                     t        dd      } t        dd      }t        dd      }t        dd      }t        t               t         | t        t        | d      t        t        | dd      t        t	        | |      t
        t        | |      t        t        | |      t        t        | |      t        t        | |||      t        t        | dd      t        t        | ||      fD ]  }t        |d        y )	Nr5   r?   r@   r   rA   r   Frl   )r   r   r   r   r   r   r   r   r   r   r   r_   )p1p2p3p4rM   s        r<   test_geometryr      s    	q!B	q!B	q!B	q!B(%VVB]Q"D$r2,Rc3r2;RRR(.2q!$hR0DF # 	aE"#r>   )Integralc                  \    t        d      } t        t        |       fD ]  }t        |        y rd   )r   r   r_   rv   s     r<   test_integralsr     s*    sA$ ar>   )Logicc                  F    t         t        d      fD ]  } t        |         y Nr5   )r   r_   ra   s    r<   
test_logicr     s!    U1X ar>   )MatrixSparseMatrixc                  |    t         t        g d      t        t        ddgddgg      fD ]  } t        | ddg        y )	Nr5   r?   r@   r5   r?   r@   rA   _smat_matrL   )r   r   r_   ra   s    r<   test_matricesr     sA    fY'|aVaQRVDT7UV /aWf-./r>   )Sievec                  D    t         t               fD ]  } t        |         y r7   )r   r_   ra   s    r<   test_ntheoryr   $  s    UW ar>   )Pauli)Unitc                  Z    t         t        t        t        d      fD ]  } t        |         y r   )r  r   r  r_   ra   s    r<   test_physicsr  -  s%    E5%(+ ar>   c                  8   ddl m} m} ddlm} ddlm}m} ddlm	}m
}m}m} ddlm}	 ddlm}
 ddlm} dd	lm} dd
lm} ddlm}m}m}m}m}m}m}m} ddl m!} ddl"m#} ddl$m%} |  | dd      ||||||||||	|
||||||||||||||fD ]  }tM        |        y )Nr   )ColorGradientColorScheme)ManagedWindow)Plot
ScreenShot)PlotAxesPlotAxesBasePlotAxesFramePlotAxesOrdinate)
PlotCamera)PlotController)	PlotCurve)PlotInterval)PlotMode)Cartesian2DCartesian3DCylindricalParametricCurve2DParametricCurve3DParametricSurfacePolar	Spherical)
PlotObject)PlotSurface)
PlotWindowg?g?)'&sympy.plotting.pygletplot.color_schemer  r  (sympy.plotting.pygletplot.managed_windowr  sympy.plotting.plotr	  r
  #sympy.plotting.pygletplot.plot_axesr  r  r  r  %sympy.plotting.pygletplot.plot_camerar  )sympy.plotting.pygletplot.plot_controllerr  $sympy.plotting.pygletplot.plot_curver  'sympy.plotting.pygletplot.plot_intervalr  #sympy.plotting.pygletplot.plot_moder  $sympy.plotting.pygletplot.plot_modesr  r  r  r  r  r  r  r  %sympy.plotting.pygletplot.plot_objectr  &sympy.plotting.pygletplot.plot_surfacer  %sympy.plotting.pygletplot.plot_windowr  r_   )r  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rM   s                             r<   test_plottingr,  5  s    QF4kk@H>D<R R R@B@}S#.]tZ<'^<;&(95)Z  	ar>   c                      ddl m}  ddlm} ddlm} t         | d             t         |dd             t         |              y )	Nr   )r  )r	  )r  rainbowr5   F)visible)r  r  r!  r	  r"  r  r_   )r  r	  r  s      r<   test_plotting2r0  P  s6     C(< 
+i
 !	$q%
 !	(*r>   )ZZ)QQ)lex)Polyc                      ddl m}  t        d      }t        t        ||      fD ]  }t	        |        |  | |      fD ]  }t	        |        y )Nr   )PurePolyre   )sympy.polys.polytoolsr6  r   r4  r_   )r6  re   rM   s      r<   test_pickling_polys_polytoolsr8  m  sP    .sADAJ a $ ar>   c            	         ddl m} m}m} |  | t	        d      gt	        d      gt	        d      ggt              fD ]  }t        |dg        | |t	        d      t	        d      gt	        d      t	        d      gft              fD ]  }t        |        | |t        d      t        d      gt        d      t        d      t        d      gt              fD ]  }t        |        y )Nr   )DMPDMFANPr5   r?   r@   repr   )sympy.polys.polyclassesr:  r;  r<  r1  r_   r2  )r:  r;  r<  rM   s       r<   test_pickling_polys_polyclassesr?  |  s    553A"Q%2a5'2B78 %aUG$%3A1A17<= a31r!u~1r!ube'<bAB ar>   c                      ddl m}   | dt        t              }| |fD ]  }t	        |ddg        |j
                  |j                  fD ]  }t	        |ddgd        y )Nr   )PolyRingr   r5   r   F)rZ   r[   )sympy.polys.ringsrA  r1  r3  r_   dtypeone)rA  ringrM   s      r<   test_pickling_polys_ringsrF    se    
 +GR%D !a!Q ! jj$((# 3a!QE23r>   c                       y r7   r3   r3   r>   r<   test_pickling_polys_fieldsrH    s    r>   c                  F    ddl m}  |  | dd      fD ]  }t        |        y )Nr   )PythonRationalr5      )"sympy.polys.domains.pythonrationalrJ  r_   )rJ  rM   s     r<   test_pickling_polys_elementsrM    s)    A nQ23 ar>   c                     ddl m}  ddlm} |  |        fD ]  }t	        |d        | |       fD ]  }t	        |d        t
        Bddlm} ddlm	} | |       fD ]  }t	        |d        | |       fD ]  }t	        |d        ddl
m} dd	lm} | |t        t        d
            fD ]  }t	        |d        | |       fD ]  }t	        |d        y )Nr   )PythonIntegerRing)PythonRationalFieldFrl   )GMPYIntegerRing)GMPYRationalField)AlgebraicField)ExpressionDomainr@   )%sympy.polys.domains.pythonintegerringrO  'sympy.polys.domains.pythonrationalfieldrP  r_   _gmpy#sympy.polys.domains.gmpyintegerringrQ  %sympy.polys.domains.gmpyrationalfieldrR  "sympy.polys.domains.algebraicfieldrS  $sympy.polys.domains.expressiondomainrT  r2  rm   )rO  rP  rM   rQ  rR  rS  rT  s          r<   test_pickling_polys_domainsr\    s    GK  !2!45 #aE"# "#6#89 #aE"# GK "?#45 	'A!&	' $%6%89 	'A!&	'
 B F nRa9: #aE"#  0 23 #aE"#r>   c                      ddl m} m}m}m} |  |        fD ]  }t        |        | |       fD ]  }t        |        | |       fD ]  }t        |        | | |              fD ]  }t        |        y )Nr   )LexOrderGradedLexOrderReversedGradedLexOrderInverseOrder)sympy.polys.orderingsr^  r_  r`  ra  r_   )r^  r_  r`  ra  rM   s        r<   test_pickling_polys_orderingsrc    s    . . 
# a n./ a %&<&>? a L45 ar>   c                      ddl m} m} t        d      \  }}}|  | d      fD ]  }t	        |        | |d|||f      fD ]  }t	        |        y )Nr   )MonomialOpsMonomialr   r@   r   )sympy.polys.monomialsre  rf  r,   r_   )re  rf  re   rp   r   rM   s         r<   test_pickling_polys_monomialsrh    s^    ;gGAq!;q>* a Q1I67 ar>   c                     ddl m} m}m}m}m}m}m}m}m	}m
}	m}
m}m}m}m}m}m}m}m} |  |        fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        |	 |	       fD ]  }t)        |        |
 |
       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        | |       fD ]  }t)        |        y )Nr   )HeuristicGCDFailedHomomorphismFailedIsomorphismFailedExtraneousFactorsEvaluationFailedRefinementFailedCoercionFailedNotInvertibleNotReversibleNotAlgebraicDomainErrorPolynomialErrorUnificationFailedGeneratorsErrorGeneratorsNeededUnivariatePolynomialErrorMultivariatePolynomialErrorOptionError	FlagError)sympy.polys.polyerrorsrj  rk  rl  rm  rn  ro  rp  rq  rr  rs  rt  ru  rv  rw  rx  ry  rz  r{  r|  r_   )rj  rk  rl  rm  rn  ro  rp  rq  rr  rs  rt  ru  rv  rw  rx  ry  rz  r{  r|  rM   s                       r<   test_pickling_polys_errorsr~    s        ( !"4"67 a !"4"67 a  !2!45 a  !2!45 a  0 23 a  0 23 a n./ a ]_- a ]_- a LN+ a ;=) a 01 a  !2!45 a 01 a  0 23 a ()B)DE a *+F+HI a ;=) a % ar>   c                      ddl m} m} t        d      }|dz  |z   dz   }|  | |d      fD ]  }t	        |        | ||t
              fD ]  }t	        |        y )Nr   )CRootOfRootSumre   r@   )sympy.polys.rootoftoolsr  r  r   r_   r   )r  r  re   r~   rM   s        r<   test_pickling_polys_rootoftoolsr  }  sc    8sA	1q1Awq!}% a wq#' ar>   )LatexPrinter)MathMLContentPrinterMathMLPresentationPrinter)PrettyPrinter)
prettyForm
stringPict)Printer)PythonPrinterc                      t         t               t        t        t        t        t
        t        d      t        t               t        t               fD ]  } t        |         y )Nr:   )	r  r  r  r  r  r  r  r  r_   ra   s    r<   test_printingr    sC    LN,@'
Jow	=o  	a	r>   c                  *    t        t                      y r7   )r_   r  r3   r>   r<   test_printing1r    s    	

 !r>   c                  *    t        t                      y r7   )r_   r  r3   r>   r<   test_printing2r    s    	
#
%&r>   c                  *    t        t                      y r7   )r_   r  r3   r>   r<   test_printing3r    s    	-/r>   )Limit)Orderc                      t        d      } t        d      }t        t        | |d      t        t        |       fD ]  }t        |        y )Nere   r5   )r   r  r  r_   )r  re   rM   s      r<   test_seriesr    s?    sAsAU1a^UE!H5 ar>   )Product)Sumc            	          t        d      } t        t        | | ddf      t        t        | | ddf      fD ]  }t        |        y )Nre   r?   rA   )r   r  r  r_   rv   s     r<   test_concreter    sD    sAwq1a),c3q1a)3DE ar>   c                  6    t        ddd      } t        |        y )Nmessagez1.0zactive-deprecations)deprecated_since_versionactive_deprecations_target)r*   r_   )ws    r<   test_deprecation_warningr    s    	Ef{|A	!Hr>   c                      t        j                  t        j                  t        j                              t        j                  k(  sJ y r7   )r8   rW   r9   r+   Halfr3   r>   r<   test_issue_18438r    s*    <<QVV,-777r>   c                  N    d} t        j                  |       t        d      k(  sJ y )Nsi   ^       sympy.core.powerPowsympy.core.numbersIntegerKR}bhHalf)R}bR}b.r?   )r8   rW   rm   )datas    r<   !test_unpickle_from_older_versionsr    s)    	8 	 <<a(((r>   )rU   rP   r8   sympy.physics.unitsr   sympy.testing.pytestr   r   r   sympy.core.basicr   r   sympy.core.singletonr	   sympy.core.symbolr
   r   r   r   sympy.core.numbersr   r   r   r   r   r   r   r   r   r   sympy.core.relationalr   r   r   r   r   r   r   sympy.core.addr   sympy.core.mulr    sympy.core.powerr!   sympy.core.functionr"   r#   r$   r%   r&   sympy.sets.setsr'   sympy.core.multidimensionalr(   sympy.external.gmpyr)   rW  sympy.utilities.exceptionsr*   r+   r,   sympy.externalr-   r.   rD   rF   r_   rb   rf   rj   rn   rq   rs   rw   rz   r|   r   r   r   r   r   r   sympy.functionsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rm   r   r   r   r   r   r   r   r   sympy.geometry.entityr   sympy.geometry.pointr   sympy.geometry.ellipser   r   sympy.geometry.liner   r   r   r   sympy.geometry.polygonr   r   r   r   sympy.integrals.integralsr   r   sympy.core.logicr   r   sympy.matricesr   r   r   sympy.ntheory.generater   r   sympy.physics.paulialgebrar  r  r  r,  r0  sympy.polys.domains.integerringr1  !sympy.polys.domains.rationalfieldr2  rb  r3  r7  r4  r8  r?  rF  rH  rM  r\  rc  rh  r~  r  sympy.printing.latexr  sympy.printing.mathmlr  r  sympy.printing.pretty.prettyr   sympy.printing.pretty.stringpictr  r  sympy.printing.printerr  sympy.printing.pythonr  r  r  r  r  sympy.series.limitsr  sympy.series.orderr  r  sympy.concrete.productsr  sympy.concrete.summationsr  r  r  r  r  r3   r>   r<   <module>r     s      % ? ? ( 2 6 6* * *7 7 7      $ 1 - > " % (M*    DR 2r#  

$ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 1 & 2 @ @ D D# / #
 0/
 )
 - $  4  . / 0 % &	 3 3	"09#x0TB
 . Q 6 C * / " " ' '   & $ , )
8
)r>   