K iaDdZddlmZddlmZddlmZddlmZm Z ddl m Z m Z m Z mZddlmZmZddlmZmZmZdd lmZdd lmZmZdd lmZmZdd lmZdd l m!Z!m"Z"m#Z#ddl$m%Z%ddl&m'Z'ddl(Z(dZ)d!dZ*dZ+dZ,d"dddZ-d#dZ.dZ/dZ0dZ1dZ2d$dZ3dZ4dZ5d Z6y)%a This module contains pdsolve() and different helper functions that it uses. It is heavily inspired by the ode module and hence the basic infrastructure remains the same. **Functions in this module** These are the user functions in this module: - pdsolve() - Solves PDE's - classify_pde() - Classifies PDEs into possible hints for dsolve(). - pde_separate() - Separate variables in partial differential equation either by additive or multiplicative separation approach. These are the helper functions in this module: - pde_separate_add() - Helper function for searching additive separable solutions. - pde_separate_mul() - Helper function for searching multiplicative separable solutions. **Currently implemented solver methods** The following methods are implemented for solving partial differential equations. See the docstrings of the various pde_hint() functions for more information on each (run help(pde)): - 1st order linear homogeneous partial differential equations with constant coefficients. - 1st order linear general partial differential equations with constant coefficients. - 1st order linear partial differential equations with variable coefficients. )reduce)combinations_with_replacement)simplify)AddS)Functionexpand AppliedUndefSubs)EqualityEq)SymbolWildsymbols)exp)Integral integrate)has_dups is_sequence) filldedent) _preprocess ode_order_desolve)solve)collectN)%1st_linear_constant_coeff_homogeneous1st_linear_constant_coeff"1st_linear_constant_coeff_Integral1st_linear_variable_coeffc |s td}t|f||ddd|}|jdd}|jdd}|rmi}i} t|d} |j | d | d d |D]*} t ||||d ||d ||||} | ||<,|j | |St ||d|d |d ||d|S#t $r} | | |<Yd } ~ rd } ~ wwxYw)a Solves any (supported) kind of partial differential equation. **Usage** pdsolve(eq, f(x,y), hint) -> Solve partial differential equation eq for function f(x,y), using method hint. **Details** ``eq`` can be any supported partial differential equation (see the pde docstring for supported methods). This can either be an Equality, or an expression, which is assumed to be equal to 0. ``f(x,y)`` is a function of two variables whose derivatives in that variable make up the partial differential equation. In many cases it is not necessary to provide this; it will be autodetected (and an error raised if it could not be detected). ``hint`` is the solving method that you want pdsolve to use. Use classify_pde(eq, f(x,y)) to get all of the possible hints for a PDE. The default hint, 'default', will use whatever hint is returned first by classify_pde(). See Hints below for more options that you can use for hint. ``solvefun`` is the convention used for arbitrary functions returned by the PDE solver. If not set by the user, it is set by default to be F. **Hints** Aside from the various solving methods, there are also some meta-hints that you can pass to pdsolve(): "default": This uses whatever hint is returned first by classify_pde(). This is the default argument to pdsolve(). "all": To make pdsolve apply all relevant classification hints, use pdsolve(PDE, func, hint="all"). This will return a dictionary of hint:solution terms. If a hint causes pdsolve to raise the NotImplementedError, value of that hint's key will be the exception object raised. The dictionary will also include some special keys: - order: The order of the PDE. See also ode_order() in deutils.py - default: The solution that would be returned by default. This is the one produced by the hint that appears first in the tuple returned by classify_pde(). "all_Integral": This is the same as "all", except if a hint also has a corresponding "_Integral" hint, it only returns the "_Integral" hint. This is useful if "all" causes pdsolve() to hang because of a difficult or impossible integral. This meta-hint will also be much faster than "all", because integrate() is an expensive routine. See also the classify_pde() docstring for more info on hints, and the pde docstring for a list of all supported hints. **Tips** - You can declare the derivative of an unknown function this way: >>> from sympy import Function, Derivative >>> from sympy.abc import x, y # x and y are the independent variables >>> f = Function("f")(x, y) # f is a function of x and y >>> # fx will be the partial derivative of f with respect to x >>> fx = Derivative(f, x) >>> # fy will be the partial derivative of f with respect to y >>> fy = Derivative(f, y) - See test_pde.py for many tests, which serves also as a set of examples for how to use pdsolve(). - pdsolve always returns an Equality class (except for the case when the hint is "all" or "all_Integral"). Note that it is not possible to get an explicit solution for f(x, y) as in the case of ODE's - Do help(pde.pde_hintname) to get help more information on a specific hint Examples ======== >>> from sympy.solvers.pde import pdsolve >>> from sympy import Function, Eq >>> from sympy.abc import x, y >>> f = Function('f') >>> u = f(x, y) >>> ux = u.diff(x) >>> uy = u.diff(y) >>> eq = Eq(1 + (2*(ux/u)) + (3*(uy/u)), 0) >>> pdsolve(eq) Eq(f(x, y), F(3*x - 2*y)*exp(-2*x/13 - 3*y/13)) FTpde)funchintrtypeeqFall)dictorderdefault)r)r*r#Nr$)rrpop classify_pdeupdate_helper_simplifyNotImplementedError) r&r#r$r(solvefunkwargshintsall_pdedict failed_hintsgethintsrvdetails W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/solvers/pde.pypdsolver:?sDL C= R +d +#) +E 4 B 99UE "D  .'!2#+I#68 9 #D #%b$d F0C$K(%+d*;XG !#  # |$ E&M5= %geFm0DhP P' ,%+ T" ,s6"C C)C$$C)c ptd|jdz}t|||||||||S)zHelper function of pdsolve that calls the respective pde functions to solve for the partial differential equations. This minimizes the computation in calling _desolve multiple times. pde_ _Integral)globals removesuffix_handle_Integral)r&r$r#r)matchr0 solvefuncs r9r.r.sF  &4#4#4[#AABI Ib$ xt --ch|jdr|S|dk(rt|jS|S)z| Converts a solution with integrals in it into an actual solution. Simplifies the integral mainly using doit() r=r)endswithrdoit)exprr#r)r$s r9r@r@s6  }}[! , , $$ rCT)prepc |r#t|jdk7r td|s|t||\}}||}t |t r>|j dk7r#t|j|j z |S|j}|j}|jd}|jd}|||j|} |||j|} t||||} d| i| s |rdd<Syt|}td |||g } td |||| | ||g } td |||| | ||g }td |||| | ||g }td|||| | g }td||g }|}|jrd}tt!||f| D]d}|j#|||j|}|dk(r.|j%| ||||zz}|sO|| sU| |||ks`||}f|r/||||z}t'|jDcgc]}||z  c}}| dk(r t)||||}|j%| | z|| zz||||zz|z}|rU||s|j+| ||d|d<n|| dz||dzzdk7r|j+| |||d|d<|d<ntd |||| | g } td |||| | g }td |||| | g }|j%| | z|| zz||||zz|z}|r|j+| |||d|d<t-fdt.D}|r#dd<|d<t.D]}|vs|d<SS|Scc}w)a Returns a tuple of possible pdsolve() classifications for a PDE. The tuple is ordered so that first item is the classification that pdsolve() uses to solve the PDE by default. In general, classifications near the beginning of the list will produce better solutions faster than those near the end, though there are always exceptions. To make pdsolve use a different classification, use pdsolve(PDE, func, hint=). See also the pdsolve() docstring for different meta-hints you can use. If ``dict`` is true, classify_pde() will return a dictionary of hint:match expression terms. This is intended for internal use by pdsolve(). Note that because dictionaries are ordered arbitrarily, this will most likely not be in the same order as the tuple. You can get help on different hints by doing help(pde.pde_hintname), where hintname is the name of the hint without "_Integral". See sympy.pde.allhints or the sympy.pde docstring for a list of all supported hints that can be returned from classify_pde. Examples ======== >>> from sympy.solvers.pde import classify_pde >>> from sympy import Function, Eq >>> from sympy.abc import x, y >>> f = Function('f') >>> u = f(x, y) >>> ux = u.diff(x) >>> uy = u.diff(y) >>> eq = Eq(1 + (2*(ux/u)) + (3*(uy/u)), 0) >>> classify_pde(eq) ('1st_linear_constant_coeff_homogeneous',) zLRight now only partial differential equations of two variables are supportedNrr)r*a)excludebcden)rOrPrQr)rOrPrQrRrrrc3,K|] }|vs| yw)NrL).0imatching_hintss r9 zclassify_pde.._s@1A,?Q@s  ordered_hints)lenargsr/r isinstancer rhsr,lhsr#diffrr ris_AddsetrcoeffrArrr-tupleallhints)r&r#r(rHr1func_fxyfxfyr)rMrOrPrQrRrS reduced_eqpowerrVrbrAdenargrrettuplerWs @r9r,r,s5N DII!#!#DE E t|!"d+ e <D"h 66Q;6 6 VV A ! A ! A 1QQB 1QQB b!Aa& !Eu%N  (,N9 %! ! B SQqVH%A SQqVRQ23A SQqVRQ23A SQqVRQ23A SQqVR,-A SQF#AJ yy2Aa5%@A %AHH[QqV[[!_-EzKK!Aa&!) ,Eq=E!Hu$4!!HE % Aa&%-C"'':3s3w:;J zZ1a1   QrTAbD[1QqV83a7 8 Q4qqq12JKFG1q1Q47"a'qqqq9:>?:;GHCDS1Q7B"34AS1Q7B"34AS1Q7B"34A  2"q1Qx!7!!;?:;@@@H %)y!*2' AN",-y)   OQ;s N>c t|ts t|d}| t|j\}}t |tr,t||Dcgc]}t||||c}St|ts t||}n|j|k(r |j }|j|k(xr|jj#| }|ra|s_t%||}|rQt|dk(rt|t||d|dSt||D cgc]} t|| c} |dS|j|k(r`|j|jz }t'|j)||jj+}|t,j.u|fSt1t3d|d|d#t $rt |tr|n|gDcgc]}|jtncc}w}}tj|}t|dk7r t d|j}YwxYwcc}wcc} w) a Checks if the given solution satisfies the partial differential equation. pde is the partial differential equation which can be given in the form of an equation or an expression. sol is the solution for which the pde is to be checked. This can also be given in an equation or an expression form. If the function is not provided, the helper function _preprocess from deutils is used to identify the function. If a sequence of solutions is passed, the same sort of container will be used to return the result for each solution. The following methods are currently being implemented to check if the solution satisfies the PDE: 1. Directly substitute the solution in the PDE and check. If the solution has not been solved for f, then it will solve for f provided solve_for_func has not been set to False. If the solution satisfies the PDE, then a tuple (True, 0) is returned. Otherwise a tuple (False, expr) where expr is the value obtained after substituting the solution in the PDE. However if a known solution returns False, it may be due to the inability of doit() to simplify it to zero. Examples ======== >>> from sympy import Function, symbols >>> from sympy.solvers.pde import checkpdesol, pdsolve >>> x, y = symbols('x y') >>> f = Function('f') >>> eq = 2*f(x,y) + 3*f(x,y).diff(x) + 4*f(x,y).diff(y) >>> sol = pdsolve(eq) >>> assert checkpdesol(eq, sol)[0] >>> eq = x*f(x,y) + f(x,y).diff(x) >>> checkpdesol(eq, sol) (False, (x*F(4*x - 3*y) - 6*F(4*x - 3*y)/25 + 4*Subs(Derivative(F(_xi_1), _xi_1), _xi_1, 4*x - 3*y))*exp(-6*x/25 - 8*y/25)) rrKz0must pass func arg to checkpdesol for this case.)r#solve_for_funcFz Unable to test if z is a solution to .)r\r r rr^ ValueErrorrraatomsr unionrZr+r% checkpdesolr]reversedhasrrsubsrFrZeror/r) r"solr#rr_sfuncsrVsolvedts r9rwrwns2T c8 $aj | !#''*GAt3tCy479/0& )+9: : c8 $sm DllWW_ 6SWW[[%6!6FfsD! 6{a"34(;e55#3f(ED!(Ee55 ww$gg SXXdCGG,113 4AFF{A~ j8;S*BC DDQ "3,3%:qQWW\*::E:EKK&E5zQ FHH99;D 9&)Fs*GII  I&HA IIc &|j}|jd}|jd}||d}||d} ||d} t|||tt |  |dz| dzzz ||z| |zzz|| |z||zz zS)a Solves a first order linear homogeneous partial differential equation with constant coefficients. The general form of this partial differential equation is .. math:: a \frac{\partial f(x,y)}{\partial x} + b \frac{\partial f(x,y)}{\partial y} + c f(x,y) = 0 where `a`, `b` and `c` are constants. The general solution is of the form: .. math:: f(x, y) = F(- a y + b x ) e^{- \frac{c (a x + b y)}{a^2 + b^2}} and can be found in SymPy with ``pdsolve``:: >>> from sympy.solvers import pdsolve >>> from sympy.abc import x, y, a, b, c >>> from sympy import Function, pprint >>> f = Function('f') >>> u = f(x,y) >>> ux = u.diff(x) >>> uy = u.diff(y) >>> genform = a*ux + b*uy + c*u >>> pprint(genform) d d a*--(f(x, y)) + b*--(f(x, y)) + c*f(x, y) dx dy >>> pprint(pdsolve(genform)) -c*(a*x + b*y) --------------- 2 2 a + b f(x, y) = F(-a*y + b*x)*e Examples ======== >>> from sympy import pdsolve >>> from sympy import Function, pprint >>> from sympy.abc import x,y >>> f = Function('f') >>> pdsolve(f(x,y) + f(x,y).diff(x) + f(x,y).diff(y)) Eq(f(x, y), F(x - y)*exp(-x/2 - y/2)) >>> pprint(pdsolve(f(x,y) + f(x,y).diff(x) + f(x,y).diff(y))) x y - - - - 2 2 f(x, y) = F(x - y)*e References ========== - Viktor Grigoryan, "Partial Differential Equations" Math 124A - Fall 2010, pp.7 rrKrOrPrQrJ)r#r[r rr) r&r#r)rAr0rfrgrhrOrPrQs r9)pde_1st_linear_constant_coeff_homogeneousrsB A ! A ! A eCjA eCjA eCjA a!fc1Q4%A1-qsQqSy9:8AaC!A#I;NN OOrCc Vtd\}}|j}|jd}|jd} ||d} ||d} ||d} ||d } tt |  | dz| dzzz |z}||}t | |z| | zz|z | |z| | zz |z f|| }dt | dz| dzzz t d|z | zj||| |z| | zzfz}t||| t|||zz||f| |z| | zz | |z| | zzfS) a Solves a first order linear partial differential equation with constant coefficients. The general form of this partial differential equation is .. math:: a \frac{\partial f(x,y)}{\partial x} + b \frac{\partial f(x,y)}{\partial y} + c f(x,y) = G(x,y) where `a`, `b` and `c` are constants and `G(x, y)` can be an arbitrary function in `x` and `y`. The general solution of the PDE is: .. math:: f(x, y) = \left. \left[F(\eta) + \frac{1}{a^2 + b^2} \int\limits^{a x + b y} G\left(\frac{a \xi + b \eta}{a^2 + b^2}, \frac{- a \eta + b \xi}{a^2 + b^2} \right) e^{\frac{c \xi}{a^2 + b^2}}\, d\xi\right] e^{- \frac{c \xi}{a^2 + b^2}} \right|_{\substack{\eta=- a y + b x\\ \xi=a x + b y }}\, , where `F(\eta)` is an arbitrary single-valued function. The solution can be found in SymPy with ``pdsolve``:: >>> from sympy.solvers import pdsolve >>> from sympy.abc import x, y, a, b, c >>> from sympy import Function, pprint >>> f = Function('f') >>> G = Function('G') >>> u = f(x, y) >>> ux = u.diff(x) >>> uy = u.diff(y) >>> genform = a*ux + b*uy + c*u - G(x,y) >>> pprint(genform) d d a*--(f(x, y)) + b*--(f(x, y)) + c*f(x, y) - G(x, y) dx dy >>> pprint(pdsolve(genform, hint='1st_linear_constant_coeff_Integral')) // a*x + b*y \ \| || / | || || | | || || | c*xi | || || | ------- | || || | 2 2 | || || | /a*xi + b*eta -a*eta + b*xi\ a + b | || || | G|------------, -------------|*e d(xi)| || || | | 2 2 2 2 | | || || | \ a + b a + b / | -c*xi || || | | -------|| || / | 2 2|| || | a + b || f(x, y) = ||F(eta) + -------------------------------------------------------|*e || || 2 2 | || \\ a + b / /|eta=-a*y + b*x, xi=a*x + b*y Examples ======== >>> from sympy.solvers.pde import pdsolve >>> from sympy import Function, pprint, exp >>> from sympy.abc import x,y >>> f = Function('f') >>> eq = -2*f(x,y).diff(x) + 4*f(x,y).diff(y) + 5*f(x,y) - exp(x + 3*y) >>> pdsolve(eq) Eq(f(x, y), (F(4*x + 2*y)*exp(x/2) + exp(x + 4*y)/15)*exp(-y)) References ========== - Viktor Grigoryan, "Partial Differential Equations" Math 124A - Fall 2010, pp.7 zxi etarrKrOrPrQrRrJ) rr#r[rrrrrzr r )r&r#r)rAr0xietarfrgrhrOrPrQrRexptermfuncterm solvedictgenterms r9pde_1st_linear_constant_coeffrsq`hGB A ! A ! A eCjA eCjA eCjA uSz A1Q4%A1%b()G}HqsQqSy2~qsQqSy37A>I1a4!Q$; 719%AaC!A#I"88G a!fd7Hw$67 b AaC!A#IqsQqSy)+ ,,rCcddlm}td}|j}|jd}|jd} ||d} ||d} ||d} ||d } | s`| r| s\| r, t | | z | }t ||| |||zS| r, t | | z |}t ||| || |zS| s||j|| z| ||zz| z }||||}|j|jz || hz }t|j||| }t ||| |S| s|| j| | z| || zz| z }|||| }|j|jz || hz }t|j|||}t ||| |Std}| | z j| ||}|||j||z ||}t|tr|d}|j|jz || hz }t!|dk(r|j#}t%||dj||| }t%||z | d}| ||j|z| ||zz| z j| |}||||d j}t|tr|d}|j|jz || hz }t||||}t ||| |Std #t$r td wxYw#t$r td wxYw) a Solves a first order linear partial differential equation with variable coefficients. The general form of this partial differential equation is .. math:: a(x, y) \frac{\partial f(x, y)}{\partial x} + b(x, y) \frac{\partial f(x, y)}{\partial y} + c(x, y) f(x, y) = G(x, y) where `a(x, y)`, `b(x, y)`, `c(x, y)` and `G(x, y)` are arbitrary functions in `x` and `y`. This PDE is converted into an ODE by making the following transformation: 1. `\xi` as `x` 2. `\eta` as the constant in the solution to the differential equation `\frac{dy}{dx} = -\frac{b}{a}` Making the previous substitutions reduces it to the linear ODE .. math:: a(\xi, \eta)\frac{du}{d\xi} + c(\xi, \eta)u - G(\xi, \eta) = 0 which can be solved using ``dsolve``. >>> from sympy.abc import x, y >>> from sympy import Function, pprint >>> a, b, c, G, f= [Function(i) for i in ['a', 'b', 'c', 'G', 'f']] >>> u = f(x,y) >>> ux = u.diff(x) >>> uy = u.diff(y) >>> genform = a(x, y)*u + b(x, y)*ux + c(x, y)*uy - G(x,y) >>> pprint(genform) d d -G(x, y) + a(x, y)*f(x, y) + b(x, y)*--(f(x, y)) + c(x, y)*--(f(x, y)) dx dy Examples ======== >>> from sympy.solvers.pde import pdsolve >>> from sympy import Function, pprint >>> from sympy.abc import x,y >>> f = Function('f') >>> eq = x*(u.diff(x)) - y*(u.diff(y)) + y**2*u - y**2 >>> pdsolve(eq) Eq(f(x, y), F(x*y)*exp(y**2/2) + 1) References ========== - Viktor Grigoryan, "Partial Differential Equations" Math 124A - Fall 2010, pp.7 r)dsolverrKrOrPrQrRz7Unable to find a solution due to inability of integrate 1st_linear)r$zOCannot solve the partial differential equation due to inability of constantsimp)sympy.solvers.oderrr#r[rr r/r_ free_symbols_simplify_variable_coeffr]rrzr\listrZr+r)r&r#r)rAr0rrrfrgrhrOrPrQrRtsolploder|symsr]dummyhsolsymetatysubdeqfinalfinsymss r9pde_1st_linear_variable_coeffrysp) %.C A ! A ! A eCjA eCjA eCjA uSz A a:$QqS!,D a!fhqkD&899:$QqS!,D a!fhqkD&899 ! ! Q1Q4'!+UAaD!%"4"441v=&swwhB!Aq'3 ! ! Q1Q4'!+UAaD!%"4"441v=&swwhB!Aq'3 SME 1 1eAhA qq!A%uQx 0C#t!f    .!Q 7F 6{ac6"1%++E!Ha8S4Z#A&!A$))A,!AaD&(1,221d;QqT 5:: eT "!HE$$s'7'771a&@&ugxF!Aq'3"#,- -g+:-/9:::+:-/9:::s&M M% M"%M:ctd}t|dk(r)|j}|j|||}n|D]}|j|||}t j||S)zX Helper function to replace constants by functions in 1st_linear_variable_coeff rrK)rrZr+rzr)r|rr#funcargrsymrs r9rrst -C 4yA~hhjd7m, 1CHHS$w-0E 1 EJJsG, --rCcd}|dk(rd}n|dk(rd}ntd|zt|tr>|jdk7rGt t |j |jz d|||St t |d|||S|jdk7r tdt|j}|Dcgc]}|jD]}|}}}|rttj|} nttj|} t|t|k7r tdt|r td t|t|k7r td |j j!|| j#} |sd}| jD] } || | z z } |} |d} |d d } t%| | | Scc}}w) aSeparate variables in partial differential equation either by additive or multiplicative separation approach. It tries to rewrite an equation so that one of the specified variables occurs on a different side of the equation than the others. :param eq: Partial differential equation :param fun: Original function F(x, y, z) :param sep: List of separated functions [X(x), u(y, z)] :param strategy: Separation strategy. You can choose between additive separation ('add') and multiplicative separation ('mul') which is default. Examples ======== >>> from sympy import E, Eq, Function, pde_separate, Derivative as D >>> from sympy.abc import x, t >>> u, X, T = map(Function, 'uXT') >>> eq = Eq(D(u(x, t), x), E**(u(x, t))*D(u(x, t), t)) >>> pde_separate(eq, u(x, t), [X(x), T(t)], strategy='add') [exp(-X(x))*Derivative(X(x), x), exp(T(t))*Derivative(T(t), t)] >>> eq = Eq(D(u(x, t), x, 2), D(u(x, t), t, 2)) >>> pde_separate(eq, u(x, t), [X(x), T(t)], strategy='mul') [Derivative(X(x), (x, 2))/X(x), Derivative(T(t), (t, 2))/T(t)] See Also ======== pde_separate_add, pde_separate_mul FaddTmulzUnknown strategy: %srzValue should be 0zVariable counts do not matchz)Duplicate substitution arguments detectedzArguments do not matchrKN)rtr\r r] pde_separater r^rr[roperatorrrrZrrarzrF _separate)r&funsepstrategydo_add orig_argsr~rn subs_args functionsresultrVsvardvars r9rr sHF5 U /(:;;"h 66Q;266BFF?A 6S(K KBr1IsC:: vv{,--SXXI!4QVV4c44I4 8<<- 8<<-  9~Y'788 DEE 9~Y'122VV[[i ( - - /F   A !I+ B  Q>> from sympy import E, Eq, Function, pde_separate_add, Derivative as D >>> from sympy.abc import x, t >>> u, X, T = map(Function, 'uXT') >>> eq = Eq(D(u(x, t), x), E**(u(x, t))*D(u(x, t), t)) >>> pde_separate_add(eq, u(x, t), [X(x), T(t)]) [exp(-X(x))*Derivative(X(x), x), exp(T(t))*Derivative(T(t), t)] rrrr&rrs r9pde_separate_addra, Cu 55rCc t|||dS)at Helper function for searching multiplicative separable solutions. Consider an equation of two independent variables x, y and a dependent variable w, we look for the product of two functions depending on different arguments: `w(x, y, z) = X(x)*u(y, z)` Examples ======== >>> from sympy import Function, Eq, pde_separate_mul, Derivative as D >>> from sympy.abc import x, y >>> u, X, Y = map(Function, 'uXY') >>> eq = Eq(D(u(x, y), x, 2), D(u(x, y), y, 2)) >>> pde_separate_mul(eq, u(x, y), [X(x), Y(y)]) [Derivative(X(x), (x, 2))/X(x), Derivative(Y(y), (y, 2))/Y(y)] rrrrs r9pde_separate_mulrzrrCct}|jD]|}|jr@|jD]0}|js|j|r |j |2O|js\|j|rl|j |~t}|D]F}|j j|\}}|j|ry|j |Ht|dkDrBt|jDcgc]$}tt|Dcgc]}||z  c}&c}}}t}dx} } |jD]n}|j|s| |z } |j j|\} }|j|ry|j || |j z} pttj |} t| | z j } t| | z j } | j|s| j |ry| | gScc}wcc}}w)zFSeparate expression into two parts based on dependencies of variables.Nr) rar[is_Mul is_Derivativeryrr as_independentrZrrrr) r&depotherstermstermrVdivextrr^r]tempfulldivs r9rrs EE ;;YY ??5155&>IIdO   &(9 IIdO %C;;=//4S 377F    3x!| RWWMT8C#!6Q$q&!678M N %CMC# txx 4KC KKM005 c 377F    t{{} X\\3'G 3w;  & & (C 3w;  & & (Csww3773< :1"7Ms I H=, I =I )Nr*FN)NF)NT)r)7__doc__ functoolsr itertoolsrsympy.simplifyr sympy.corerrsympy.core.functionrr r r sympy.core.relationalr r sympy.core.symbolrrrsympy.functionsrsympy.integrals.integralsrrsympy.utilities.iterablesrrsympy.utilities.miscrsympy.solvers.deutilsrrrsympy.solvers.solversrsympy.simplify.radsimprrrdr:r.r@r,rwrrrrrrrrrLrCr9rs!D3#DD.339;+BB'* DPN-  JDJZZD|GPT`,F~-B . T)n62623rC