plot_implicit behavior

41 views
Skip to first unread message

Amit Saha

unread,
Mar 30, 2014, 5:09:58 AM3/30/14
to sy...@googlegroups.com
Hello,

Consider the following program:

"""
Draw a line given two points it passes through
"""

from sympy import Point, Line, plot_implicit

def draw_line(x1, y1, x2, y2):

p1 = Point(x1, y1)
p2 = Point(x2, y2)
l = Line(p1, p2)
eqn = l.equation()
print(eqn)
plot_implicit(eqn)

if __name__=='__main__':
x1, y1 = -1, 0
x2, y2 = 2, 3
draw_line(x1, y1, x2, y2)

Basically, I am creating a line object passing through (-1,0) and
(2,3). When I use plot_implicit() to draw the this line, it randomly
draws a line passing through (0, -1) and (3,2) instead about 40% of
the times.

What could be happening here?

Thanks for any hints.

Best,
Amit.

Amit Saha

unread,
Apr 14, 2014, 6:32:35 AM4/14/14
to sy...@googlegroups.com
Can someone please try this and see if this is indeed the case or I am
seeing something really weird?

Thanks!
-Amit.



--
http://echorand.me

Aaron Meurer

unread,
Apr 14, 2014, 12:43:36 PM4/14/14
to sy...@googlegroups.com
I can reproduce it. It's definitely a bug. I'm guessing plot_implicit doesn't have a well-defined way of choosing which variable is x and which variable is y.

Aaron Meurer



--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CANODV3mMjeJdJWJMF_j2vH%2BLfV9Xo-%2BsFQfMTp7T%3DbtuOuS_-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Amit Saha

unread,
Apr 19, 2014, 7:11:26 PM4/19/14
to sy...@googlegroups.com
On Tue, Apr 15, 2014 at 2:43 AM, Aaron Meurer <asme...@gmail.com> wrote:
> I can reproduce it. It's definitely a bug. I'm guessing plot_implicit
> doesn't have a well-defined way of choosing which variable is x and which
> variable is y.

That indeed is the case. I thought of a fairly straightforward method:
https://github.com/sympy/sympy/pull/7419

I am keen to work towards fixing this, so comments appreciated.

Best,
Amit.
Reply all
Reply to author
Forward
0 new messages