403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.206
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/sympy/integrals/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/sympy/integrals/__pycache__/rde.cpython-310.pyc
o

�8Va.j�@sdZddlmZddlmZddlmZddlmZddl	m
Z
mZmZm
Z
ddlmZmZmZddlmZmZmZmZmZmZmZd	d
�Zdd�Zd(dd�Zdd�Zd)dd�Zd*dd�Zdd�Z dd�Z!dd�Z"dd�Z#d d!�Z$d"d#�Z%d+d$d%�Z&d&d'�Z'd
S),a�
Algorithms for solving the Risch differential equation.

Given a differential field K of characteristic 0 that is a simple
monomial extension of a base field k and f, g in K, the Risch
Differential Equation problem is to decide if there exist y in K such
that Dy + f*y == g and to find one if there are some.  If t is a
monomial over k and the coefficients of f and g are in k(t), then y is
in k(t), and the outline of the algorithm here is given as:

1. Compute the normal part n of the denominator of y.  The problem is
then reduced to finding y' in k<t>, where y == y'/n.
2. Compute the special part s of the denominator of y.   The problem is
then reduced to finding y'' in k[t], where y == y''/(n*s)
3. Bound the degree of y''.
4. Reduce the equation Dy + f*y == g to a similar equation with f, g in
k[t].
5. Find the solutions in k[t] of bounded degree of the reduced equation.

See Chapter 6 of "Symbolic Integration I: Transcendental Functions" by
Manuel Bronstein.  See also the docstring of risch.py.
�)�mul)�reduce)�oo)�Dummy)�Poly�gcd�ZZ�cancel)�sqrt�re�im)�gcdex_diophantine�frac_in�
derivation�splitfactor�NonElementaryIntegralException�DecrementLevel�recognize_log_derivativecCs�|jrtS|t||�kr|�|���ddSg}|}|�|�}d}|jr<|�||f�||}|d9}|�|�}|js%d}td|�}t|�dkri|��}	||	d}
|�|
�}|jrc||	d7}|
}t|�dksI|S)aY
    Computes the order of a at p, with respect to t.

    Explanation
    ===========

    For a, p in k[t], the order of a at p is defined as nu_p(a) = max({n
    in Z+ such that p**n|a}), where a != 0.  If a == 0, nu_p(a) = +oo.

    To compute the order at a rational function, a/b, use the fact that
    nu_p(a/b) == nu_p(a) - nu_p(b).
    r��)	�is_zerorr�as_poly�ET�rem�append�len�pop)�a�p�t�
power_list�p1�r�tracks_power�n�product�final�productf�r(�5/usr/lib/python3/dist-packages/sympy/integrals/rde.py�order_at(s2


�

�r*cCs|jrtS|�|�|�|�S)z�
    Computes the order of a/d at oo (infinity), with respect to t.

    For f in k(t), the order or f at oo is defined as deg(d) - deg(a), where
    f == a/d.
    )rr�degree)r�drr(r(r)�order_at_ooSsr-NcsF|ptd�}t|��\}}t||��j��}|�|�}|�t||���t|�����j����j����j��\}}	�t|�j�t	�����j��
���j��}
t|
|�}
|
j�|�sgtd�j��|ffSdd�|
�
�D�}tt���fdd�|D�td�j��}t	|��}
|�||
}||}|j|dd�\}}|||ffS)a�
    Weak normalization.

    Explanation
    ===========

    Given a derivation D on k[t] and f == a/d in k(t), return q in k[t]
    such that f - Dq/q is weakly normalized with respect to t.

    f in k(t) is said to be "weakly normalized" with respect to t if
    residue_p(f) is not a positive integer for any normal irreducible p
    in k[t] such that f is in R_p (Definition 6.1.1).  If f has an
    elementary integral, this is equivalent to no logarithm of
    integral(f) whose argument depends on t has a positive integer
    coefficient, where the arguments of the logarithms not in k(t) are
    in k[t].

    Returns (q, f - Dq/q)
    �zrcSs g|]}|tvr|dkr|�qS)r)r��.0�ir(r(r)�
<listcomp>�s z#weak_normalizer.<locals>.<listcomp>cs,g|]}t�t|�j�t������qSr()rrrr)r0r$��DEr�d1r(r)r2�s,T��include)rrr�diffr�quor
rrr�	resultant�expr�has�
real_rootsrrr	)rr,r4r.�dn�ds�g�
d_sqf_part�a1�br"�N�q�dq�sn�sdr(r3r)�weak_normalizer_s.

