I merged this patch with yours:

diff --git a/sympy/geometry/curve.py b/sympy/geometry/curve.py
index 18dc583..c1cd010 100644
--- a/sympy/geometry/curve.py
+++ b/sympy/geometry/curve.py
@@ -8,6 +8,8 @@ class Curve(GeometryEntity):

     Example:
     ========
+        >>> from sympy import sin, cos, Symbol
+        >>> t = Symbol("t")
         >>> C = Curve([sin(t), cos(t)], (t, 0, 2))
         >>> C.functions
         [sin(t), cos(t)]


so that doctests pass and pushed it in. Thanks!

Ondrej

On Thu, Nov 27, 2008 at 10:03 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
> +1 from me
>
> On Thu, Nov 27, 2008 at 9:57 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
>> From: Priit Laes <[EMAIL PROTECTED]>
>>
>> ---
>>  sympy/geometry/__init__.py            |    3 +-
>>  sympy/geometry/curve.py               |   41 
>> +++++++++++++++++++++++++++++++++
>>  sympy/geometry/entity.py              |    3 +-
>>  sympy/geometry/tests/test_geometry.py |   11 ++++++++-
>>  4 files changed, 55 insertions(+), 3 deletions(-)
>>  create mode 100644 sympy/geometry/curve.py
>>
>> diff --git a/sympy/geometry/__init__.py b/sympy/geometry/__init__.py
>> index ed5f99e..90a0abe 100644
>> --- a/sympy/geometry/__init__.py
>> +++ b/sympy/geometry/__init__.py
>> @@ -21,4 +21,5 @@ from sympy.geometry.line import Line, Ray, Segment
>>  from sympy.geometry.ellipse import Ellipse, Circle
>>  from sympy.geometry.polygon import Polygon, RegularPolygon, Triangle
>>  from sympy.geometry.util import *
>> -from sympy.geometry.exceptions import *
>> \ No newline at end of file
>> +from sympy.geometry.exceptions import *
>> +from sympy.geometry.curve import Curve
>> diff --git a/sympy/geometry/curve.py b/sympy/geometry/curve.py
>> new file mode 100644
>> index 0000000..18dc583
>> --- /dev/null
>> +++ b/sympy/geometry/curve.py
>> @@ -0,0 +1,41 @@
>> +from sympy.core import sympify
>> +from sympy.geometry.exceptions import GeometryError
>> +from entity import GeometryEntity
>> +
>> +class Curve(GeometryEntity):
>> +    """
>> +    A curve in space.
>> +
>> +    Example:
>> +    ========
>> +        >>> C = Curve([sin(t), cos(t)], (t, 0, 2))
>> +        >>> C.functions
>> +        [sin(t), cos(t)]
>> +        >>> C.limits
>> +        (t, 0, 2)
>> +        >>> C.parameter
>> +        t
>> +    """
>> +
>> +    def __new__(cls, function, limits):
>> +        fun = sympify(function)
>> +        if not fun:
>> +            raise GeometryError("%s.__new__ don't know how to handle" % 
>> cls.__name__);
>> +        if not isinstance(limits, (list, tuple)) or len(limits) != 3:
>> +            raise ValueError("Limits argument has wrong syntax");
>> +        return GeometryEntity.__new__(cls, fun, limits)
>> +
>> +    @property
>> +    def functions(self):
>> +        """The functions specifying the curve."""
>> +        return self.__getitem__(0)
>> +
>> +    @property
>> +    def parameter(self):
>> +        """The curve function variable."""
>> +        return self.__getitem__(1)[0]
>> +
>> +    @property
>> +    def limits(self):
>> +        """The limits for the curve."""
>> +        return self.__getitem__(1)
>> diff --git a/sympy/geometry/entity.py b/sympy/geometry/entity.py
>> index c0dec62..129641f 100644
>> --- a/sympy/geometry/entity.py
>> +++ b/sympy/geometry/entity.py
>> @@ -9,7 +9,8 @@ ordering_of_classes = [
>>     "RegularPolygon",
>>     "Polygon",
>>     "Circle",
>> -    "Ellipse"
>> +    "Ellipse",
>> +    "Curve"
>>  ]
>>
>>  class GeometryEntity(tuple):
>> diff --git a/sympy/geometry/tests/test_geometry.py 
>> b/sympy/geometry/tests/test_geometry.py
>> index cfaefd0..7329bdc 100644
>> --- a/sympy/geometry/tests/test_geometry.py
>> +++ b/sympy/geometry/tests/test_geometry.py
>> @@ -1,7 +1,7 @@
>>  from sympy import Symbol, Rational, sqrt, pi, cos, oo, simplify, Real, 
>> raises
>>  from sympy.geometry import Point, Polygon, convex_hull, Segment, \
>>         RegularPolygon, Circle, Ellipse, GeometryError, Line, intersection, \
>> -        Ray, Triangle, are_similar
>> +        Ray, Triangle, are_similar, Curve
>>
>>  x = Symbol('x', real=True)
>>  y = Symbol('y', real=True)
>> @@ -16,6 +16,15 @@ def feq(a, b):
>>     t = Real("1.0E-10")
>>     return -t < a-b < t
>>
>> +def test_curve():
>> +    t = Symbol('t')
>> +    z = Symbol('z')
>> +    C = Curve([2*t, t**2], (z, 0, 2))
>> +
>> +    assert C.parameter == z
>> +    assert C.functions == [2*t, t**2]
>> +
>> +
>>  def test_point():
>>     p1 = Point(x1, x2)
>>     p2 = Point(y1, y2)
>> --
>> 1.6.0.4
>>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-patches" group.
To post to this group, send email to sympy-patches@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sympy-patches?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to