Plotting equation of two perpendicular lines

30 views
Skip to first unread message

omid habibi

unread,
Apr 16, 2014, 3:29:17 AM4/16/14
to sage-s...@googlegroups.com
Suppose we have two equations
p1 = 3x+ 1
p2 = -1/3x + 3

As you may know because of slopes, these two lines must be perpendicular.
It's true when I plot it on paper but when I do it in SageMath I get this:

sage: p1 = plot( 3*x + 1, -10, 10)
sage: p2 = plot( -1/3*x + 3, -10, 10)
sage: show ( p1 + p2 )



John Cremona

unread,
Apr 16, 2014, 5:10:04 AM4/16/14
to SAGE support
For both graphs you have set the x-range to -10..10 but the y-ranges are different, and the graph has been scaled so that (as you can see from the axes) the aspect ratio is not 1:1.

Try specifying equal y-ranges as well as equal x-ranges.

John Cremona


--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

omid habibi

unread,
Apr 16, 2014, 5:35:11 AM4/16/14
to sage-s...@googlegroups.com
Thanks for reply, Can you tell me how should I change the ratio?

John Cremona

unread,
Apr 16, 2014, 5:46:17 AM4/16/14
to SAGE support
On 16 April 2014 10:35, omid habibi <omi...@gmail.com> wrote:
Thanks for reply, Can you tell me how should I change the ratio?


I expect that plot? will tell you -- as I don't know without looking myself, I wil let you look!

Michael Orlitzky

unread,
Apr 16, 2014, 3:08:31 PM4/16/14
to sage-s...@googlegroups.com
On 04/16/2014 05:35 AM, omid habibi wrote:
> Thanks for reply, Can you tell me how should I change the ratio?
>
> On Wednesday, April 16, 2014 1:40:04 PM UTC+4:30, John Cremona wrote:
>
> For both graphs you have set the x-range to -10..10 but the y-ranges
> are different, and the graph has been scaled so that (as you can see
> from the axes) the aspect ratio is not 1:1.
>
> Try specifying equal y-ranges as well as equal x-ranges.
>

(p1 + p2).show(aspect_ratio=1) should work also if you don't want to
worry about the x/y ranges.


Reply all
Reply to author
Forward
0 new messages