� ��gxq��"�ddlmZmZddlmZddlmZmZddlmZm Z m Z ddl m Z ddl mZddlmZdd lmZdd lmZmZdd lmZdd lmZmZmZdd lmZmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0ddl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=ddl>m?Z?m@Z@ddlAmBZBmCZCmDZDmEZEmFZFddlGmHZHddlImJZJddlKmLZLddlMmNZNddlOmPZPd�ZQd�ZRd�ZSd&d�ZTd�ZUd�ZVejWd �d!�ZXejWfd"�ZYejWfd#�ZZejWfd$�Z[d%S)'�)� AccumBounds�AccumulationBounds)� singularities�)�Pow�S)�diff� expand_mul�Function)� NumberKind)�Mod)� equal_valued)� Relational)�Symbol�Dummy)�_sympify)�Abs�im�re)�exp�log)�frac)� Piecewise) �TrigonometricFunction�sin�cos�tan�cot�csc�sec�asin�acos�acot�atan�asec�acsc) �sinh�cosh�tanh�coth�sech�csch�asinh�acosh�atanh�acoth�asech�acsch)�degree�lcm_list)�Interval� Intersection� FiniteSet�Union� Complement)�ImageSet)� ConditionSet)� filldedent)�iterable)�hessianc� ���ddlm}|�tj��st t d�����tttttttttt t"t$t&t(t*t,t.t0t2t4t6t8t:t<t>t@tBtDtFg��fd�|�$tJ��D��}tM�fd�|D����rt t d�����tOd��}t|dkft$|dk|d kft&|dk|d kft>|d kft@|dk|d kftD|dk|d kfi}t,|dk|d kft.|dk|d kftB|dk|d kfi}|}|�$t��D]l} | j�(��d } | jj)r| j*r�5|| j+dk����,��} t[| |��}�m|�$tJ��D�]�} | j.|vr`|| j.D]Q} | �/|| j0d��} || ����,��}t[||��}�R�l| j.|vrotj1}|| j.D]D} | �/|| j0d��} ||| ����,��z }�Et[||��}��| j.t*kr"dd l2m3}||| j0d���z}��| j.tkr�dd l2m3}ti| j0d�|��}t[|tj5��}|j6r/tj1}|D]}||| j0d|z ���z }� n9to�tj5�8| j0d��|��}||z}���|ts|�|��z S) a� Returns the domain on which the function expression f is continuous. This function is limited by the ability to determine the various singularities and discontinuities of the given function. The result is either given as a union of intervals or constructed using other set operations. Parameters ========== f : :py:class:`~.Expr` The concerned function. symbol : :py:class:`~.Symbol` The variable for which the intervals are to be determined. domain : :py:class:`~.Interval` The domain over which the continuity of the symbol has to be checked. Examples ======== >>> from sympy import Interval, Symbol, S, tan, log, pi, sqrt >>> from sympy.calculus.util import continuous_domain >>> x = Symbol('x') >>> continuous_domain(1/x, x, S.Reals) Union(Interval.open(-oo, 0), Interval.open(0, oo)) >>> continuous_domain(tan(x), x, Interval(0, pi)) Union(Interval.Ropen(0, pi/2), Interval.Lopen(pi/2, pi)) >>> continuous_domain(sqrt(x - 2), x, Interval(-5, 5)) Interval(2, 5) >>> continuous_domain(log(2*x - 1), x, S.Reals) Interval.open(1/2, oo) Returns ======= :py:class:`~.Interval` Union of all intervals where the function is continuous. Raises ====== NotImplementedError If the method to determine continuity of such a function has not yet been developed. r��solve_univariate_inequalityz= Domain must be a subset of S.Reals. c�H��g|]}|�����|j��S�)�has�func)�.0�fct�symbols ��c/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/calculus/util.py� <listcomp>z%continuous_domain.<locals>.<listcomp>Ys*��� E� E� E��S�W�W�V�_�_� E�C�H� E� E� E�c3� �K�|]}|�vV�� dS�NrC)rFrE� implementeds �rI� <genexpr>z$continuous_domain.<locals>.<genexpr>Zs(����� 4� 4�t�4�{� "� 4� 4� 4� 4� 4� 4rKzO Unable to determine the domain of the given function. �x�����r)� solveset_real):�sympy.solvers.inequalitiesrA� is_subsetr�Reals�NotImplementedErrorr<rrrrrrrrrr rr!r"r$r#r%r&r'r(r)r*r+r,r-r.r/r0r1r2�atomsr �anyr�as_numer_denom� is_rational�is_odd�base�as_setr6rE�subs�args�EmptySet�sympy.solvers.solvesetrR�function_range�Integers� is_finite_setr;�containsr)�frH�domainrA�usedrP� constraints�constraints_union� cont_domain�atom�den� constraint�c�constraint_relational�constraint_setrR�r�discont�nrNs ` @rI�continuous_domainrus�����`G�F�F�F�F�F� � � �A�G� $� $��!�*�.�#�#��� ���S�#�t���S�#�s�C���t�T�4����t�T�4���%���u�e� =�K� F� E� E� E����� 1� 1� E� E� E�D� � 4� 4� 4� 4�t� 4� 4� 4�4�4��!�*�.�#�#��� � �s� � �A� �a�!�e�X� �q�B�w��Q��� �q�B�w��Q��� ��Q��y� ��B���A��� ��A��q�A�v�� �K� �q�B�w��Q��� �q�B�w��Q��� ��B���A����� �K����� � �@�@���h�%�%�'�'��*�� �8� � @�C�J� @� �4�4�T�Y�!�^�8>�@�@�@F���� �&�z�;�?�?�K�K�����!�!�$#�$#�� �9� � #� #� ���+� H� H��()���q�$�)�A�,�(?�(?�%�!<�!<�)�6�"3�"3�39�6�8�8��*�>�;�G�G� � �  H� �Y�+� +� +��Z�N�&�t�y�1� <� <��()���q�$�)�A�,�(?�(?�%��"=�"=�)�6�#3�#3�39�6�8�8�<���&�~�{�C�C�K�K��Y�$� � � <� <� <� <� <� <� �=�=���1��v�>�>� >�K�K��Y�$� � � <� <� <� <� <� <��t�y��|�V�V�<�<�A��Q�� �+�+�A��� L��*���E�E�A��}�}�T�Y�q�\�!�^�V�D�D�D�G�G�E�'��A�J�/�/�� �!� �=�=�{�L�L�� �7� "�K�� ��q�&�&�9�9� 9�9rKc �.�|tjur tjSt||��}|tjkr!t |�����Sddlm}ddlm }|��t|t��r%|j |j z jrtd|��}nXt|t��rC|jD];}t|t��r$|j |j z jrtd|��}�<t#|||��}tj}t|ttf��r|f} n9t|t��r|j} nt%t'd�����| D�]} t| t��r0| D],} | |vr&|t |�|| ����z }�-�Ht| t���r�tj} tj} tj}| j| j df| j| j dff}|D]R\}}}|r$|t |||||����z }| |z } �,| t |�||����z } �S||�|��|| ��}t1|��s"t%d�|�����t|t4��r"t%d �|�����| |z } | D](}| t |�||����z } �)d \}}|tjur$|j | j krd }|j | j krd }|t| j | j ||��z }��t%t'd�����|S) a� Finds the range of a function in a given domain. This method is limited by the ability to determine the singularities and determine limits. Parameters ========== f : :py:class:`~.Expr` The concerned function. symbol : :py:class:`~.Symbol` The variable for which the range of function is to be determined. domain : :py:class:`~.Interval` The domain under which the range of the function has to be found. Examples ======== >>> from sympy import Interval, Symbol, S, exp, log, pi, sqrt, sin, tan >>> from sympy.calculus.util import function_range >>> x = Symbol('x') >>> function_range(sin(x), x, Interval(0, 2*pi)) Interval(-1, 1) >>> function_range(tan(x), x, Interval(-pi/2, pi/2)) Interval(-oo, oo) >>> function_range(1/x, x, S.Reals) Union(Interval.open(-oo, 0), Interval.open(0, oo)) >>> function_range(exp(x), x, S.Reals) Interval.open(0, oo) >>> function_range(log(x), x, S.Reals) Interval(-oo, oo) >>> function_range(sqrt(x), x, Interval(-5, 9)) Interval(0, 3) Returns ======= :py:class:`~.Interval` Union of all ranges for all intervals under domain where function is continuous. Raises ====== NotImplementedError If any of the intervals, in the given domain, for which function is continuous are not finite or real, OR if the critical points of the function on the domain cannot be found. r)�limit��solvesetNzL Unable to find range for the given domain. �+�-z%Unable to find critical points for {}z)Infinite number of critical points for {})FFT)rr`� periodicity�Zeror7�expand�sympy.series.limitsrwrary� isinstancer5�inf�sup� is_infiniter8r_rurVr<r^� left_open� right_openr r=�formatr:)rfrHrg�periodrwry�sub_dom� intervals� range_int� interval_iter�interval� singleton�vals�critical_points�critical_values�bounds�is_open� limit_point� direction�solution�critical_pointr�r�s rIrbrb�s���f������z�� ��F� #� #�F� �����������$�$�$�)�)�)�)�)�)�/�/�/�/�/�/� �� �f�h� '� '� 1�� �V�Z�'�4� -�!�!�V�,�,��� ��� &� &� 1�!�;� 1� 1���g�x�0�0�1��+�� �+�8�1�%�a��0�0�F��!�!�V�V�4�4�I�� �I��)�X�y�1�2�2� �"� � � � �I�u� %� %��!�� � �&�j�2�'�'��� �"�/�/�� �h� � *� *�. �%� F� F� ���&�&���1�6�6�&�)�+D�+D�!E�!E�E�I�� F���(� +� +�* ��:�D��j�O��j�O��)�8�<��=��'���s�;�=�F�4:� C� C�/���i��C�#�y���q�&�+�y�1Y�1Y�'Z�'Z�Z�O��O�+�D�D��I�a�f�f�V�[�&A�&A�B�B�B�D�D��x����v�����A�A�H��H�%�%� K�)�?�F�F�q�I�I�K�K�K��(�H�-�-� O�)�C�J�J�1�M�M�O�O�O� �x� '�O�"1� B� B��� �!�&�&���"@�"@�A�A�A���$0� !�I�z��a�j�0�0�"�&�$�(�2�2� $�I�"�&�$�(�2�2�!%�J� ��$�(�D�H�i��L�L� L�I�I�%�j�2�'�'��� � �rKc�d���� �t|��dkrtd���|tjur tjSt |t ��r3|jd}t t|jdg|�R�|��St |t��r|}tj �n|jd}|jd�t |t��s"tdt|���d|�����t|��dkr |d� ntd|�d����� fd��t �t��rt ��fd �|D���St �t ��r>tj}�jD](�t ��fd �|D���}t ||��}�)|Sd S) a� Finds the domain of the functions in ``finset_intersection`` in which the ``finite_set`` is not-empty. Parameters ========== finset_intersection : Intersection of FiniteSet The unevaluated intersection of FiniteSet containing real-valued functions with Union of Sets syms : Tuple of symbols Symbol for which domain is to be found Raises ====== NotImplementedError The algorithms to find the non-emptiness of the given FiniteSet are not yet implemented. ValueError The input is not valid. RuntimeError It is a bug, please report it to the github issue tracker (https://github.com/sympy/sympy/issues). Examples ======== >>> from sympy import FiniteSet, Interval, not_empty_in, oo >>> from sympy.abc import x >>> not_empty_in(FiniteSet(x/2).intersect(Interval(0, 1)), x) Interval(0, 2) >>> not_empty_in(FiniteSet(x, x**2).intersect(Interval(1, 2)), x) Union(Interval(1, 2), Interval(-sqrt(2), -1)) >>> not_empty_in(FiniteSet(x**2/(x + 2)).intersect(Interval(1, oo)), x) Union(Interval.Lopen(-2, -1), Interval(2, oo)) rz*One or more symbols must be given in syms.rzA FiniteSet must be given, not z: zmore than one variables z not handledc�<��ddlm}|j}|j}||���d� t j���}|jr8|t jur t j}n9|||k� t j���}n|||k� t j���}|j r8|t j ur t j}n9|||k� t j���}n|||k� t j���}t||��}t||��} | S)z9 Finds the domain of an expression in any given interval rrxr�rg) rary�start�endrYrrUr��Infinityr��NegativeInfinityr6r9) �expr�intrvlry�_start�_end�_singularities�_domain1�_domain2�expr_with_sing� expr_domain�symbs �rI� elm_domainz not_empty_in.<locals>.elm_domainps4���3�3�3�3�3�3�����z��!��$�"5�"5�"7�"7��":�D�)*��2�2�2�� � � D��q�z�!�!��7���#�8�D�4�K��a�g�F�F�F����x��� �d�1�7�C�C�C�H� � � F���+�+�+��7���#�8�D�6�M�4���H�H�H����x�����Q�W�E�E�E�H�&�h��9�9�� ���@�@� ��rKc�(��g|]}�|�����SrCrC)rF�element�_setsr�s ��rIrJz not_empty_in.<locals>.<listcomp>�s%���L�L�L�g�z�z�'�5�1�1�L�L�LrKc�(��g|]}�|�����SrCrC)rFr�r�r�s ��rIrJz not_empty_in.<locals>.<listcomp>�s;���&A�&A�&A�*1�'1�j��&�&A�&A�&A�&A�&ArKN) �len� ValueErrorrr`r�r8r_� not_empty_inr7rU�typerVr5) �finset_intersection�syms� elm_in_sets� finite_set�_domain�_domain_elementr�r�r�r�s @@@@rIr�r�*s������T �4�y�y�A�~�~��E�F�F�F��a�j�(�(��z���%�u�-�-�"�)�.�q�1� ��\�"5�":�1�"=�E��E�E�E� �"�"� "��%�y�1�1�,�(� �����(�-�a�0� �#�(��+�� �j�)� ,� ,�9��j��z�*�*�*�*�J�J�8�9�9� 9� �4�y�y�A�~�~��A�w���!�!�#'�4�4�#*�+�+� +������<�%��"�"�N��L�L�L�L�L��L�L�L�M�M��%������*���j� 6� 6�F�#�&A�&A�&A�&A�&A�5?�&A�&A�&A�B�O��G�_�5�5�G�G��� �rKFc�. ���jturtd�jz���tdd���}|��|��}|��fd�}|}d}t |t ��r|j|jz }|� ��}�|j vr tj St |t��r' |����}n#t$rYnwxYwt |t��r�|jd}t |t"t$t&f��rt)|jd��}t+|���}|�\t |t(��rGt|��} |||dz ��S#t$r}|rt|���Yd}~nd}~wwxYwt |t,��s|jr�|jtjkr�t5tjt7|j����}t9|��dkrOt+t;|�����} t+t9|�����} | �| �t=| | g��}|jr�|jtjkrw|j\} } | ����} | ����}| r|st+| ���}�n0|r| st+| ���}�ntA|j���}�n|j!rh|�"�d � ��\}}t |t��stG|d ��st+|���}�n�tA|j���}�n�|j$rM|�"���\}}|tj urt+|���StA|j���}�n@t |tJ��r�|j\}}|�kr|}�nt |t��rt+|���}n�|�&���rBtO|���d kr.�|j vr%t||�(���z ��}n�t |tR��rn�|��dd l*m+}m,}||���}t[|��}|d krXt]t_|����D];\}}|d z |z }|||d����}|||fvrt+|���}|�n�<|�|r |||��S|SdS) a_ Tests the given function for periodicity in the given symbol. Parameters ========== f : :py:class:`~.Expr` The concerned function. symbol : :py:class:`~.Symbol` The variable for which the period is to be determined. check : bool, optional The flag to verify whether the value being returned is a period or not. Returns ======= period The period of the function is returned. ``None`` is returned when the function is aperiodic or has a complex period. The value of $0$ is returned as the period of a constant function. Raises ====== NotImplementedError The value of the period computed cannot be verified. Notes ===== Currently, we do not support functions with a complex period. The period of functions having complex periodic values such as ``exp``, ``sinh`` is evaluated to ``None``. The value returned might not be the "fundamental" period of the given function i.e. it may not be the smallest periodic value of the function. The verification of the period through the ``check`` flag is not reliable due to internal simplification of the given expression. Hence, it is set to ``False`` by default. Examples ======== >>> from sympy import periodicity, Symbol, sin, cos, tan, exp >>> x = Symbol('x') >>> f = sin(x) + sin(2*x) + sin(3*x) >>> periodicity(f, x) 2*pi >>> periodicity(sin(x)*cos(x), x) pi >>> periodicity(exp(tan(2*x) - 1), x) pi/2 >>> periodicity(sin(4*x)**cos(2*x), x) pi >>> periodicity(exp(x), x) zCannot use symbol of kind %srPT)�realc���|���|z��}|�|��r|Sttd��d��d|�d|�d|�d� �����)z,Return the checked period or raise an error.z\ The period of the given function cannot be verified. When `z` was replaced with `z + z` in `z#`, the result was `z�` which was not recognized as being the same as the original function. So either the period was wrong or the two forms were not recognized as being equal. Set check=False to obtain the value.)r^�equalsrVr<)�orig_fr��new_frHs �rI�_checkzperiodicity.<locals>._check�sy���� � �F�F�V�O�4�4�� �<�<�� � � :��M�%�j�j����������������28�'9�'9�:�:� :rKNr�F)�as_Addr)�compogen� decompogen)0�kindr rVrr^r�r�lhs�rhs�simplify� free_symbolsrr}rr�rr_r rrrr|r�is_Powr\�Exp1rr rr�lcimrD� _periodicity�is_Mul�as_independentr�is_Addr � is_polynomialr3r r�sympy.solvers.decompogenr�r�r�� enumerate�reversed)rfrH�check�tempr�r�r��arg�err� period_real� period_imagr\�expo� base_has_sym� expo_has_sym�coeff�g�k�artr�r��g_s� num_of_gs�index� start_indexs ` rIr|r|�ss���t�{�*�$�$�!�"@�6�;�"N�O�O�O� ��4� � � �D� ���v�t���A� �F�:�:�:�:�:� �F� �F��!�Z� � �� �E�A�E�M�� � � � � �A� �Q�^�#�#��v� ��!�*�+�+�� ��X�X�f�%�%�F�F��"� � � � �D� �����!�S���3��f�Q�i�� �c�C��c�?� +� +� #��c�h�q�k�"�"�C��S�&�)�)�� � �*�S�#�"6�"6� � ��X�X�F� 3��v�f�f�Q�h�/�/�/��&� 3� 3� 3��3�-�c�2�2�2�3�3�3�3�3����� 3���� �!�S���:�a�h�:�1�6�Q�V�+;�+;� ��� �1�5�)�)� *� *�� �a�5�5�A�:�:�%�b��e�e�V�4�4�K�%�b��e�e�V�4�4�K��&�;�+B��{�K�8�9�9���x�6�A�F�a�f�$�$��V� ��d��x�x��'�'� ��x�x��'�'� � � 2� � 2� ��v�.�.�F�F� � 2�,� 2� ��v�.�.�F�F�"�!�&�&�1�1�F�F� ��(��#�#�F�5�#�9�9���q� �a�.� /� /� 2�|�E�1�7M�7M� 2� ��F�+�+�F�F�!�!�&�&�1�1�F�F� ��!�����'�'���1� �A�F�?�?��q�&�)�)� )��a�f�f�-�-��� �A�s� � ���v���1� ��;�;��F�F� ��0� 1� 1� 1� ��F�+�+�F�F��o�o�f�%�%� 1�&��F�*;�*;�q�*@�*@� �!�.� (� (��Q�������/�0�0��� �A�y� !� !�� � ��A�A�A�A�A�A�A�A��j��F�#�#����H�H� � �q�=�=�%�h�s�m�m�4�4� � ���q�'�!�m�e�3� ��H�S����.��7�7���V�Q�K�'�'�(��F�3�3�F��)���� �� � *��6�&�&�)�)� )�� � �4s*�<C� C�C�7F� F+�F&�&F+c���g}|D]:}t||��}|�dS|tjur|�|���;t |��dkrt |��S|r|dSdS)a] Helper for `periodicity` to find the period of a list of simpler functions. It uses the `lcim` method to find the least common period of all the functions. Parameters ========== args : Tuple of :py:class:`~.Symbol` All the symbols present in a function. symbol : :py:class:`~.Symbol` The symbol over which the function is to be evaluated. Returns ======= period The least common period of the function for all the symbols of the function. ``None`` if for at least one of the symbols the function is aperiodic. Nrr)r|rr}�appendr�r�)r_rH�periodsrfr�s rIr�r�Ys���2�G� �#�#���Q��'�'�� �>��4�4� ��� � � �N�N�6� "� "� "�� �7�|�|�a����G�}�}�����q�z���rKc�V��d}td�|D����rbd�|D��}d�|D��}|dd�t�fd�|D����r �}d�|D��}t|��|z}n*td �|D����rt|��}n |S) a�Returns the least common integral multiple of a list of numbers. The numbers can be rational or irrational or a mixture of both. `None` is returned for incommensurable numbers. Parameters ========== numbers : list Numbers (rational and/or irrational) for which lcim is to be found. Returns ======= number lcim if it exists, otherwise ``None`` for incommensurable numbers. Examples ======== >>> from sympy.calculus.util import lcim >>> from sympy import S, pi >>> lcim([S(1)/2, S(3)/4, S(5)/6]) 15/2 >>> lcim([2*pi, 3*pi, pi, pi/2]) 6*pi >>> lcim([S(1), 2*pi]) Nc3�$K�|] }|jV�� dSrM)� is_irrational�rF�nums rIrOzlcim.<locals>.<genexpr>�s%���� 0� 0��3� � 0� 0� 0� 0� 0� 0rKc�6�g|]}|�����SrC)�factorr�s rIrJzlcim.<locals>.<listcomp>�s ��;�;�;�C�3�:�:�<�<�;�;�;rKc�6�g|]}|�����SrC)� as_coeff_Mulr�s rIrJzlcim.<locals>.<listcomp>�s$��E�E�E�c�s�'�'�)�)�E�E�ErKrrc3�*�K�|] \}}|�kV��dSrMrC)rFr�r��terms �rIrOzlcim.<locals>.<genexpr>�s+�����?�?�-�%��v��~�?�?�?�?�?�?rKc��g|]\}}|��SrCrC)rFr�r�s rIrJzlcim.<locals>.<listcomp>�s��=�=�=� ��v�e�=�=�=rKc3�$K�|] }|jV�� dSrM)rZr�s rIrOzlcim.<locals>.<genexpr>�s$���� 0� 0��S�_� 0� 0� 0� 0� 0� 0rK)�allr4)�numbers�result�factorized_nums� factors_num� common_term�coeffsr�s @rIr�r��s����:�F� � 0� 0�� 0� 0� 0�0�0�  �;�;�7�;�;�;��E�E�_�E�E�E� ��1�~�a� �� �?�?�?�?�;�?�?�?� ?� ?� 4��K�=�=��=�=�=�F��f�%�%� �3�F�� � 0� 0�� 0� 0� 0� 0� 0� ��'�"�"��� � �MrKr�c�<��t|��dkrt||��jSddlm}t |��}|d}t �fd�t||��D����rdS|�|d��dk}|||d���rdSdS)a�Determines the convexity of the function passed in the argument. Parameters ========== f : :py:class:`~.Expr` The concerned function. syms : Tuple of :py:class:`~.Symbol` The variables with respect to which the convexity is to be determined. domain : :py:class:`~.Interval`, optional The domain over which the convexity of the function has to be checked. If unspecified, S.Reals will be the default domain. Returns ======= bool The method returns ``True`` if the function is convex otherwise it returns ``False``. Raises ====== NotImplementedError The check for the convexity of multivariate functions is not implemented yet. Notes ===== To determine concavity of a function pass `-f` as the concerned function. To determine logarithmic convexity of a function pass `\log(f)` as concerned function. To determine logarithmic concavity of a function pass `-\log(f)` as concerned function. Currently, convexity check of multivariate functions is not handled. Examples ======== >>> from sympy import is_convex, symbols, exp, oo, Interval >>> x = symbols('x') >>> is_convex(exp(x), x) True >>> is_convex(x**3, x, domain = Interval(-1, oo)) False >>> is_convex(1/x**2, x, domain=Interval.open(0, oo)) True References ========== .. [1] https://en.wikipedia.org/wiki/Convex_function .. [2] http://www.ifp.illinois.edu/~angelia/L3_convfunc.pdf .. [3] https://en.wikipedia.org/wiki/Logarithmically_convex_function .. [4] https://en.wikipedia.org/wiki/Logarithmically_concave_function .. [5] https://en.wikipedia.org/wiki/Concave_function rrr@c3� �K�|]}|�vV�� dSrMrC)rF�srgs �rIrOzis_convex.<locals>.<genexpr>�s'����� 6� 6�1�1��;� 6� 6� 6� 6� 6� 6rKFr�T) r�r>�is_positive_semidefiniterSrArrXrr )rfrgr�rA�var� conditions ` rI� is_convexr�s����x �4�y�y�1�}�}��q�$���8�8�F�F�F�F�F�F��� � �A� �q�'�C� � 6� 6� 6� 6� �a�� 5� 5� 6� 6� 6�6�6���u����s�A����"�I�"�"�9�c�5�&�A�A���u� �4rKc��ddlm}|tjur tjSt |||��}|t ||��||��}|S)a� Returns the stationary points of a function (where derivative of the function is 0) in the given domain. Parameters ========== f : :py:class:`~.Expr` The concerned function. symbol : :py:class:`~.Symbol` The variable for which the stationary points are to be determined. domain : :py:class:`~.Interval` The domain over which the stationary points have to be checked. If unspecified, ``S.Reals`` will be the default domain. Returns ======= Set A set of stationary points for the function. If there are no stationary point, an :py:class:`~.EmptySet` is returned. Examples ======== >>> from sympy import Interval, Symbol, S, sin, pi, pprint, stationary_points >>> x = Symbol('x') >>> stationary_points(1/x, x, S.Reals) EmptySet >>> pprint(stationary_points(sin(x), x), use_unicode=False) pi 3*pi {2*n*pi + -- | n in Integers} U {2*n*pi + ---- | n in Integers} 2 2 >>> stationary_points(sin(x),x, Interval(0, 4*pi)) {pi/2, 3*pi/2, 5*pi/2, 7*pi/2} rrx)raryrr`rur )rfrHrgry�sets rI�stationary_pointsr�s]��R0�/�/�/�/�/� ������z�� �q�&�&� 1� 1�F� �(�4��6�?�?�F�F� 3� 3�C� �JrKc��t|t��r3|tjurt d���t |||��jSt d|z���)a# Returns the maximum value of a function in the given domain. Parameters ========== f : :py:class:`~.Expr` The concerned function. symbol : :py:class:`~.Symbol` The variable for maximum value needs to be determined. domain : :py:class:`~.Interval` The domain over which the maximum have to be checked. If unspecified, then the global maximum is returned. Returns ======= number Maximum value of the function in given domain. Examples ======== >>> from sympy import Interval, Symbol, S, sin, cos, pi, maximum >>> x = Symbol('x') >>> f = -x**2 + 2*x + 5 >>> maximum(f, x, S.Reals) 6 >>> maximum(sin(x), x, Interval(-pi, pi/4)) sqrt(2)/2 >>> maximum(sin(x)*cos(x), x) 1/2 z+Maximum value not defined for empty domain.�%s is not a valid symbol.)r�rrr`r�rbr��rfrHrgs rI�maximumr.�\��L�&�&�!�!�?� �Q�Z� � ��J�K�K� K��a���0�0�4�4��4�v�=�>�>�>rKc��t|t��r3|tjurt d���t |||��jSt d|z���)a Returns the minimum value of a function in the given domain. Parameters ========== f : :py:class:`~.Expr` The concerned function. symbol : :py:class:`~.Symbol` The variable for minimum value needs to be determined. domain : :py:class:`~.Interval` The domain over which the minimum have to be checked. If unspecified, then the global minimum is returned. Returns ======= number Minimum value of the function in the given domain. Examples ======== >>> from sympy import Interval, Symbol, S, sin, cos, minimum >>> x = Symbol('x') >>> f = x**2 + 2*x + 5 >>> minimum(f, x, S.Reals) 4 >>> minimum(sin(x), x, Interval(2, 3)) sin(3) >>> minimum(sin(x)*cos(x), x) -1/2 z+Minimum value not defined for empty domain.r)r�rrr`r�rbr�rs rI�minimumr ]rrKN)F)\�accumulationboundsrrr� sympy.corerr�sympy.core.functionr r r �sympy.core.kindr �sympy.core.modr �sympy.core.numbersr�sympy.core.relationalr�sympy.core.symbolrr�sympy.core.sympifyr�$sympy.functions.elementary.complexesrrr�&sympy.functions.elementary.exponentialrr�#sympy.functions.elementary.integersr�$sympy.functions.elementary.piecewiser�(sympy.functions.elementary.trigonometricrrrrrrr r!r"r#r$r%r&�%sympy.functions.elementary.hyperbolicr'r(r)r*r+r,r-r.r/r0r1r2�sympy.polys.polytoolsr3r4�sympy.sets.setsr5r6r7r8r9�sympy.sets.fancysetsr:�sympy.sets.conditionsetr;�sympy.utilitiesr<�sympy.utilities.iterablesr=�sympy.matrices.denser>rurbr�r|r�r�rUrrrr rCrKrI�<module>r!s��?�?�?�?�?�?�?�?�(�(�(�(�(�(���������:�:�:�:�:�:�:�:�:�:�&�&�&�&�&�&�������+�+�+�+�+�+�,�,�,�,�,�,�+�+�+�+�+�+�+�+�'�'�'�'�'�'�<�<�<�<�<�<�<�<�<�<�;�;�;�;�;�;�;�;�4�4�4�4�4�4�:�:�:�:�:�:�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�:�2�2�2�2�2�2�2�2�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�0�0�0�0�0�0�&�&�&�&�&�&�.�.�.�.�.�.�(�(�(�(�(�(�@:�@:�@:�FF�F�F�Rm�m�m�`|�|�|�|�~&�&�&�R-�-�-�^ !�w�F�F�F�F�F�R)*��1�1�1�1�h �g�,?�,?�,?�,?�^ �g�,?�,?�,?�,?�,?�,?rK
Memory