o
    8VaY                     @   s  d dl Z d dlZd dlZd dlmZ d dlmZmZ d dlm	Z	m
Z
 d dl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 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l6m7Z7 d dl8m9Z9 d dl:m;Z;m<Z< d dl=m>Z> e>dZ?h dZ@g dfddZAdd ZBdd ZCdd ZDdd  ZEd!d" ZFd#d$ ZGd%d& ZHd'd( ZId)d* ZJd+d, ZKd-d. ZLed/d0 ZMd1d2 ZNd3d4 ZOd5d6 ZPd d7lQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcmdZdmeZemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZumvZvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~mZmZmZmZmZmZmZmZmZmZmZmZmZmZ d8d9 Zd d:lmZ d d;lmZ d d<lmZmZ d d=lmZmZmZmZ d d>lmZmZmZ d?d@ Zd dAlmZ dBdC Zd dDlmZ dEdF Zd dGlmZmZ dHdI Zd dJlmZ dKdL Zd dMlmZ d dNlmZ dOdP ZedQdR ZedSdT Zd dUl:mZmZmZmZ dVdW ZdXdY ZedZd[ Zd\d] Zd^d_ Zd`da Zdbdc Zddde Zdfdg Zdhdi Zdjdk Zd dllmZ d dmlmZmZ d dnlmZ d dolmZmZ d dplmZ d dqlmZ drds Zedtdu Zedvdw Zedxdy Zd dzlmZ d d{lmZ d|d} Zd d~lmZ d dlmZ dd Zdd Zdd ZdS )    N)meter)XFAILraises)AtomBasic)	BasicMeta)SingletonRegistry)StrDummySymbolWild)	EIpioozoonanIntegerRationalFloat)EqualityGreaterThanLessThan
RelationalStrictGreaterThanStrictLessThan
Unequality)Add)Mul)Pow)
DerivativeFunctionFunctionClassLambdaWildFunction)Interval)	vectorize)HAS_GMPY)SymPyDeprecationWarning)symbolsS)import_modulecloudpickle>   _mat_smat_mhashis_EmptySet_assumptionsexpr_free_symbolsTc                    s   t  trdD ]tt fdd qdtjtjddg}tr%|tg |D ]T|v r.q'tr=t  t	r8q' }nt
rK }n	tt }t }t|}t|t|ksfJ |siq'fdd}| || || | q'd	S )
z2 Check that pickling and copying round-trips.
    )r      c                      s   t  S N)pickledumps aprotocolr7   E/usr/lib/python3/dist-packages/sympy/utilities/tests/test_pickling.py<lambda>1   s    zcheck.<locals>.<lambda>         c                    sp   |D ]3}|t v r	qt| |sqt| |}t|ds5t||s"J |t|||ks5J dt||| f qd S )N__call__z%s != %s, protocol: %s)excluded_attrshasattrgetattr)r9   bdiattr)r:   r7   r;   cL   s   


&zcheck.<locals>.cN)
isinstancer   r   NotImplementedErrorcopydeepcopyr,   extendcallabler   inspectZismoduleloadsr6   r5   dirset)r9   exclude
check_attr	protocolsrD   Zd1Zd2rH   r7   r8   r;   check+   s2   



rV   c                  C   s&   t t  tt ttfD ]} t|  q
d S r4   )r   r   r   r*   rV   rH   r7   r7   r;   test_core_basic_   s   
rX   c                   C   s   t td d S Nx)rV   r	   r7   r7   r7   r;   test_core_Strg   s   r[   c                  C   s6   t t dddttdddttdfD ]} t|  qd S )NrZ   F)ZcommutativeZ_issue_3130)r
   r   r   rV   rW   r7   r7   r;   test_core_symbolj   s
   
