K i3ddlmZmZmZmZmZmZmZmZm Z m Z m Z m Z m Z mZmZddlmZmZmZmZmZmZddlmZmZmZmZmZmZmZmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)ddl*m+Z+ddl,m-Z-ed \Z.Z/Z0d Z1d Z2d Z3d Z4dZ5dZ6dZ7dZ8dZ9dZ:dZ;dZdZ?dZ@dZAdZBdZCdZDdZEdZFd ZGd!ZHd"ZId#ZJd$ZKd%ZLd&ZMd'ZNd(ZOd)ZPd*ZQd+ZRd,ZSy-).)SpioosymbolsFunctionRationalIntegerTupleSymbolEqNeLeLtGtGe) EulerGamma GoldenRatioCatalanLambdaMulPow) Piecewisesqrtceilingexpsincossinclucas)raises)implemented_function)eyeMatrix MatrixSymbolIdentityHadamardProduct SparseMatrix)besseli maple_codezx,y,zchttddk(sJttddk(sJy)NC67z-1)r*r e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/printing/tests/test_maple.py test_Integerr2s0 gbk "d ** * gbk "d ** *r0cXttdddk(sJttdddk(sJttdddk(sJttd ddk(sJtttddzd k(sJttddtzd k(sJy) Nz3/7 2iz-3/7zx + 3/7z(3/7)*x)r*rxr/r0r1 test_Rationalr;s hq!n % .. . hr1o &# -- - hq"o && 00 0 hr2& '5 00 0 a(1a.( )Y 66 6 hq!nq( )Y 66 6r0cttttdk(sJtt ttdk(sJtt ttdk(sJtt ttdk(sJttttdk(sJttttdk(sJy)Nzx = yzx <> yzx <= yzx < yzx > yzx >= y) r*r r:yr rrrrr/r0r1test_Relationalr>s bAh 7 ** * bAh 8 ++ + bAh 8 ++ + bAh 7 ** * bAh 7 ** * bAh 8 ++ +r0ctttttzdk(sJtt tdk(sJtt tdk(sJy)Nz sin(x)^cos(x)zabs(x)zceil(x))r*rr:rabsrr/r0r1 test_FunctionrA'sP c!fA& '? :: : c!f  )) ) gaj !Y .. .r0c <ttdzdk(sJtttdzzdk(sJttdztzdk(sJtttddzdk(sJt dt tdtz}td|td ztttzz zz tdztzz d k(sJtt d ttt ttd dd d dk(sJy)Nr4zx^3zx^(y^3)z(x^3)^yzx^(2/3)gg @z(3.5*2*x)^(-x + y^x)/(x^2 + y)F)evaluater.z -2*x/(y*y))r*r:r=rr!rrr)rDs r1test_PowrH-s a1f  && & aAFm $ 11 1 qAv!m $ 11 1 a8Aq>) *i 77 7S&AE"23A a1Q4#:1qAv:66!q&1*E F + ,, , c"aSA%>U!S#(* +.: ;; ;r0ctttzdk(sJtttzdk(sJtttz dk(sJtt dk(sJy)Nx*yzx + yzx - yz-x)r*r:r=r/r0r1test_basic_opsrK<s[ a!e  %% % a!e  '' ' a!e  '' ' qb>T !! !r0ctdtz dk(sJttdzttdzcxk(rdk(sJJtdttz dk(sJtttj zttdzcxk(rdk(sJJtttdk(sJtttjzttdzcxk(rdk(sJJtdt z d k(sJtt dztt dzcxk(rd k(sJJtt dzd k(sJy) NrEz1/xr.gz 1/sqrt(x)gzsqrt(x)g?z1/Piz 1/sqrt(Pi))r*r:rrHalfrr/r0r1test_1_over_x_and_sqrtrNCs1 a!e  %% % a2g *Q$Y"7 @5 @@ @@ @ a$q'k "k 11 1 aAFF7l #z!t)'< K KK KK K d1g ) ++ + a166k "jc&: Gi GG GG G a"f  '' ' bBh :bDj#9 CV CC CC C bDj !\ 11 1r0ctdtzdk(sJtttzdk(sJtdtz dk(sJtttz dk(sJttdz dk(sJtttz dk(sJtttzdk(sJtdtztzd k(sJtdtztztzd k(sJtttz d k(sJtdtztz d k(sJtttztz d k(sJtttz tzdk(sJtdtz tz dk(sJtdtztztz tz dk(sJtdtztz dk(sJtt ddz dk(sJtt ddz tzdk(sJtttz tz dk(sJtttztz dk(sJtttzttzz dk(sJtttzt z dk(sJttdz tz dk(sJtt ddz tztztz dk(sJy)Nr4z3*xzPi*xz3/xzPi/xz(1/3)*xzx/PirJz3*x*yz3*Pi*x*yzx/yz3*x/yzx*y/zzx*z/yrEz1/(x*y)rCz 2*Pi*x/(y*z)z3*Pi/xz3/5z(3/5)*xzx/(y*z)z (x + y)/zz(x + y)/(x + z)z (x + y)/gammaz (1/3)*x/Piz (3/5)*x*y/Pi)r*r:rr=zrrr/r0r1test_mix_number_mult_symbolsrRQs a!e  %% % b1f  '' ' a!e  %% % b1f  '' ' a!e  )) ) a"f  '' ' a!e  %% % a!eai G ++ + a"fqj1n % 33 3 a!e  %% % a!eai G ++ + a!eai G ++ + a!eai G ++ + a!eai I -- - a"fqj1nq( )^ ;; ; a"fqj !X -- - adQh 5 (( ( adQhl #y 00 0 a!eai I -- - q1uk "k 11 1 q1uQ' (,= == = q1u * + >> > a!ebj !\ 11 1 adQhlQ&+ , >> >r0cZttdzdk(sJttdzdk(sJtttdzzdk(sJtttzdk(sJttttzzdk(sJtttztzdk(sJy) Nr4zPi^3rCzx^2zx^(Pi^3)zx^yzx^(y^z)z(x^y)^z)r*rr:r=rQr/r0r1test_mix_number_pow_symbolsrTls bAg & (( ( a1f  && & aB!Gn % 33 3 a1f  && & aAFm $ 11 1 qAv!m $ 11 1r0ctd}t|dk(sJtd|zdk(sJttddz |zdk(sJtdd|zzdk(sJy) NIrPz5*Ir4rCz(3/2)*Iz3 + 4*I)rr*)rVs r1 test_imagrXwsn #A a=C   a!e  %% % qtax1n % 22 2 a!a%i I -- -r0cdttdk(sJttdk(sJtt dk(sJttjdk(sJttj dk(sJttj dk(sJttddk(sJy)NPiinfinityz -infinity undefinedzexp(1)rE)r*rrrNegativeInfinityNaNExp1rr/r0r1test_constantsr`s b>T !! ! b>Z '' ' rc?k )) ) a(( )[ 88 8 aee  ++ + aff  )) ) c!f  )) )r0ctdtzdk(sJtdtzdk(sJtdtzdk(sJy)NrCz2*(1/2 + (1/2)*sqrt(5))z 2*Catalanz2*gamma)r*rrrr/r0r1test_constants_otherrbsH a+o &*C CC C a'k "k 11 1 a*n % 22 2r0ctttzdk(sJtttzdk(sJttdk(sJtttztzdk(sJtttztzdk(sJtttztzdk(sJtttztzdk(sJy)Nzx and yzx or yznot xz x and y and zz x or y or zz z or x and yzz and (x or y))r*r:r=rQr/r0r1 test_booleanrds a!e  )) ) a!e  (( ( qb>W $$ $ a!eai O 33 3 a!eai M 11 1 q1uk "n 44 4 q1uk "&6 66 6r0c &ttdddgdk(sJtdttdz t tgddt gdt dttgg}d}t||k(sJt|dddfdk(sJt|dddfdk(sJtttttz t ggd k(sJttddgd k(sJttdd gd k(sJy) NrE z%Matrix([[10]], storage = rectangular)rCrz\Matrix([[1, sin((1/2)*x), abs(x)], [0, 1, Pi], [0, exp(1), ceil(x)]], storage = rectangular)z.Matrix([[1], [0], [0]], storage = rectangular)z:Matrix([[1, sin((1/2)*x), abs(x)]], storage = rectangular)z/Matrix([[x, x - y, -y]], storage = rectangular)z!Matrix([], storage = rectangular)r4) r*r#rr:r@rrrr=Aexpecteds r1 test_MatricesrjsE fQB4( ) 2 33 3 CAJA'Ar CFGAJ') *A ! a=H $$ $ a1g  ; << < a1g  G HH H fq!a%!n-. / < == = fQ2& ' . // / fQ2& ' . // /r0cHtttddk(sJy)NrCz*Matrix([[1, 0], [0, 1]], storage = sparse))r*r'r%r/r0r1test_SparseMatricesrls l8A;/ 04` `` `r0ctdtdtz dtztz dz gg}t |dk(sJt |j dk(sJy)NrErCr4rPz:Matrix([[1, sin(2/x), (3/5)*Pi/x]], storage = rectangular)z>Matrix([[1], [sin(2/x)], [(3/5)*Pi/x]], storage = rectangular))r#rr:rr*Trhs r1test_vector_entries_hadamardrpsfCAJB Q/01A a= G HH H acc? K LL Lr0ctdtdtz dtztz dz gddttzgg}d}t ||k(sJy)NrErCr4rPzGMatrix([[1, sin(2/x), (3/5)*Pi/x], [1, 2, x*y]], storage = rectangular))r#rr:rr=r*rgs r1"test_Matrices_entries_not_hadamardrrsTCAJB Q/!QA?@A !  a=H $$ $r0ctdd}td||}td||}t||zdk(sJt||zdk(sJtd|z|zd k(sJt|dz|zd k(sJt||d t|zzzd k(sJt|tdzzd k(sJt|d zdk(sJt|t j zdk(sJy)NnT)integerrhBzA.BzB.ArCz2*A.Bz2*B.Ar4z%A.(3*Matrix(n, shape = identity) + B)zMatrixPower(A, x^2)zMatrixPower(A, 3)zMatrixPower(A, 1/2))r r$r*r%r:rrM)rtrhrvs r1test_MatrixSymbolrwssD!AS!QAS!QA a!e  %% % a!e  %% % a!eai G ++ + a!eai G ++ +  QXa[ ! #&M NN N aAFm $(= == = a1f !4 44 4 aAFFm $(= == =r0cvtdtdzdk(sJtttdk(sJy)Nr4z=6*Matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]], storage = sparse)zMatrix(x, shape = identity))r*r%r:r/r0r1test_special_matricesrzs6 a(1+o &*i ii i hqk "&C CC Cr0c ptdddddddggdd d gd gd k(sJtd dk(sJtdgdk(sJtddk(sJttgddk(sJtdttzdtdzffdk(sJtdt dt ddggfdk(sJy)NrErCr4rWrPryr5r7rf z)[1, 2, 3, [4, 5, [6, 7]], 8, [9, 10], 11])rErC)r4rWz[1, 2, [3, 4]]z[1])rErErCr4z [1, 2, 3]z[1, x*y, [3, x^2]]rzl[1, Matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]], storage = rectangular), Matrix([], storage = rectangular), []])r*r r:r=r"r#r/r0r1test_containersrs q!QA1vAr7B? @ 6 77 7 n %)9 99 9 qc?e ## # d u $$ $ eY' (K 77 7 q!a%!Q!V- .2F FF F q#a&&Ar"2B7 8 y zz zr0cVtttztz dd}d}||k(sJy)NmeF) assign_toinlinezme := (x + y)/Catalan)r*r:r=r)sourceris r1test_maple_noninliners+ Q4 FF&H X  r0ctgdg}t|ddk(sJtddgddgg}t|d d k(sJy) Nr~arz/a := Matrix([[1, 2, 3]], storage = rectangular)rErCr4rWrhz4A := Matrix([[1, 2], [3, 4]], storage = rectangular)r#r*ros r1test_maple_matrix_assign_torsQ {A a3 '+\ \\ \AA A a3 '+a aa ar0ctgdgtddd}tdddt|dk(sJttfd ttfd y) Nr~rvrEr4CrCrz/B := Matrix([[1, 2, 3]], storage = rectangular)c&ttSNr)r*r:rosr1z2test_maple_matrix_assign_to_more..sz!q9r0ctSrr))rhrsr1rz2test_maple_matrix_assign_to_more..sz!q9r0)r#r$r*r ValueError)rvrhrs @@r1 test_maple_matrix_assign_to_morersW {AS!QAS!QA a1 %)Z ZZ Z :9: :9:r0cBtdgg}t|ddk(sJy)Nr4rvrz)B := Matrix([[3]], storage = rectangular)rros r1test_maple_matrix_1x1r s%u A a3 '+V VV Vr0cFttdttzgg}t|ddz|dz|dzdk(sJt ddd}t|dk(sJt|ddzt |dz|dzd k(sJtt |d k(sJy) NrCrr)rrE)rrCz x^2 + x*y + 2AArEr4z%sin(AA[1, 2]) + AA[1, 1]^2 + AA[1, 3]zAA[1, 1] + AA[1, 2] + AA[1, 3])r#r:r=r*r$rsum)rhrs r1test_maple_matrix_elementsrsAq1u A aglQtW,qw6 7? JJ J dAq !B b>T !! ! bh!mc"T(m3bh> ? 2 33 3 c"g "B BB Br0ctddk(sJttjdk(sJtddk(sJttjdk(sJy)NTtrueFfalse)r*rrrr/r0r1test_maple_booleanrsV d v %% % aff  '' ' e  '' ' agg ' )) )r0ctddi}d|d<d|d<d|d<d |d <ttz|d <t|d k(sJy) NrPryrf)rCrC)rErC)rEr4)rr4)r4rzMatrix([[0, 0, 0, 30, 0, 0], [0, 0, 20, 22, 0, 0], [0, 0, 10, 0, 0, 0], [x*y, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]], storage = sparse))r'r:r=r*)Ms r1 test_sparser!s\Q2AAdGAdGAdGAdG!eAdG a=   r0c~tt5ttjdddy#1swYyxYwN)r NotImplementedErrorr*rComplexInfinityr/r0r1test_maple_not_supportedr1s. # $&1$$%&&&s3<ctddd}tddd}t|ddk(sJtd|dzdk(sJ||z }t|ddk(sJy) NrhrEr4rvrzA[1, 1]z 3*A[1, 1]zA[1, 1] - B[1, 1])r$r*)rhrvFs r1test_MatrixElement_printingr6sqS!QAS!QA qw 9 ,- , q1T7{ #{ 23 2 !A qv "5 56 5r0cXtddd}tddd}tddd}tddd}t||}t|dk(sJt||zdk(sJt||z|zd k(sJt||zd k(sJt|tztzd k(sJy) Nrhr4rvvrEhzA*Bz(A*B).vz h.(A*B).vz(A*B).Az x*y*(A*B))r$r&r*r:r=)rhrvrrrs r1 test_hadamardrCsS!QAS!QAS!QAS!QA1A a=E !! ! a!e  )) ) a!eai K // / a!e  )) ) a!eai K // /r0ctttdkftdzdftdk(sJtddk(sJttdztdkftdztdkftd ztdkftd zdfd }t|k(sJtdd |zk(sJtttdkftdztdkDftttd kDft t fdy)NrErCTzpiecewise(x < 1, x, x^2)rrzr := piecewise(x < 1, x, x^2)r4rWrPz2piecewise(x < 1, x^2, x < 2, x^3, x < 3, x^4, x^5)zr := rctSrr))exprsr1rz&test_maple_piecewise..ds z$/r0)rr:r*rr r)rirs @r1test_maple_piecewiserVs aQZ!q&$ 0D d 9 99 9 dc *' )) ) a1fa!e_qAvq1uoQAaQU WDCH d x '' ' dc *g.@ @@ @ aQZ!q&!a%3q61q5/ BD :/0r0ctttdkftdzdf}td|zdk(sJt|tz dk(sJt|ttzz dk(sJt|dz dk(sJy) NrErCTz2*piecewise(x < 1, x, x^2)zpiecewise(x < 1, x, x^2)/xzpiecewise(x < 1, x, x^2)/(x*y)r4z(1/3)*piecewise(x < 1, x, x^2))rr:r*r=)pws r1 test_maple_piecewise_times_constrgs Aq1u:Q~ .B a"f != == = b1f != == = bAEl #'G GG G b1f !A AA Ar0ctd}t|tjtdk(sJt|tjtddk(sJy)Nfz diff(f(x), x)rCzdiff(f(x), x$2))rr*r:diff)rs r1test_maple_derivativesrpsL A adiil # 66 6 adii1o &*; ;; ;r0cxtttdk(sJtttdk(sJy)Nz,(2^(-x)*((1 - sqrt(5))^x + (1 + sqrt(5))^x))z (piecewise(x <> 0, sin(x)/x, 1)))r*rr:rr/r0r1test_automatic_rewritesrvs2 eAh #Q QQ Q d1g "D DD Dr0chtddk(sJttttdk(sJy)Nzasin(x)z arcsin(x)z BesselI(x, y))r*r(r:r=r/r0r1 test_specfunr{s. i K // / gam $ 77 7r0N)T sympy.corerrrrrrr r r r r rrrrrrrrrrsympy.functionsrrrrrrrrsympy.testing.pytestr sympy.utilities.lambdifyr!sympy.matricesr"r#r$r%r&r'sympy.functions.special.besselr(sympy.printing.mapler*r:r=rQr2r;r>rArHrKrNrRrTrXr`rbrdrjrlrprrrwrzrrrrrrrrrrrrrrrrr/r0r1rs ?????IIPPP'9;;2+ ' 1a+ 7,/ ;" 2?62.*3 7/:aL%>"D zb;W C*  & 70&1"B< E 8r0