Curves

class sympy.geometry.curve.Curve[source]

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.

Raises:

ValueError

When \(functions\) are specified incorrectly. When \(limits\) are specified incorrectly.

Examples

>>> from sympy import sin, cos, Symbol, interpolate
>>> from sympy.abc import t, a
>>> from sympy.geometry import Curve
>>> 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)

Attributes

functions  
parameter  
limits  
arbitrary_point(parameter='t')[source]

A 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:

arbitrary_point : Point

Raises:

ValueError

When \(parameter\) already appears in the functions.

Examples

>>> from sympy import Symbol
>>> from sympy.abc import s
>>> from sympy.geometry import Curve
>>> 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)
free_symbols

Return a set of symbols other than the bound symbols used to parametrically define the Curve.

Examples

>>> from sympy.abc import t, a
>>> from sympy.geometry import Curve
>>> Curve((t, t**2), (t, 0, 2)).free_symbols
set()
>>> Curve((t, t**2), (t, a, 2)).free_symbols
set([a])
functions

The functions specifying the curve.

Returns:functions : list of parameterized coordinate functions.

See also

parameter

Examples

>>> from sympy.abc import t
>>> from sympy.geometry import Curve
>>> C = Curve((t, t**2), (t, 0, 2))
>>> C.functions
(t, t**2)
limits

The limits for the curve.

Returns:

limits : tuple

Contains parameter and lower and upper limits.

See also

plot_interval

Examples

>>> from sympy.abc import t
>>> from sympy.geometry import Curve
>>> C = Curve([t, t**3], (t, -2, 2))
>>> C.limits
(t, -2, 2)
parameter

The curve function variable.

Returns:parameter : SymPy symbol

See also

functions

Examples

>>> from sympy.abc import t
>>> from sympy.geometry import Curve
>>> C = Curve([t, t**2], (t, 0, 2))
>>> C.parameter
t
plot_interval(parameter='t')[source]

The 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:

plot_interval : list (plot interval)

[parameter, lower_bound, upper_bound]

See also

limits
Returns limits of the parameter interval

Examples

>>> from sympy import Curve, sin
>>> from sympy.abc import x, t, 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]
rotate(angle=0, pt=None)[source]

Rotate angle radians counterclockwise about Point pt.

The default pt is the origin, Point(0, 0).

Examples

>>> from sympy.geometry.curve import Curve
>>> from sympy.abc import x
>>> from sympy import pi
>>> Curve((x, x), (x, 0, 1)).rotate(pi/2)
Curve((-x, x), (x, 0, 1))
scale(x=1, y=1, pt=None)[source]

Override GeometryEntity.scale since Curve is not made up of Points.

Examples

>>> from sympy.geometry.curve import Curve
>>> from sympy import pi
>>> from sympy.abc import x
>>> Curve((x, x), (x, 0, 1)).scale(2)
Curve((2*x, x), (x, 0, 1))
translate(x=0, y=0)[source]

Translate the Curve by (x, y).

Examples

>>> from sympy.geometry.curve import Curve
>>> from sympy import pi
>>> from sympy.abc import x
>>> Curve((x, x), (x, 0, 1)).translate(1, 2)
Curve((x + 1, x + 2), (x, 0, 1))