r\   c                  C   s*   t dtddtdfD ]} t|  qd S )Nr=   r>   z1.2)r   r   r   rV   rW   r7   r7   r;   test_core_numberss   s   
r]   c                  C   s   t dd } t|  d S )NrZ   g      ?)r   rV   )yr7   r7   r;   test_core_float_copyx   s   r_   c                  C   sl   t d} t d}tt| |tt| |tt| |tt| |tt| |tt| |tt| |fD ]}t| q-d S )NrZ   r^   )	r   r   r   r   r   r   r   r   rV   )rZ   r^   rH   r7   r7   r;   test_core_relational~   s   
r`   c                  C   (   t d} tt| dfD ]}t| qd S NrZ   r?   )r   r   rV   rZ   rH   r7   r7   r;   test_core_add      
rd   c                  C   ra   rb   )r   r   rV   rc   r7   r7   r;   test_core_mul   re   rf   c                  C   ra   rb   )r   r   rV   rc   r7   r7   r;   test_core_power   re   rg   c                  C   s.   t d} tt| ttttfD ]}t| qd S rY   )r   r    r!   r"   r#   r$   rV   )rZ   fr7   r7   r;   test_core_function   s   
ri   c                  C   s.   t d} ttd}|t t| |d d S )Nrh      rS   )r!   listrangeappendr,   rV   )rh   rS   r7   r7   r;   test_core_undefinedfunctions   s   
ro   c                  C   s   t d} t|  d S )Nrh   )r!   rV   )rh   r7   r7   r;   !test_core_undefinedfunctions_fail   s   rp   c                  C   s    t t ddfD ]} t|  qd S )Nr   r=   )r%   rV   rW   r7   r7   r;   test_core_interval   s   
rq   c                  C      t t dfD ]} t|  qd S )Nr   )r&   rV   rW   r7   r7   r;   test_core_multidimensional      
rs   c                  C   s   g d} t j t jg}|dd | D 7 }tr|dd g7 }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 sMJ qCq?d S )
N)r   r3   r=   r>   r?   c                    s   g | ]  fd dqS )c                    s   t t |  S r4   )r5   rP   r6   rZ   protor7   r;   r<      s    z,test_Singletons.<locals>.<listcomp>.<lambda>r7   ).0r7   rv   r;   
<listcomp>   s    z#test_Singletons.<locals>.<listcomp>c                 S   s   t t | S r4   )r,   rP   r6   ru   r7   r7   r;   r<      s    z!test_Singletons.<locals>.<lambda>r   r3   r=   )rK   rL   r,   r   r   r   r   r   r   r   r   r*   ZGoldenRatioZTribonacciConstantZ
EulerGammaZCatalanZEmptySetZIdentityFunction)rU   Zcopiersobjfuncr7   r7   r;   test_Singletons   s    r}   );	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atanhsqrtsinatanfflucasatan2	polygammaexpc                  C   sp  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ttttttttt t!t"t#t$t%t&t't(t)R } t*t+t,t-t.t/t0t1t2t3t4f}t5d\}}}t6t7t8|||t9d|dk f|d |dkf|d dft:f}| D ]}t;| ||}t;| q|D ]}t;| |||}t;| q|D ]}t;| qd S )Nx,y,zr   rz   r=   r3   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   rV   )Zone_varZtwo_varrZ   r^   zZothersclsrH   r7   r7   r;   test_functions   s   
&



r   )GeometryEntity)Point)CircleEllipse)LineLinearEntityRaySegment)PolygonRegularPolygonTrianglec                  C   s   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d qMd S )	Nr3   r=   r>   r   r?   rj   FrT   )r   r   r   r   r   r   r   r   r   r   r   rV   )Zp1Zp2Zp3Zp4rH   r7   r7   r;   test_geometry   s   



r   )Integralc                  C   s&   t d} tt| fD ]}t| q
d S rY   )r   r   rV   rc   r7   r7   r;   test_integrals  s   
r   )Logicc                  C   rr   Nr3   )r   rV   rW   r7   r7   r;   
test_logic  rt   r   )MatrixSparseMatrixc                  C   s6   t t g dttddgddggfD ]} t|  qd S )Nr3   r=   r>   r3   r=   r>   r?   )r   r   rV   rW   r7   r7   r;   test_matrices  s   (
r   )Sievec                  C   s   t t  fD ]} t|  qd S r4   )r   rV   rW   r7   r7   r;   test_ntheory  s   
r   )Pauli)Unitc                  C   s"   t tttdfD ]} t|  qd S r   )r   r   r   rV   rW   r7   r7   r;   test_physics'  s   
r   c                  C   s  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 ]}t&| qd S )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   Z(sympy.plotting.pygletplot.managed_windowr   sympy.plotting.plotr   r   #sympy.plotting.pygletplot.plot_axesr   r   r   r   Z%sympy.plotting.pygletplot.plot_camerar   Z)sympy.plotting.pygletplot.plot_controllerr   Z$sympy.plotting.pygletplot.plot_curver   Z'sympy.plotting.pygletplot.plot_intervalr   Z#sympy.plotting.pygletplot.plot_moder   Z$sympy.plotting.pygletplot.plot_modesr   r   r   r   r   r   r   r   Z%sympy.plotting.pygletplot.plot_objectr   Z&sympy.plotting.pygletplot.plot_surfacer   Z%sympy.plotting.pygletplot.plot_windowr   rV   )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   rH   r7   r7   r;   test_plotting/  s.   (



r   c                  C   sN   ddl m}  ddlm} ddlm} t| d t|ddd t|  d S )	Nr   )r   )r   )r   Zrainbowr3   F)Zvisible)r   r   r   r   r   r   rV   )r   r   r   r7   r7   r;   test_plotting2J  s   r   )PolyZZQQlexc                  C   sN   ddl m}  td}tt||fD ]}t| q| | |fD ]}t| qd S )Nr   )PurePolyrZ   )Zsympy.polys.polytoolsr   r   r   rV   )r   rZ   rH   r7   r7   r;   test_pickling_polys_polytoolsd  s   

r   c                  C   s   ddl m} m}m} | | tdgtdgtdggtfD ]}t| q||tdtdgtdtdgftfD ]}t| q9||tdtdgtdtdtdgtfD ]}t| qWd S )Nr   )DMPDMFANPr3   r=   r>   )Zsympy.polys.polyclassesr   r   r   r   rV   r   )r   r   r   rH   r7   r7   r;   test_pickling_polys_polyclassess  s   *
.
2
r   c                  C   s^   ddl m}  | dtt}| |fD ]
}t|ddgd q|j|jfD ]}t|ddgdd q!d S )Nr   )PolyRingr   r3   rk   F)rS   rT   )Zsympy.polys.ringsr   r   r   rV   ZdtypeZone)r   ZringrH   r7   r7   r;   test_pickling_polys_rings}  s   r  c                   C   s   d S r4   r7   r7   r7   r7   r;   test_pickling_polys_fields  s   r  c                  C   s,   ddl m}  | | ddfD ]}t| qd S )Nr   )PythonRationalr3      )Z"sympy.polys.domains.pythonrationalr  rV   )r  rH   r7   r7   r;   test_pickling_polys_elements  s   
r  c                  C   s   ddl m}  ddlm} | |  fD ]}t|dd q|| fD ]}t|dd qtrRddlm} ddlm	} || fD ]}t|dd q;|| fD ]}t|dd qIddl
m} dd	lm} ||ttd
fD ]}t|dd qg|| fD ]}t|dd qud S )Nr   )PythonIntegerRing)PythonRationalFieldFr   )GMPYIntegerRing)GMPYRationalField)AlgebraicField)ExpressionDomainr>   )Z%sympy.polys.domains.pythonintegerringr  Z'sympy.polys.domains.pythonrationalfieldr  rV   r'   Z#sympy.polys.domains.gmpyintegerringr  Z%sympy.polys.domains.gmpyrationalfieldr	  Z"sympy.polys.domains.algebraicfieldr
  Z$sympy.polys.domains.expressiondomainr  r   r   )r  r  rH   r  r	  r
  r  r7   r7   r;   test_pickling_polys_domains  s(   

r  c                  C   s2   ddl m}  | | tdfD ]}t|dd qd S )Nr   )AlgebraicNumberr>   Fr   )Zsympy.polys.numberfieldsr  r   rV   )r  rH   r7   r7   r;    test_pickling_polys_numberfields  s   r  c                  C   s   ddl m} m}m}m} | |  fD ]}t| q|| fD ]}t| q|| fD ]}t| q)|||  fD ]}t| q7d S )Nr   )LexOrderGradedLexOrderReversedGradedLexOrderInverseOrder)Zsympy.polys.orderingsr  r  r  r  rV   )r  r  r  r  rH   r7   r7   r;   test_pickling_polys_orderings  s   


	
r  c                  C   s^   ddl m} m} td\}}}| | dfD ]}t| q||d|||ffD ]}t| q&d S )Nr   )MonomialOpsMonomialr   r>   r   )Zsympy.polys.monomialsr  r  r)   rV   )r  r  rZ   r^   r   rH   r7   r7   r;   test_pickling_polys_monomials  s   

r  c                  C   s"  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| q/|| fD ]}t| q;|| fD ]}t| qG|| fD ]}t| qS|| fD ]}t| q_|| fD ]}t| qk|| fD ]}t| qw|| fD ]}t| q|| fD ]}t| q|	|	 fD ]}t| q|
|
 fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| qd S )Nr   )HeuristicGCDFailedHomomorphismFailedIsomorphismFailedExtraneousFactorsEvaluationFailedRefinementFailedCoercionFailedNotInvertibleNotReversibleNotAlgebraicDomainErrorPolynomialErrorUnificationFailedGeneratorsErrorGeneratorsNeededUnivariatePolynomialErrorMultivariatePolynomialErrorOptionError	FlagError)Zsympy.polys.polyerrorsr  r  r  r  r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r(  r)  rV   )r  r  r  r  r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r(  r)  rH   r7   r7   r;   test_pickling_polys_errors  sP   T

















r*  c                  C   sd   ddl m} m} td}|d | d }| | |dfD ]}t| q|||tfD ]}t| q)d S )Nr   )CRootOfRootSumrZ   r>   )Zsympy.polys.rootoftoolsr+  r,  r   rV   r   )r+  r,  rZ   rh   rH   r7   r7   r;   test_pickling_polys_rootoftoolsy  s   

r-  )LatexPrinter)MathMLContentPrinterMathMLPresentationPrinter)PrettyPrinter)
prettyForm
stringPict)Printer)PythonPrinterc                  C   s8   t t  ttttttdtt tt fD ]} t|  qd S )Nr9   )	r.  r/  r0  r1  r2  r3  r4  r5  rV   rW   r7   r7   r;   test_printing  s   
r6  c                   C      t t  d S r4   )rV   r/  r7   r7   r7   r;   test_printing1     r8  c                   C   r7  r4   )rV   r0  r7   r7   r7   r;   test_printing2  r9  r:  c                   C   r7  r4   )rV   r1  r7   r7   r7   r;   test_printing3  r9  r;  )Limit)Orderc                  C   s:   t d} t d}tt| |dtt| fD ]}t| qd S )NerZ   r3   )r   r<  r=  rV   )r>  rZ   rH   r7   r7   r;   test_series  s
   
r?  )Product)Sumc                  C   s>   t d} tt| | ddftt| | ddffD ]}t| qd S )NrZ   r=   r?   )r   r@  rA  rV   rc   r7   r7   r;   test_concrete  s   (
rB  c                  C   s   t ddddd} t|  d S )NvalueZfeaturei90  z1.0)ZissueZdeprecated_since_version)r(   rV   )wr7   r7   r;   test_deprecation_warning  s   rE  c                   C   s   t t tjdksJ d S )Ng      ?)r5   rP   r6   r*   ZHalfr7   r7   r7   r;   test_issue_18438  s   rF  )rO   rK   r5   Zsympy.physics.unitsr   Zsympy.testing.pytestr   r   Zsympy.core.basicr   r   Zsympy.core.corer   Zsympy.core.singletonr   Zsympy.core.symbolr	   r
   r   r   Zsympy.core.numbersr   r   r   r   r   r   r   r   r   Zsympy.core.relationalr   r   r   r   r   r   r   Zsympy.core.addr   Zsympy.core.mulr   Zsympy.core.powerr   Zsympy.core.functionr    r!   r"   r#   r$   Zsympy.sets.setsr%   Zsympy.core.multidimensionalr&   Zsympy.core.compatibilityr'   Zsympy.utilities.exceptionsr(   Zsympyr)   r*   Zsympy.externalr+   r,   rA   rV   rX   r[   r\   r]   r_   r`   rd   rf   rg   ri   ro   rp   rq   rs   r}   Z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   r   r   r   r   r   r   r   r   r   Zsympy.geometry.entityr   Zsympy.geometry.pointr   Zsympy.geometry.ellipser   r   Zsympy.geometry.liner   r   r   r   Zsympy.geometry.polygonr   r   r   r   Zsympy.integrals.integralsr   r   Zsympy.core.logicr   r   Zsympy.matricesr   r   r   Zsympy.ntheory.generater   r   Zsympy.physics.paulialgebrar   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r*  r-  Zsympy.printing.latexr.  Zsympy.printing.mathmlr/  r0  Zsympy.printing.pretty.prettyr1  Z sympy.printing.pretty.stringpictr2  r3  Zsympy.printing.printerr4  Zsympy.printing.pythonr5  r6  r8  r:  r;  Zsympy.series.limitsr<  Zsympy.series.orderr=  r?  Zsympy.concrete.productsr@  Zsympy.concrete.summationsrA  rB  rE  rF  r7   r7   r7   r;   <module>   s    ,$
4	
	





;
a


