� ��g�g���ddlmZddlmZddlmZddlmZmZm Z ddl m Z m Z m Z mZmZmZmZmZmZddlmZmZddlmZmZddlmZdd lmZdd lmZm Z m!Z!m"Z"m#Z#m$Z$dd l%m&Z&dd l'm(Z(m)Z)dd l*m+Z+dddefd�Z,dd�Z-e d��Z.d�Z/dS)�)� defaultdict)�reduce)�prod)� expand_log� count_ops� _coeff_isneg) �sympify�Basic�Dummy�S�Add�Mul�Pow� expand_mul� factor_terms)�ordered�default_sort_key)�Integer�Rational)� _keep_coeff)� Transform)� exp_polar�exp�log�root�polarify� unpolarify)� MatrixSymbol)�lcm�gcd)� multiplicityF�allc ������4�5�6�7�8�9�����fd��9t|��}t|t��r<t|t��s'|js |t d��t d��fvr|S�s|js|jr)t|j vr|j �9fd�|j D���}|j r�9|tzd���tz S|js|S�dv�ritt��}g}g}tj}|j D�]$} | jr|| z}�| j rt#| ��} | jru| ���\} } �r�9fd�| | fD��\} } | j st| t(��r| | ztj} } || �| ����|rk|d ���\} } | ���\}}| |kr1| jr*|jr#t-| t/| |����|d <��|�| ����&t1t3|�������D]�\} } | r�| jr�t7d �| D����sq|tjurc| tjtjfvrIt;t=| ��t=|����}|r| �|��|| |zz}t/| �|| <��|tjur.||vr||xxtjz cc<ntj||<t?|��}t|�����}tA��}|D]�\} } | |vr� | j!p| j"}|r�d| z }| |kr�||vr�| �#��dtjur&|�$| ��||xx| zcc<�u|�%|��|�$|��} || xx| zcc<��t|�����}tj}|D]�\} } | j&s| jr�| |vr�| |vr�| j!�| j'rs| j's| j(r%|| xx|�$| ��z cc<n&|�$| ��} || xx| z cc<||vr||xx| z cc<��| ||<��d �|���D��}�6fd ��8d �6fd� �6�5�6�7fd�}i�7g}g�5|D]Z\} } �6| | ��\} } | �7vr�7| | z�7| <n| �7| <| ddkr"| djr�5�| ���[�5�)tT����5�)�d����5D�]D}|�7vr�|\} }d}d} | }|}g}g}tWj,| ��D]X} �6| ��\}!}"|!�7vs �7|!|"krgx}}n3|�|"�7|!g��|�|!���Y|r�|dd|ddz}#t[dt]|����D]7}$||$d||$dz}%|%dkrn|t_|#|%��}#�8t[t]|����D]8}$�7||$xx|#||$dzzcc<|||$���9�7|xx|#|z|zz cc<|s,t]�7��dkst7d��7D����rnota�8fd�tWj,|��D����}|dkrn;||z} ||z}t7�8fd�tWj,| ��D����rd}���|\} }&|�| �7�$|��tcd|&��zf����F|}�7���D]�\\} }&} | j st| t(��r:|&tjur,| jjs | ���\} }| ||&z z} nte| |&��} |�| | f����t]|��}'t?|��}t]|��|'ksJ�|j |d�|���D��z�}�dkr|� ||j |���S�9|j |�d����9|d���zS�dk�r�g}g}|j D]S} | jr5|�t| ��������>|�| ���Tt[t]|����D]�}$||$\} } t7d�| �#��D����s| j's �s| j"s�I| �3d���\}(})|(tjur#|)tjurt-| |(��|)g||$<��tt��}*|D]h\} } �r �9| ��} | jr4| j!s| j'r&ti| ��} tk| ��r| } d| z } |*| �| ���i~tt��}|*D�]"} |*| �5t]�5��dkr �5d}+�n�| j's�r |j �5�}+�n�g},g}-g}.�5D]n} | j(r|.�| ���| j6r|-�| ���<| j"r|-�| ���Y|,�| ���ot]|,��dkr|.rt]|.��dkr|,s|-�7|,|.z��gx},}.n�|.r�d}/| jrd}/n'| �#��\}0}1|0j'r |1j'rd}/|/r=d�|.D��}.|,�7tjgt]|.��z��n|,�7|.��g}.~/|,D]} || �| ���|j |-|.z�}+�4fd��4tq|+d���}2t]t/j,|2�����4|+��krti|2��}+||+�| ����$d�|���D��}3|j |3|z�Stsd���)!a� Reduce expression by combining powers with similar bases and exponents. Explanation =========== If ``deep`` is ``True`` then powsimp() will also simplify arguments of functions. By default ``deep`` is set to ``False``. If ``force`` is ``True`` then bases will be combined without checking for assumptions, e.g. sqrt(x)*sqrt(y) -> sqrt(x*y) which is not true if x and y are both negative. You can make powsimp() only combine bases or only combine exponents by changing combine='base' or combine='exp'. By default, combine='all', which does both. combine='base' will only combine:: a a a 2x x x * y => (x*y) as well as things like 2 => 4 and combine='exp' will only combine :: a b (a + b) x * x => x combine='exp' will strictly only combine exponents in the way that used to be automatic. Also use deep=True if you need the old behavior. When combine='all', 'exp' is evaluated first. Consider the first example below for when there could be an ambiguity relating to this. This is done so things like the second example can be completely combined. If you want 'base' combined first, do something like powsimp(powsimp(expr, combine='base'), combine='exp'). Examples ======== >>> from sympy import powsimp, exp, log, symbols >>> from sympy.abc import x, y, z, n >>> powsimp(x**y*x**z*y**z, combine='all') x**(y + z)*y**z >>> powsimp(x**y*x**z*y**z, combine='exp') x**(y + z)*y**z >>> powsimp(x**y*x**z*y**z, combine='base', force=True) x**y*(x*y)**z >>> powsimp(x**z*x**y*n**z*n**y, combine='all', force=True) (n*x)**(y + z) >>> powsimp(x**z*x**y*n**z*n**y, combine='exp') n**(y + z)*x**(y + z) >>> powsimp(x**z*x**y*n**z*n**y, combine='base', force=True) (n*x)**y*(n*x)**z >>> x, y = symbols('x y', positive=True) >>> powsimp(log(exp(x)*exp(y))) log(exp(x)*exp(y)) >>> powsimp(log(exp(x)*exp(y)), deep=True) x + y Radicals with Mul bases will be combined if combine='exp' >>> from sympy import sqrt >>> x, y = symbols('x y') Two radicals are automatically joined through Mul: >>> a=sqrt(x*sqrt(y)) >>> a*a**3 == a**4 True But if an integer power of that radical has been autoexpanded then Mul does not join the resulting factors: >>> a**4 # auto expands to a Mul, no longer a Pow x**2*y >>> _*a # so Mul doesn't combine them x**2*y*sqrt(x*sqrt(y)) >>> powsimp(_) # but powsimp will (x*sqrt(y))**(5/2) >>> powsimp(x*y*a) # but won't when doing so would violate assumptions x*y*sqrt(x*sqrt(y)) c����|�d���}|�d���}|�d���}|�d� ��}t|||||��S)N�deep�combine�force�measure)�get�powsimp) �arg�kwargs�_deep�_combine�_force�_measurer&r%r'r(s �����f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/simplify/powsimp.py�recursezpowsimp.<locals>.recursegse���� � �6�4�(�(���:�:�i��1�1�����G�U�+�+���:�:�i��1�1���s�E�8�V�X�>�>�>�r�c�&��g|] }�|����S�r6)�.0�wr2s �r1� <listcomp>zpowsimp.<locals>.<listcomp>us!���9�9�9�!�7�7�1�:�:�9�9�9r3F)r%)rr"c�&��g|] }�|����Sr6r6)r7�ir2s �r1r9zpowsimp.<locals>.<listcomp>�s!���7�7�7�1�G�G�A�J�J�7�7�7r3�����c3�$K�|] }|jV�� dS�N)� is_Number)r7�eis r1� <genexpr>zpowsimp.<locals>.<genexpr>�s$����/I�/I��� �/I�/I�/I�/I�/I�/Ir3Nc� �g|] \}}|�||f�� Sr6r6�r7�b�es r1r9zpowsimp.<locals>.<listcomp>�s%��=�=�=�t�q�!�1�=�Q��F�=�=�=r3c�2���|��ddS)zLReturn Rational part of x's exponent as it appears in the bkey. rr4r6)�x�bkeys �r1�ratqzpowsimp.<locals>.ratq�s����4��7�7�1�:�a�=� r3c���|��|jr|tjf|fS|jr*|t |j��ft |j��fS|�d���\}}|tjura|jr-|t |j��f|t |j��zfS||zt |j��ft |j��fS||ztjftjfS�|� ���S)a@Return (b**s, c.q), c.p where e -> c*s. If e is not given then it will be taken by using as_base_exp() on the input b. e.g. x**3/2 -> (x, 2), 3 x**y -> (x**y, 1), 1 x**(2*y/3) -> (x**y, 3), 2 exp(x/2) -> (exp(a), 2), 1 NT��rational) � is_Integerr �One� is_Rationalr�q�p� as_coeff_Mul� is_integer� as_base_exp)rDrE�c�mrHs �r1rHzpowsimp.<locals>.bkey�s�����}��<� 4��q�u�:�q�=�(��]� 4��w�q�s�|�|�,�g�a�c�l�l�:�:��>�>�4�>�8�8�D�A�q����~�~��<�E�$%�w�q�s�|�|�#4�a���� � �n�#D�D� !�1��g�a�c�l�l�3�W�Q�S�\�\�A�A� !�1��a�e�}�a�e�3�3��t�Q�]�]�_�_�-�-r3c�P��t�||d��\}}|s��|��|rjtj|d|z��D]N}�|��\}}|�vrd�|<�|xx|z cc<|ddkr��|���KdSdSdS)aLDecide what to do with base, b. If its exponent is now an integer multiple of the Rational denominator, then remove it and put the factors of its base in the common_b dictionary or update the existing bases if necessary. If it has been zeroed out, simply remove the base. r4rN)�divmod�popr� make_args�append)rD�newe�rrVrE�basesrH�common_bs ���r1�updatezpowsimp.<locals>.updates�����X�a�[�!�A�$�/�/�G�D�!�� ,�� � �Q�����,� �]�1�Q�4��:�6�6�,�,��#�t�A�w�w���1��H�,�,�*+�H�Q�K� �� � � �q�(� � � ��Q�4�1�9�9�!�L�L��O�O�O�� ,� ,�,�,�,�,r3)�keyT)ra�reversec3�.K�|]}|ddkV��dS�r4Nr6)r7�ks r1rAzpowsimp.<locals>.<genexpr>Ks*����7�7��1�Q�4�1�9�7�7�7�7�7�7r3c�&��g|] }�|����Sr6r6�r7�birIs �r1r9zpowsimp.<locals>.<listcomp>Ss!���E�E�E��D�D��H�H�E�E�Er3c3�6�K�|]}�|��dkV��dSrdr6rgs �r1rAzpowsimp.<locals>.<genexpr>Xs/�����@�@��t�t�B�x�x�1�}�@�@�@�@�@�@r3c�4�g|]\}}t||����Sr6�rrCs r1r9zpowsimp.<locals>.<listcomp>qs$��(P�(P�(P�t�q�!��Q����(P�(P�(Pr3r�base)r&c3�$K�|] }|jV�� dSr>)�is_nonnegative)r7rGs r1rAzpowsimp.<locals>.<genexpr>�s%����E�E�Q��(�E�E�E�E�E�Er3rKc��g|]}| ��Sr6r6)r7r8s r1r9zpowsimp.<locals>.<listcomp>�s��/�/�/�a��r�/�/�/r3c���|jr t�fd�|jD����S|jr t �fd�|jD����SdS)Nc3�.�K�|]}�|��V��dSr>r6)r7�ai�_termss �r1rAz*powsimp.<locals>._terms.<locals>.<genexpr>�s+�����"?�"?�"�6�6�"�:�:�"?�"?�"?�"?�"?�"?r3c�&��g|] }�|����Sr6r6)r7�mirss �r1r9z+powsimp.<locals>._terms.<locals>.<listcomp>�s!���$A�$A�$A�B�V�V�B�Z�Z�$A�$A�$Ar3r4)�is_Add�sum�args�is_Mulr)rErss �r1rszpowsimp.<locals>._terms�sj����x�@�"�"?�"?�"?�"?���"?�"?�"?�?�?�?��x�C�#�$A�$A�$A�$A�!�&�$A�$A�$A�B�B�B��1r3c�>�g|]\}}|D]}t||�����Sr6rk)r7rDrEr@s r1r9zpowsimp.<locals>.<listcomp>�s1��F�F�F���A�A�F�F�b�#�a��*�*�F�F�F�Fr3z.combine must be one of ('all', 'exp', 'base').r>):r � isinstancer r�is_Atomrrvry�_yrx�func�is_Powr�listr rNrO� _denest_pow�is_commutativerTrr[rr r�iter�itemsr"� NegativeOner!�abs�dict�set� is_positive�is_polar�as_numer_denomrY�add� is_SymbolrS� is_negative�sortrrrZ�range�len�minrrrrRrrrn�extendr� ValueError):�exprr%r&r'r(�c_powers�nc_part�newexpr�coeff�termrDrE�b1�e1�b2�e2rV�be�skip�bpos�binv�_nr`�donerl�exponent�last�qlcm�bstart�qstart�bb�eerh�bib�bie�min1r;�ratrP�check�exp_c�exp_t�c_exp�new_base�unk�nonneg�neg�isratrQ�d� xnew_base�c_partrsr^rHr_rIr2s: ```` @@@@@@r1r*r*s|������������j?�?�?�?�?�?�?�?� �4�=�=�D� �t�U� #� #��z�$� �'E�'E�� �L�� �Y�q�\�\�9�Q�<�<�$@�@�@�� � �;�t�{�;�d�k�;�b�� �.A�.A��t�y�9�9�9�9�t�y�9�9�9�:�� �{�/��w�t�B�w�U�+�+�+�B�.�.� �;��� ��.� � ��t�$�$����������I� %� %�D��� ��� ����{� )�"�4�(�(���"� %��'�'�)�)���1��8�7�7�7�7��A��7�7�7�D�A�q��8�'�z�!�S�1�1�'��a�4���q�A��� �"�"�1�%�%�%�%��!�$�R�[�4�4�6�6�F�B��!�-�-�/�/�F�B���b����-�!�24�2C�!�&)�"�c�"�b�k�k�&:�&:��� � ����t�$�$�$�$��D����!1�!1�2�2�3�3� "� "�D�A�q�� "�a�m� "�C�/I�/I�q�/I�/I�/I�,I�,I� "����&�&��a�e�Q�]�3�3�3� ��Q����U���4�4���"��H�H�Q�K�K�K��Q��T�M�E��q�'�H�Q�K�K� ��� � ��� � ������1�5�(�����"#�%������>�>���(�.�.�"�"� #� #���u�u��� )� )�D�A�q��D�y�y���=�.�A�J�D�� )���s����9�9���!1�!1��'�'�)�)�!�,���5�5� � � �Q���� �����!�+������������$�L�L��.�.�� �� � � �q�(� � � ���(�.�.�"�"� #� #�� �]��� )� )�D�A�q�� � )�q�x� )�a�R�8�^�^��X� � ��M�-���-��|�)�q�}�)� �!�� � � �� � �Q���7� � � � �$�L�L�!��,�,�� �� � � �q�(� � � ��X�~�~� �� � � ��)� � � � �'(��� ��>�=�x�~�~�'7�'7�=�=�=�� !� !� !� !� !�  .� .� .� .� .� .�4 ,� ,� ,� ,� ,� ,� ,�*������� � �D�A�q��4��1�:�:�D�A�q��H�}�}�&�q�k�A�o��� � ���� ���t�q�y�y�Q�q�T�[�y�� � �Q����� � � �'� �(�(�(� � � �w�� �-�-�-��; @�; @�D��8�#�#���K�A�x��D��D�1 ����������-��*�*�#�#�B�#�t�B�x�x�H�C���(�*�*�h�s�m�c�.A�.A�"$� ��R����I�I�s�H�S�M�2�3�3�3��I�I�c�N�N�N�N��?��a�5��8�R��U�1�X�-�D�"�1�c�"�g�g�.�.�?�?�� ��e�A�h��1��a��0����7�7�!�E�"�4��~�~��� "'�s�2�w�w���*�*�A�$�R��U�O�O�O�t�B�q�E�!�H�}�<�O�O�O�"�F�2�a�5�M�M�M�M�!�����$�v�+�h�*>�>�������8�}�}��)�)��7�7�h�7�7�7�7�7�*�� �E�E�E�E�s�}�V�/D�/D�E�E�E�F�F���1�9�9���D�L�������@�@�@�@�s�}�Q�/?�/?�@�@�@�@�@� ��D�c1 �h�D�A�q� �K�K��H�L�L��.�.�x��1�~�~�=�>� ?� ?� ?� ?���"���)�)� $� $�I�F�Q��A��� �J�q�#�.�.� ��Q�U�N�N�1�5�+<�N�� � �����2���1��I�����A�J�J�� �O�O�Q��F� #� #� #� #��H� � ����>�>���8�}�}��%�%�%�%��$�)�g�(P�(P�x�~�~�?O�?O�(P�(P�(P�P�R�� �e� � ��9�9�W�i�d�i��&9�:�:� :��7�9�4�9�g�.��?�?�?�����0�0�0�1� 1� �F� � ������I� %� %�D��"� %�����T�%5�%5�%7�%7� 8� 8�9�9�9�9����t�$�$�$�$��s�8�}�}�%�%� 5� 5�A��A�;�D�A�q��E�E�!�2B�2B�2D�2D�E�E�E�E�E� ��� �Y^� �bc�bl� ���>�>�4�>�8�8�L�E�5��A�E�!�!�e�1�5�&8�&8�"�1�e�}�}�e�4��� �� �D�!�!��� � �D�A�q�� ��G�A�J�J���x� �Q�]� �a�l� � ��O�O����?�?����A��!��A� �!�H�O�O�A� � � � � ��t�$�$���B )�B )�A��!�H�E��5�z�z�Q��� ��8�����9 7��9 7�$�4�9�e�,���������� '� '�B��~�'�� � �2������*�'�� � �b�)�)�)�)���'�� � �� � � � �� � �2������s�8�8�q�=�=��=��C���A� � �c� ��M�M�#��)�,�,�,� "�N�C�#�#���"�E��}�)� $��� �/�/�1�1���1��<�)�A�L�)�$(�E��!�/�/�3�/�/�/��� � �A�M�?�3�s�8�8�#;�<�<�<�<�� � �3���� ����*�*�A��Q�K�&�&�q�)�)�)�)�$�4�9�v��|�5�������'�x�e�<�<�<� ��s�}�Y�/�/�0�0�6�6�(�3C�3C�C�C�+�I�6�6�H� �X� � %� %�a� (� (� (� (�G�F����)9�)9�F�F�F���t�y�6�G�+�-�-��I�J�J�Jr3c�� �ddlm}|r�� fd�� g}|�tt��D]K}t |jttf��r(� |j�\}}|dur|�||f���L|r|� |��}||��\}}t|d|���� |��S|r>t|��\}}ttt|d�����|��St|��} | � tt d�� ����S) a� Collect exponents on powers as assumptions allow. Explanation =========== Given ``(bb**be)**e``, this can be simplified as follows: * if ``bb`` is positive, or * ``e`` is an integer, or * ``|be| < 1`` then this simplifies to ``bb**(be*e)`` Given a product of powers raised to a power, ``(bb1**be1 * bb2**be2...)**e``, simplification can be done as follows: - if e is positive, the gcd of all bei can be joined with e; - all non-negative bb can be separated from those that are negative and their gcd can be joined with e; autosimplification already handles this separation. - integer factors from powers that have integers in the denominator of the exponent can be removed from any term and the gcd of such integers can be joined with e Setting ``force`` to ``True`` will make symbols that are not explicitly negative behave as though they are positive, resulting in more denesting. Setting ``polar`` to ``True`` will do simplifications on the Riemann surface of the logarithm, also resulting in more denestings. When there are sums of logs in exp() then a product of powers may be obtained e.g. ``exp(3*(log(a) + 2*log(b)))`` - > ``a**3*b**6``. Examples ======== >>> from sympy.abc import a, b, x, y, z >>> from sympy import Symbol, exp, log, sqrt, symbols, powdenest >>> powdenest((x**(2*a/3))**(3*x)) (x**(2*a/3))**(3*x) >>> powdenest(exp(3*x*log(2))) 2**(3*x) Assumptions may prevent expansion: >>> powdenest(sqrt(x**2)) sqrt(x**2) >>> p = symbols('p', positive=True) >>> powdenest(sqrt(p**2)) p No other expansion is done. >>> i, j = symbols('i,j', integer=True) >>> powdenest((x**x)**(i + j)) # -X-> (x**x)**i*(x**x)**j x**(x*(i + j)) But exp() will be denested by moving all non-log terms outside of the function; this may result in the collapsing of the exp to a power with a different base: >>> powdenest(exp(3*y*log(x))) x**(3*y) >>> powdenest(exp(y*(log(a) + log(b)))) (a*b)**y >>> powdenest(exp(3*(log(a) + log(b)))) a**3*b**3 If assumptions allow, symbols can also be moved to the outermost exponent: >>> i = Symbol('i', integer=True) >>> powdenest(((x**(2*i))**(3*y))**x) ((x**(2*i))**(3*y))**x >>> powdenest(((x**(2*i))**(3*y))**x, force=True) x**(6*i*x*y) >>> powdenest(((x**(2*a/3))**(3*y/i))**x) ((x**(2*a/3))**(3*y/i))**x >>> powdenest((x**(2*i)*y**(4*i))**z, force=True) (x*y**2)**(2*i*z) >>> n = Symbol('n', negative=True) >>> powdenest((x**i)**y, force=True) x**(i*y) >>> powdenest((n**i)**x, force=True) (n**i)**x r)�posifyc���t|ttf��s|jt||d���fS�|j|j|z��S)NF)�evaluate)r{rrr�rl)rDrE�_denests �r1r�zpowdenest.<locals>._denestKsP����a�#�s��,�,� @��}�c�!�Q��&?�&?�&?�?�?��7�1�6�1�5��7�+�+� +r3F)r'�polarT)�exponents_onlyc�:�|jpt|t��Sr>)rr{r)rVs r1�<lambda>zpowdenest.<locals>.<lambda>`s��a�h�&D�*�Q��2D�2D�r3)�filter)�sympy.simplify.simplifyr��atomsrrr{rlrxr[�subs� powdenest�xreplacerrr*rr�) �eqr'r�r��repsrQ�ok�dp�rep�newr�s @r1r�r��sq���v/�.�.�.�.�.� �F� ,� ,� ,� ,� ,������#�s�#�#� )� )�A��!�&�3��*�-�-� )� ��!�&�)���B��U�?�?��K�K��B��(�(�(�� � �������B��6�"�:�:���D���5��6�6�6�?�?��E�E�E� �O��2�,�,���C��)�J�r�$�$G�$G�$G�H�H�#�N�N�N� �"�+�+�C� �<�<� ��D�D�F�F�F� G� G�Gr3�yc � ���ddlm}|���\}�|jst |t ��r6�dkr0|����}|�|}|���\}�|tjur��j r�g}g}�j D]X}td�tj |��D����r|�|���C|�|���Y|t|���}t!t |��t|���S|���\}}|tjur"|j s|jr |jdks |js|Sgg} } tj |��D]F} | jr(| �| ������1| �| ���Gt-| ��dkrX| ddj sEt!| dd| dd�z��t/t| ��z��zS| r/t�fd�| D���t/t| ��z��zS|jrOt3t5|����} | j r,| j \} } �| z�| j d}t!|���S|j r+td�tj |��D����r|Sd�}t3t5|����}|jrZ|j }t9||����dkr=����\}}t=||t�fd �|D���z��}t |t4��s|j s�|j djs t |j dt ��rSt?|j d��}tA|j��dkd krt!|j!|j�z��S|Sg}g}|j D]4}|jr|�|���|�|���5t!t |t|������t|�z��S) zr Denest powers. This is a helper function for powdenest that performs the actual transformation. r)� logcombiner4Nc3�@K�|]}t|t��V��dSr>)r{r)r7rrs r1rAz_denest_pow.<locals>.<genexpr>zs,����C�C�2�:�b�#�&�&�C�C�C�C�C�Cr3c�@��g|]\}}t||�zz����Sr6)r�)r7r�r�rEs �r1r9z_denest_pow.<locals>.<listcomp>�s-���B�B�B�x��B�Y�r�B�q�D�z�*�*�B�B�Br3c3�$K�|] }|jV�� dSr>)r|)r7�ss r1rAz_denest_pow.<locals>.<genexpr>�s$����?�?��1�9�?�?�?�?�?�?r3c�D�d�||fD��\}}t|d|d�����d}t|d�d���d|d�d���dz�}t ||��S)Nc�6�g|]}|�����Sr6)rR)r7r;s r1r9z/_denest_pow.<locals>.nc_gcd.<locals>.<listcomp>�s"��3�3�3�Q���� � �3�3�3r3rr4T)�cset)r r�r�args_cncr)�aar��arDrU�gs r1�nc_gcdz_denest_pow.<locals>.nc_gcd�s���3�3�2�r�(�3�3�3���1� ��!��a��d�O�O� *� *� ,� ,�Q� /�� �!�A�$�-�-�T�-�*�*�1�-��!�� � �4� �0H�0H��0K�K� M���1�a� � � r3c���g|]}|�z ��Sr6r6)r7r�r�s �r1r9z_denest_pow.<locals>.<listcomp>�s���,?�,?�,?�Q�Q�q�S�,?�,?�,?r3T)"r�r�rTrr{r� _eval_powerr �Exp1ryrx�anyr rZr[rrrNrOrPr�r�r�r�rMrrrvrrRrr�r�rl)r�r�rDr��logs�otherr@�_r��polars� nonpolarsr��logbrUrlr��glogbrx�cg�rgr�r�rEr�s @@r1r�r�es�����3�2�2�2�2�2� �>�>� � �D�A�q��x�%�:�a��%�%�%�!�q�&�&��m�m�A���� �?��B��?�?�$�$�D�A�q� �A�F�{�{�q�x�{������&� !� !�B��C�C���r�1B�1B�C�C�C�C�C� !�� � �B������ � �R� � � � ��z�#�t�*�%�%���3�t�9�9�c�5�k�*�*�*� �M�M�O�O�E�A�r� �Q�U�{�{�A�H�{��M��./�c�Q�h�h��M�/7�� � �B�I�F��m�A���!�!�� �;� !� �M�M�"�.�.�*�*� +� +� +� +� � � �R� � � � � �6�{�{�a����q� �!� � 3���6�!�9�Q�<����1��a��0�0��3� �?�A�;M�1N�1N�N�N� �+��B�B�B�B�6�B�B�B�C� �s�I���)� *� *�+� +� �|� ��#�a�&�&�!�!�� �;� ��i�G�A�t� ��F�A��9�Q�<�D��t�Q�<�<� � �8��s�?�?�c�m�A�.>�.>�?�?�?�?�?��� �!�!�!� �s�1�v�v� � �E� �|�B��z�� �6�4� � �� ��6�6��^�^�%�%�F�B����B�s�,?�,?�,?�,?�$�,?�,?�,?�'@�$@�A�A�E��%�����U�\�� �:�a�=� � 4�:�e�j��m�S�#A�#A� 4��� �1� �.�.�E��E�I����"�t�+�+��5�:�u�y��{�3�3�3�� � �C� �E� �Z���� �8� � �J�J�q�M�M�M�M� �L�L��O�O�O�O� �s�:�:�c�3�i�(�(�)�)�1�S�%�[�=� 9� 9�9r3N)FF)0� collectionsr� functoolsr�mathr�sympy.core.functionrrr� sympy.corer r r r r rrrr�sympy.core.sortingrr�sympy.core.numbersrr�sympy.core.mulr�sympy.core.rulesr�sympy.functionsrrrrrr�"sympy.matrices.expressions.matexprr� sympy.polysrr �sympy.ntheory.factor_r!r*r�r}r�r6r3r1�<module>r�s���#�#�#�#�#�#�������������C�C�C�C�C�C�C�C�C�C�X�X�X�X�X�X�X�X�X�X�X�X�X�X�X�X�X�X�X�X�X�X�8�8�8�8�8�8�8�8�0�0�0�0�0�0�0�0�&�&�&�&�&�&�&�&�&�&�&�&�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�;�;�;�;�;�;� � � � � � � � �.�.�.�.�.�.��e�5�)�XK�XK�XK�XK�vsG�sG�sG�sG�j �U�3�Z�Z��e:�e:�e:�e:�e:r3
Memory