Bonjour,

This week, I was drawing plot vector field using two ways : (1)
plot_vector_field and (2) by simply suming up plenty of arrows as I wished.
Since their was a fixed point somewhere, I came up with the problem of
drawing a zero length arrow. Using sage 3.1.4, I get a zero division error.
Where is this division from? The example below show that it is not from the
slope as it can draw a vertical arrow.

sage: arrow((1, 1), (2, 1))
sage: arrow((1, 1), (1, 2))
sage: arrow((1, 1), (1, 1))
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
:
...
/home/slabbe/sage/local/lib/python2.5/site-packages/matplotlib/arrow_line.pyc
in draw(self, renderer)
    100         pixel_vector = (orig_t.transform_point(points[1]) -
orig_t.transform_point(points[0]))
    101         pixel_length=math.sqrt(sum(pixel_vector**2))
--> 102         clip_fraction =
renderer.points_to_pixels(self._arrowshorten)/pixel_length
    103         head_clip_fraction =
renderer.points_to_pixels(self._arrowshorten+self._arrowheadlength*0.8)/pixel_length
    104

ZeroDivisionError: float division

In my problem, I would have been happy if arrow(x,x) would draw simply a
point. I know I can define my own arrow but maybe sage's arrow could behave
like myarrow ?

def myarrow(x,y):
    if x=y:
        return point(x,y)
    else:
        return arrow(x,y)

Merci,

Sébastien, UQAM

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to