�"
�

�
rIcCs�t||�\}}t||�\}}|�|�}	|�|�|j���|	�|	�|j���}
||
}||
}|�|�dr7t�||}
|
j|dd�\}
}|||t|
|�|}|j|dd�\}}|||f|
|f|
fS)a
    Normal part of the denominator.

    Explanation
    ===========

    Given a derivation D on k[t] and f, g in k(t) with f weakly
    normalized with respect to t, either raise NonElementaryIntegralException,
    in which case the equation Dy + f*y == g has no solution in k(t), or the
    quadruplet (a, b, c, h) such that a, h in k[t], b, c in k<t>, and for any
    solution y in k(t) of Dy + f*y == g, q = y*h in k<t> satisfies
    a*Dq + b*q == c.

    This constitutes step 1 in the outline given in the rde.py docstring.
    rTr6)	rrr8rr9�divrr	r)�fa�fd�ga�gdr4r>r?�en�esr�hr�c�ca�cd�ba�bdr(r(r)�normal_denom�s
&rW�autocCslddlm}|dkr
|j}|dkrt|j|j�}n2|dkr)t|jdd|j�}n"|dvrE|���|�}	|���|�}
||	|
td|j�fStd	|��t|||j�t|||j�}t|||j�t|||j�}t	d|t	d|��}
|�sv|dkr�|j
�t|j|j��}t|��@t|�
d�|�
d�|�
d�|j�\}}t||j�\}}||||||�}|d
ur�|\}}}|dkr�t	|
|�}
Wd
�n1s�wYn�|dk�rv|j
�t|jdd|j��}t|���tt|�
td��|�
td��|�
td���|j�\}}tt|�
td��|�
td��|�
td���|j�\}}t||j�\}}ttd|j�|||��rf||ttd�|j�||||||||�}|d
u�rf|\}}}|dk�rft	|
|�}
Wd
�n	1�sqwYtd||
|�}||}||
}||}||�|�t|
|j�|t||��|�|}	|||�|�}
|}||	|
|fS)a
    Special part of the denominator.

    Explanation
    ===========

    case is one of {'exp', 'tan', 'primitive'} for the hyperexponential,
    hypertangent, and primitive cases, respectively.  For the
    hyperexponential (resp. hypertangent) case, given a derivation D on
    k[t] and a in k[t], b, c, in k<t> with Dt/t in k (resp. Dt/(t**2 + 1) in
    k, sqrt(-1) not in k), a != 0, and gcd(a, t) == 1 (resp.
    gcd(a, t**2 + 1) == 1), return the quadruplet (A, B, C, 1/h) such that
    A, B, C, h in k[t] and for any solution q in k<t> of a*Dq + b*q == c,
    r = qh in k[t] satisfies A*Dr + B*r == C.

    For ``case == 'primitive'``, k<t> == k[t], so it returns (a, b, c, 1) in
    this case.

    This constitutes step 2 of the outline given in the rde.py docstring.
    r��parametric_log_derivrX�exp�tanrr)�	primitive�basez@case must be one of {'exp', 'tan', 'primitive', 'base'}, not %s.N���)�sympy.integrals.prderZ�caserr�to_fieldr9�
