K i,ddlmZddlmZddlmZddlmZddlm Z m Z ddl m Z ddl mZddlmZmZmZmZmZdd lmZGd d e Zed Zej3ed Zej3edZej3eddZej3eddZej3eddZej3eddZy))singledispatch)pi)tan)trigsimp)BasicTuple)_symbol)solve)PointSegmentCurveEllipsePolygon)ImplicitRegioncbeZdZdZfdZedZedZedZedZ xZ S)ParametricRegiona Represents a parametric region in space. Examples ======== >>> from sympy import cos, sin, pi >>> from sympy.abc import r, theta, t, a, b, x, y >>> from sympy.vector import ParametricRegion >>> ParametricRegion((t, t**2), (t, -1, 2)) ParametricRegion((t, t**2), (t, -1, 2)) >>> ParametricRegion((x, y), (x, 3, 4), (y, 5, 6)) ParametricRegion((x, y), (x, 3, 4), (y, 5, 6)) >>> ParametricRegion((r*cos(theta), r*sin(theta)), (r, -2, 2), (theta, 0, pi)) ParametricRegion((r*cos(theta), r*sin(theta)), (r, -2, 2), (theta, 0, pi)) >>> ParametricRegion((a*cos(t), b*sin(t)), t) ParametricRegion((a*cos(t), b*sin(t)), t) >>> circle = ParametricRegion((r*cos(theta), r*sin(theta)), r, (theta, 0, pi)) >>> circle.parameters (r, theta) >>> circle.definition (r*cos(theta), r*sin(theta)) >>> circle.limits {theta: (0, pi)} Dimension of a parametric region determines whether a region is a curve, surface or volume region. It does not represent its dimensions in space. >>> circle.dimensions 1 Parameters ========== definition : tuple to define base scalars in terms of parameters. bounds : Parameter or a tuple of length 3 to define parameter and corresponding lower and upper bound. chd}i}t|tst|}|D]Q}t|ttfr3t|dk7r t d||dfz }|d|df||d<L||fz }St|ttfs|f}t ||t|g|}||_||_|S)Nz?Tuple should be in the form (parameter, lowerbound, upperbound)r) isinstancertuplelen ValueErrorsuper__new__ _parameters_limits)cls definitionbounds parameterslimitsboundobj __class__s c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/vector/parametricregion.pyrzParametricRegion.__new__6s &%(F^F 'E%%0u:?$%fgguQxk) $)!HeAh#7uQx uh&  '*uen5$Jgoc5*#5??$  c |jdSNr)argsselfs r(r!zParametricRegion.definitionOsyy|r)c|jSN)rr-s r(r$zParametricRegion.limitsSs ||r)c|jSr0)rr-s r(r#zParametricRegion.parametersWsr)c,t|jSr0)rr$r-s r( dimensionszParametricRegion.dimensions[s4;;r)) __name__ __module__ __qualname____doc__rpropertyr!r$r#r3 __classcell__)r's@r(rr s^(R2    r)rctd)aN Returns a list of ParametricRegion objects representing the geometric region. Examples ======== >>> from sympy.abc import t >>> from sympy.vector import parametric_region_list >>> from sympy.geometry import Point, Curve, Ellipse, Segment, Polygon >>> p = Point(2, 5) >>> parametric_region_list(p) [ParametricRegion((2, 5))] >>> c = Curve((t**3, 4*t), (t, -3, 4)) >>> parametric_region_list(c) [ParametricRegion((t**3, 4*t), (t, -3, 4))] >>> e = Ellipse(Point(1, 3), 2, 3) >>> parametric_region_list(e) [ParametricRegion((2*cos(t) + 1, 3*sin(t) + 3), (t, 0, 2*pi))] >>> s = Segment(Point(1, 3), Point(2, 6)) >>> parametric_region_list(s) [ParametricRegion((t + 1, 3*t + 3), (t, 0, 1))] >>> p1, p2, p3, p4 = [(0, 1), (2, -3), (5, 3), (-2, 3)] >>> poly = Polygon(p1, p2, p3, p4) >>> parametric_region_list(poly) [ParametricRegion((2*t, 1 - 4*t), (t, 0, 1)), ParametricRegion((3*t + 2, 6*t - 3), (t, 0, 1)), ParametricRegion((5 - 7*t, 3), (t, 0, 1)), ParametricRegion((2*t - 2, 3 - 2*t), (t, 0, 1))] z?SymPy cannot determine parametric representation of the region.)r)regs r(parametric_region_listr<`sF V WWr)c.t|jgSr0)rr,)r&s r(_r>s SXX & ''r)c~|j|jj}|j}t ||gSr0)arbitrary_point parameterr,r$r)r&r!r"s r(r>r>s5$$S]]388J ZZF Z 0 11r)c|j|j}t|d}|ddtzf}t ||gS)NTrealrr)r@r,r rr)r&rAr!tr"s r(r>r>sC$$Y/44J %AAbD\F Z 0 11r)ct|d}|j|j}tddD]}t |||j dj|z |}t |||j dj|z |}t |dk(sjt |dk(sy||d|df}n|j|j}t|gS)NTrCrrr)r r@r,ranger pointsrr) r&rArEr!i lower_bound upper_boundr"definition_tuples r(r>r>s %A$$Q',,J 1a[JqMCJJqM,>,>q,AA1E JqMCJJqM,>,>q,AA1E { q S%5%: A A6F  **95:: -v 6 77r)c\|jDcgc]}t||d}}|Scc}wr+)sidesr<)r&rAsidels r(r>r>s1@C J i 0 3JAJ H Ks)c f|j|}g}tt|jdz D]a}t ||d}|Dcgc])}t |j |t|dz +}}|j|ddtzfct|}t|g|gScc}w)NrTrCrr) rational_parametrizationrGr variablesr rsubsrappendrrr)r&r#r!r"rIrAelems r(r>r>s--j9J F 3s}}%) *-JqM5 S]^4htyyC ! 4DEF^ ^ y!QrT*, -  #J Z 1& 1 22 _s .B.N)rE))rEs) functoolsrsympy.core.numbersr(sympy.functions.elementary.trigonometricrsympy.simplifyr sympy.corerrsympy.core.symbolr sympy.solversr sympy.geometryr r r rr sympy.vectorrrr<registerr>rr)r(rbs$!8##%BB'Q uQ h"X"XJ  '(((  '2(2   )2*2  ) 8* 8   ) *   0 31 3r)