# Curves¶

class diofant.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.

functions
parameter
limits
Raises

ValueError – When $$functions$$ are specified incorrectly. When $$limits$$ are specified incorrectly.

Examples

>>> 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)

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 diofant.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)

property free_symbols

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

Examples

>>> Curve((t, t**2), (t, 0, 2)).free_symbols
set()
>>> Curve((t, t**2), (t, a, 2)).free_symbols
{a}

property functions

The functions specifying the curve.

Returns

functions (list of parameterized coordinate functions.)

Examples

>>> C = Curve((t, t**2), (t, 0, 2))
>>> C.functions
(t, t**2)

property limits

The limits for the curve.

Returns

limits (tuple) – Contains parameter and lower and upper limits.

Examples

>>> C = Curve([t, t**3], (t, -2, 2))
>>> C.limits
(t, -2, 2)

property parameter

The curve function variable.

Returns

parameter (Diofant symbol)

Examples

>>> 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]

limits()

Returns limits of the parameter interval

Examples

>>> from diofant.abc import 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

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

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

>>> Curve((x, x), (x, 0, 1)).translate(1, 2)
Curve((x + 1, x + 2), (x, 0, 1))