
    \h                     T    S r SSKJrJrJr  SSKJr  SSKJr  SSK	J
r
  \SS j5       rg)	z0Tools for manipulation of rational expressions.     )BasicAddsympify)	gcd_terms)public)iterablec                 :   ^^^ UUU4S jmT" [        U 5      5      $ )aS  
Denest and combine rational expressions using symbolic methods.

This function takes an expression or a container of expressions
and puts it (them) together by denesting and combining rational
subexpressions. No heroic measures are taken to minimize degree
of the resulting numerator and denominator. To obtain completely
reduced expression use :func:`~.cancel`. However, :func:`~.together`
can preserve as much as possible of the structure of the input
expression in the output (no expansion is performed).

A wide variety of objects can be put together including lists,
tuples, sets, relational objects, integrals and others. It is
also possible to transform interior of function applications,
by setting ``deep`` flag to ``True``.

By definition, :func:`~.together` is a complement to :func:`~.apart`,
so ``apart(together(expr))`` should return expr unchanged. Note
however, that :func:`~.together` uses only symbolic methods, so
it might be necessary to use :func:`~.cancel` to perform algebraic
simplification and minimize degree of the numerator and denominator.

Examples
========

>>> from sympy import together, exp
>>> from sympy.abc import x, y, z

>>> together(1/x + 1/y)
(x + y)/(x*y)
>>> together(1/x + 1/y + 1/z)
(x*y + x*z + y*z)/(x*y*z)

>>> together(1/(x*y) + 1/y**2)
(x + y)/(x*y**2)

>>> together(1/(1 + 1/x) + 1/(1 + 1/y))
(x*(y + 1) + y*(x + 1))/((x + 1)*(y + 1))

>>> together(exp(1/x + 1/y))
exp(1/y + 1/x)
>>> together(exp(1/x + 1/y), deep=True)
exp((x + y)/(x*y))

>>> together(1/exp(x) + 1/(x*exp(x)))
(x + 1)*exp(-x)/x

>>> together(1/exp(2*x) + 1/(x*exp(3*x)))
(x*exp(x) + 1)*exp(-3*x)/x

c           
        > [        U [        5      (       a  U R                  (       d  U R                  (       a	  T(       d  U $ U R                  (       a1  [        [        [        T[        R                  " U 5      5      5      TS9$ U R                  (       aI  T" U R                  5      nT(       a  T" U R                  5      nOU R                  nU R                  X5      $ U R                  " U R                   Vs/ s H  nT" U5      PM     sn6 $ [        U 5      (       a(  U R!                  U  Vs/ s H  nT" U5      PM     sn5      $ U $ s  snf s  snf )N)fraction)
isinstancer   is_Atomis_Functionis_Addr   listmapr   	make_argsis_Powbaseexpfuncargsr   	__class__)exprr   r   argex	_togetherdeepr   s        Q/var/www/auris/envauris/lib/python3.13/site-packages/sympy/polys/rationaltools.pyr   together.<locals>._together?   s    dE""|| 0 0 c)S]]45H&I!JU]^^ +#DHH-C((Cyy++yydii"IisIcNi"IJJd^^>>D"BDbIbMD"BCC	 #J"Bs   8E-E)r   )r   r   r   r   s    ``@r   togetherr    
   s    j, WT]##    N)FT)__doc__
sympy.corer   r   r   sympy.core.exprtoolsr   sympy.utilitiesr   sympy.utilities.iterablesr   r     r!   r   <module>r(      s/    6 + * * " . J$ J$r!   