K i'dZddlmZddlmZddlmZddlmZddl m Z m Z ddl m Z ddlmZdd lmZmZdd lmZdd lmZGd d e Zy)zCCurves in 2-dimensional Euclidean space. Contains ======== Curve )sqrt)diff)Tuple)_symbol)GeometryEntity GeometrySet)Point) integrate)Matrix rot_axis3) is_sequence) prec_to_dpsceZdZdZdZdZdZddZddZe dZ e dZ e d Z e d Z e d Ze d Zdd ZddZddZddZy)Curvea,A curve in space. A curve is defined by parametric functions for the coordinates, a parameter and the lower and upper bounds for the parameter value. Parameters ========== function : list of functions limits : 3-tuple Function parameter and lower and upper bounds. Attributes ========== functions parameter limits Raises ====== ValueError When `functions` are specified incorrectly. When `limits` are specified incorrectly. Examples ======== >>> from sympy import Curve, sin, cos, interpolate >>> from sympy.abc import t, a >>> C = Curve((sin(t), cos(t)), (t, 0, 2)) >>> C.functions (sin(t), cos(t)) >>> C.limits (t, 0, 2) >>> C.parameter t >>> C = Curve((t, interpolate([1, 4, 9, 16], t)), (t, 0, 1)); C Curve((t, t**2), (t, 0, 1)) >>> C.subs(t, 4) Point2D(4, 16) >>> C.arbitrary_point(a) Point2D(a, a**2) See Also ======== sympy.core.function.Function sympy.polys.polyfuncs.interpolate ct|rt|dk7rtdt|zt|rt|dk7rtdt|zt j |t |t |S)Nz3Function argument should be (x(t), y(t)) but got %sz3Limit argument should be (t, tmin, tmax) but got %s)r len ValueErrorstrr__new__r)clsfunctionlimitss Z/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/geometry/curve.pyrz Curve.__new__Ls8$H (:"8}-. .6"c&kQ&6"6{+, ,%%c5(+;UF^LLc:|j|j|SN)subs parameter)selffs r__call__zCurve.__call__Vsyy++rc ||jk(r0t|jDcgc]}|j||c}Sycc}wr)r r functionsr)r!oldnewr"s r _eval_subszCurve._eval_subsYs; $.. T^^D166#s+DE E !DsAc |j\}\}}}t|}t|Dcgc]}|jdd|i|c}}||fDcgc]}|jdd|i|c}\}}|j ||||fScc}wcc}w)Nn)argsrtupleevalffunc) r!precoptionsr"tabdpsis r _eval_evalfzCurve._eval_evalf]syy 9Aq!$ a87177,S,G,8 945q6:a)#)):1yyQ1I&&9:s BB c ||t|jSt||jd}|j}|j|jk7r7|jd|j Dvrt d|jzt|jDcgc]}|j||c}Scc}w)aA parameterized point on the curve. Parameters ========== parameter : str or Symbol, optional Default value is 't'. The Curve's parameter is selected with None or self.parameter otherwise the provided symbol is used. Returns ======= Point : Returns a point in parametric form. Raises ====== ValueError When `parameter` already appears in the functions. Examples ======== >>> from sympy import Curve, Symbol >>> from sympy.abc import s >>> C = Curve([2*s, s**2], (s, 0, 2)) >>> C.arbitrary_point() Point2D(2*t, t**2) >>> C.arbitrary_point(C.parameter) Point2D(2*s, s**2) >>> C.arbitrary_point(None) Point2D(2*s, s**2) >>> C.arbitrary_point(Symbol('a')) Point2D(2*a, a**2) See Also ======== sympy.geometry.point.Point Trealc34K|]}|jywr)name).0r"s r z(Curve.arbitrary_point..s@aff@szFSymbol %s already appears in object and cannot be used as a parameter.)r r%rr r< free_symbolsrr)r!r tnewr2ws rarbitrary_pointzCurve.arbitrary_pointdsX  $..) )y$..t< NN II  @d.?.?@@57;yyAB B?1qvva?@@?sB9ct}|j|jddzD]}||jz}|j |j h}|S)aReturn a set of symbols other than the bound symbols used to parametrically define the Curve. Returns ======= set : Set of all non-parameterized symbols. Examples ======== >>> from sympy.abc import t, a >>> from sympy import Curve >>> Curve((t, t**2), (t, 0, 2)).free_symbols set() >>> Curve((t, t**2), (t, a, 2)).free_symbols {a} N)setr%rr? differencer )r!freer3s rr?zCurve.free_symbolssU,u$++ab/1 #A ANN "D #/0 rc2t|jdS)a;The dimension of the curve. Returns ======= int : the dimension of curve. Examples ======== >>> from sympy.abc import t >>> from sympy import Curve >>> C = Curve((t, t**2), (t, 0, 2)) >>> C.ambient_dimension 2 r)rr,r!s rambient_dimensionzCurve.ambient_dimensions*499Q<  rc |jdS)aThe functions specifying the curve. Returns ======= functions : list of parameterized coordinate functions. Examples ======== >>> from sympy.abc import t >>> from sympy import Curve >>> C = Curve((t, t**2), (t, 0, 2)) >>> C.functions (t, t**2) See Also ======== parameter rr,rIs rr%zCurve.functions2yy|rc |jdS)aThe limits for the curve. Returns ======= limits : tuple Contains parameter and lower and upper limits. Examples ======== >>> from sympy.abc import t >>> from sympy import Curve >>> C = Curve([t, t**3], (t, -2, 2)) >>> C.limits (t, -2, 2) See Also ======== plot_interval rDrLrIs rrz Curve.limitsrMrc&|jddS)amThe curve function variable. Returns ======= Symbol : returns a bound symbol. Examples ======== >>> from sympy.abc import t >>> from sympy import Curve >>> C = Curve([t, t**2], (t, 0, 2)) >>> C.parameter t See Also ======== functions rDrrLrIs rr zCurve.parameters2yy|Arc~ttfdjD}t|jS)zThe curve length. Examples ======== >>> from sympy import Curve >>> from sympy.abc import t >>> Curve((t, t), (t, 0, 1)).length sqrt(2) c3VK|] }t|jddz"yw)rrN)rr)r=r/r!s rr>zCurve.length..,s%VtT$ A7:Vs&))rsumr%r r)r! integrands` rlengthz Curve.lengths/Vt~~VVW DKK00rcjt||jd}|gt|jddzS)aThe plot interval for the default geometric plot of the curve. Parameters ========== parameter : str or Symbol, optional Default value is 't'; otherwise the provided symbol is used. Returns ======= List : the plot interval as below: [parameter, lower_bound, upper_bound] Examples ======== >>> from sympy import Curve, sin >>> from sympy.abc import x, s >>> Curve((x, sin(x)), (x, 1, 2)).plot_interval() [t, 1, 2] >>> Curve((x, sin(x)), (x, 1, 2)).plot_interval(s) [s, 1, 2] See Also ======== limits : Returns limits of the parameter interval Tr9rDN)rr listr)r!r r2s r plot_intervalzCurve.plot_interval/s3B It~~D 9sT$++ab/***rNc|rt|d }n tdd}|j|j}t|j}|j dt dd|}|t|z}|j|dddfjd|j}| }|j|jS)aThis function is used to rotate a curve along given point ``pt`` at given angle(in radian). Parameters ========== angle : the angle at which the curve will be rotated(in radian) in counterclockwise direction. default value of angle is 0. pt : Point the point along which the curve will be rotated. If no point given, the curve will be rotated around origin. Returns ======= Curve : returns a curve rotated at given angle along given point. Examples ======== >>> from sympy import Curve, pi >>> from sympy.abc import x >>> Curve((x, x), (x, 0, 1)).rotate(pi/2) Curve((-x, x), (x, 0, 1)) rdimrrDrN) r translater,rVr%appendr r r/tolistr)r!angleptrvr"s rrotatez Curve.rotateSs: ""BqB T^^RWW %    1aO Yu  YYqBQBx(+T[[ 9Sr||RWW%%rc|rNt|d}|j| jj||j|jS|j\}}|j ||z||zf|j S)a^Override GeometryEntity.scale since Curve is not made up of Points. Returns ======= Curve : returns scaled curve. Examples ======== >>> from sympy import Curve >>> from sympy.abc import x >>> Curve((x, x), (x, 0, 1)).scale(2) Curve((2*x, x), (x, 0, 1)) rrY)r r[r,scaler%r/r)r!xyr_fxfys rrcz Curve.scale}sv$ rq!BD>4>>RC::.44Q:DDbggN NByy"Q$1t{{33rch|j\}}|j||z||zf|jS)aLTranslate the Curve by (x, y). Returns ======= Curve : returns a translated curve. Examples ======== >>> from sympy import Curve >>> from sympy.abc import x >>> Curve((x, x), (x, 0, 1)).translate(1, 2) Curve((x + 1, x + 2), (x, 0, 1)) )r%r/r)r!rdrerfrgs rr[zCurve.translates3$Byy"q&"q&)4;;77r))r2)rN)rDrDN)rr)__name__ __module__ __qualname____doc__rr#r(r7rBpropertyr?rJr%rr rTrWrarcr[r+rrrrs3jM,F'5An6!!,444 1 1"+H(&T408rrN)rm(sympy.functions.elementary.miscellaneousr sympy.corersympy.core.containersrsympy.core.symbolrsympy.geometry.entityrrsympy.geometry.pointr sympy.integralsr sympy.matricesr r sympy.utilities.iterablesr mpmath.libmp.libmpfrrr+rrrys8:'%=&%,1+R8KR8r