ValueErrorr*�minr,rr�evalrr
rr�maxr)rrUrVrSrTr4rarZr�B�C�nb�ncr$�dcoeff�alphaa�alphad�etaa�etad�A�Q�mr.�betaa�betadrD�pN�pnrQr(r(r)�
special_denom�sj�
,

���


<<0



��
2rwFc	sxddlm}m}m}|dkr�j}|��j�}	|��j�}
|r+t�fdd�|D��}n|��j�}t|�	�j��
���|�	�j��
����}|dkrktd|t|
|	d��}
|
|	dkri|jritd|||
�}
|
S|dk�r�|
|	kr|td||
�}
n	td||	d�}
t
�j�j�jd�\}}�j}t����t
|�j�\}}|
|	dkr�z|||||fg��\\}}}Wn	ty�Yn�wt|�dkr�td	��t|
|d�}
n||
|	k�rI|||��}|d
u�ra|\}}|dk�ri|t|���	|�||�	|��
�|��|�
�}t
|�j�\}}z|||||fg��\\}}}Wn
t�y,YnEwt|�dk�r8td	��t|
|d���}
Wd
�|
SWd
�|
SWd
�|
SWd
�|
SWd
�|
SWd
�|
SWd
�|
S1�s}wY|
S|dk�r�td|t|
|	��}
|	|
k�r�t
�j�t�j�j���j�jd�\}}t���=t
|�j�\}}|||||��}|d
u�r�|\}}}|dk�r�t|
|�}
Wd
�|
SWd
�|
SWd
�|
S1�s�wY|
S|dv�r6�j��j�}�j�
�}t||�}td|t|	|d|
��}
|
|	|dk�r4|j�r4td|||
�}
|
Std
|��)am
    Bound on polynomial solutions.

    Explanation
    ===========

    Given a derivation D on k[t] and ``a``, ``b``, ``c`` in k[t] with ``a != 0``, return
    n in ZZ such that deg(q) <= n for any solution q in k[t] of
    a*Dq + b*q == c, when parametric=False, or deg(q) <= n for any solution
    c1, ..., cm in Const(k) and q in k[t] of a*Dq + b*q == Sum(ci*gi, (i, 1, m))
    when parametric=True.

    For ``parametric=False``, ``cQ`` is ``c``, a ``Poly``; for ``parametric=True``, ``cQ`` is Q ==
    [q1, ..., qm], a list of Polys.

    This constitutes step 3 of the outline given in the rde.py docstring.
    r)rZ�limited_integrate�!is_log_deriv_k_t_radical_in_fieldrXcsg|]}|��j��qSr()r+rr/�r4r(r)r2*sz bound_degree.<locals>.<listcomp>r^rr]zLength of m should be 1Nr[)r\�other_nonlinearzScase must be one of {'exp', 'tan', 'primitive', 'other_nonlinear', 'base'}, not %s.)r`rZrxryrar+rrfr	r�LC�as_expr�
is_Integerrr,�T�levelrrrrcrr9r)rrC�cQr4ra�
parametricrZrxry�da�db�dc�alphar$rnro�t1rlrm�za�zdrrrp�aar.�betarsrt�delta�lamr(rzr)�bound_degrees��I
�
��


���
��
�>�
�>�
�>�
�>�
�>�
�>�
�>�>
�
,




��
��
��
�
��r�cCstd|j�}td|j�}td|j�}	|jr||d||fS|dkdur%t�|�|�}|�|�js2t�|�|�|�|�|�|�}}}|�|j�dkr`|���|�}|���|�}|||||fSt	|||�\}	}
|t
||�7}|
t
|	|�}||�|j�8}|||	7}||9}q)a�
    Rothstein's Special Polynomial Differential Equation algorithm.

    Explanation
    ===========

    Given a derivation D on k[t], an integer n and ``a``,``b``,``c`` in k[t] with
    ``a != 0``, either raise NonElementaryIntegralException, in which case the
    equation a*Dq + b*q == c has no solution of degree at most ``n`` in
    k[t], or return the tuple (B, C, m, alpha, beta) such that B, C,
    alpha, beta in k[t], m in ZZ, and any solution q in k[t] of degree
    at most n of a*Dq + b*q == c must be of the form
    q == alpha*h + beta, where h in k[t], deg(h) <= m, and Dh + B*h == C.

    This constitutes step 4 of the outline given in the rde.py docstring.
    rrT)rrrrrrr9r+rbr
r)rrCrRr$r4�zeror�r�r@r"r.r(r(r)�spde�s.
"�r�cCs�td|j�}|jsT|�|j�|�|j�}d|kr |ks#t�t�t|�|j���|�|j���|j||jdd�}||}|d}|t||�||}|jr	|S)a�
    Poly Risch Differential Equation - No cancellation: deg(b) large enough.

    Explanation
    ===========

    Given a derivation D on k[t], ``n`` either an integer or +oo, and ``b``,``c``
    in k[t] with ``b != 0`` and either D == d/dt or
    deg(b) > max(0, deg(D) - 1), either raise NonElementaryIntegralException, in
    which case the equation ``Dq + b*q == c`` has no solution of degree at
    most n in k[t], or a solution q in k[t] of this equation with
    ``deg(q) < n``.
    rF��expandr)rrrr+rrr|r�rCrRr$r4rErrrr(r(r)�no_cancel_b_large�s�.��r�cCsVtd|j�}|js�|dkrd}n|�|j�|j�|j�d}d|kr*|ks-t�t�|dkrPt|�|j���||j�|j���|j||jdd�}nC|�|j�|�|j�kr^t�|�|j�dkr}||�|j|j	d�|�|j|j	d�fSt|�|j���|�|j���|jdd�}||}|d}|t
||�||}|jr	|S)a�
    Poly Risch Differential Equation - No cancellation: deg(b) small enough.

    Explanation
    ===========

    Given a derivation D on k[t], ``n`` either an integer or +oo, and ``b``,``c``
    in k[t] with deg(b) < deg(D) - 1 and either D == d/dt or
    deg(D) >= 2, either raise NonElementaryIntegralException, in which case the
    equation Dq + b*q == c has no solution of degree at most n in k[t],
    or a solution q in k[t] of this equation with deg(q) <= n, or the
    tuple (h, b0, c0) such that h in k[t], b0, c0, in k, and for any
    solution q in k[t] of degree at most n of Dq + bq == c, y == q - h
    is a solution in k of Dy + b0*y == c0.
    rrFr�)rrrr+r,rrr|rr�rr�r(r(r)�no_cancel_b_small�s6�0��$��r�c
Csptd|j�}t|�|j���|j�|j����}|jr#|jr#|}nd}|js�t	||�
|j�|j�
|j�d�}d|krE|ksHt�t�t||j�|j���|�|j����}|jre|||fS|dkrt|�|j���||j||jdd�}	n!|�
|j�|j�
|j�dkr�t�|�|j���|�|j���}	||	}|d}|t|	|�||	}|jr(|S)a�
    Poly Risch Differential Equation - No cancellation: deg(b) == deg(D) - 1

    Explanation
    ===========

    Given a derivation D on k[t] with deg(D) >= 2, n either an integer
    or +oo, and b, c in k[t] with deg(b) == deg(D) - 1, either raise
    NonElementaryIntegralException, in which case the equation Dq + b*q == c has
    no solution of degree at most n in k[t], or a solution q in k[t] of
    this equation with deg(q) <= n, or the tuple (h, m, C) such that h
    in k[t], m in ZZ, and C in k[t], and for any solution q in k[t] of
    degree at most n of Dq + b*q == c, y == q - h is a solution in k[t]
    of degree at most m of Dy + b*y == C.
    rr_rFr�)
rrr	rr|r,r~�is_positiverrfr+rr)
rCrRr$r4rE�lc�Mrr�urr(r(r)�no_cancel_equal�s0($�*
, �r�cCs^ddlm}t|��&t||j�\}}||||�}|dur)|\}}|dkr)td��Wd�n1s3wY|jr=|S||�|j�krGt�t	d|j�}	|js�|�|j�}
||
kr\t�t|��t|�
�|j�\}}t|||||�\}
}Wd�n1swYt	|
��|��|j|
|jdd�}|	|7}	|
d}|||t
||�8}|jrP|	S)a�
    Poly Risch Differential Equation - Cancellation: Primitive case.

    Explanation
    ===========

    Given a derivation D on k[t], n either an integer or +oo, ``b`` in k, and
    ``c`` in k[t] with Dt in k and ``b != 0``, either raise
    NonElementaryIntegralException, in which case the equation Dq + b*q == c
    has no solution of degree at most n in k[t], or a solution q in k[t] of
    this equation with deg(q) <= n.
    r)ryNrz7is_deriv_in_field() is required to  solve this problem.Fr�)r`ryrrr�NotImplementedErrorrr+rrr|�rischDEr}r)rCrRr$r4ryrUrVrpr.rErr�a2a�a2d�sarH�stmr(r(r)�cancel_primitive+s:
��

�&�r�cCs�ddlm}|j�t|j|j����}t|��1t||j�\}}t||j�\}}	|||	|||�}
|
durA|
\}}}
|dkrAt	d��Wd�n1sKwY|j
rU|S||�|j�kr_t�td|j�}|j
s�|�|j�}||krtt�|��}t|��6t||j�\}}||||t||j�}||}t|�
�|j�\}}t|||||�\}}Wd�n1s�wYt|��|��|j||jdd�}||7}|d}|||t||�8}|j
rh|S)a�
    Poly Risch Differential Equation - Cancellation: Hyperexponential case.

    Explanation
    ===========

    Given a derivation D on k[t], n either an integer or +oo, ``b`` in k, and
    ``c`` in k[t] with Dt/t in k and ``b != 0``, either raise
    NonElementaryIntegralException, in which case the equation Dq + b*q == c
    has no solution of degree at most n in k[t], or a solution q in k[t] of
    this equation with deg(q) <= n.
    rrYNrz6is_deriv_in_field() is required to solve this problem.Fr�)r`rZr,r9rrr}rrr�rr+rr|r�r)rCrRr$r4rZ�etarnrorUrVrprrrr.rErB�a1a�a1dr�r�r�rHr�r(r(r)�
cancel_exp]sF


��
�&	�r�cCs�ddlm}m}|js2|jdks"|�|j�td|j�|j�d�kr2|r+|||||�St	||||�S|jsD|�|j�|j�|j�dkr�|jdksR|j�|j�dkr�|r[|||||�St
||||�}t|t�ri|S|\}}	}
t
|��3|	�|j�|
�|j�}	}
|	dur�td��|
dur�td��t|	|
||��|j�}Wd�||S1s�wY||S|j�|j�dk�r|�|j�|j�|j�dk�r||�|j���|j�|j���k�r|�|j���js�td	��|r�td
��t||||�}t|t��r|S|\}}}
t||
||�}||S|j�rtd��|jdk�r.|�r'td
��t||||�S|jdk�rB|�r;td��t||||�Std|j��)a
    Solve a Polynomial Risch Differential Equation with degree bound ``n``.

    This constitutes step 4 of the outline given in the rde.py docstring.

    For parametric=False, cQ is c, a Poly; for parametric=True, cQ is Q ==
    [q1, ..., qm], a list of Polys.
    r)�prde_no_cancel_b_large�prde_no_cancel_b_smallr^rrNzb0 should be a non-Null valuezc0 should be a non-Null valuezResult should be a numberz0prde_no_cancel_b_equal() is not yet implemented.zWRemaining cases for Poly (P)RDE are not yet implemented (is_deriv_in_field() required).r[zIParametric RDE cancellation hyperexponential case is not yet implemented.r]zBParametric RDE cancellation primitive case is not yet implemented.zBOther Poly (P)RDE cancellation cases are not yet implemented (%s).)r`r�r�rrar+rrfr,r�r��
isinstancerrrrc�solve_poly_rder|�	is_number�	TypeErrorr�r�r�r�)rCr�r$r4r�r�r��RrQ�b0�c0�yrrrhr(r(r)r��sd	$$



��4*
�r�cCs�t|||�\}\}}t|||||�\}\}}\}	}
}t||||	|
|�\}}
}}z	t||
||�}Wnty;t}Ynwt||
|||�\}
}}}}|jrO|}nt|
|||�}|||||fS)a
    Solve a Risch Differential Equation: Dy + f*y == g.

    Explanation
    ===========

    See the outline in the docstring of rde.py for more information
    about the procedure used.  Either raise NonElementaryIntegralException, in
    which case there is no solution y in the given differential field,
    or return y in k(t) satisfying Dy + f*y == g, or raise
    NotImplementedError, in which case, the algorithms necessary to
    solve the given Risch Differential Equation have not yet been
    implemented.
    )	rIrWrwr�r�rr�rr�)rKrLrMrNr4�_rrUrVrSrT�hnrprgrh�hsr$rrr�r�r�r(r(r)r��s �r�)N)rX)rXF)F)(�__doc__�operatorr�	functoolsr�
sympy.corer�sympy.core.symbolr�sympy.polysrrrr	�sympyr
rr�sympy.integrals.rischr
rrrrrrr*r-rIrWrwr�r�r�r�r�r�r�r�r�r(r(r(r)�<module>s,$+
3
%
Ut///2
=]

Youez - 2016 - github.com/yon3zu
LinuXploit