plot a vertical line

836 views
Skip to first unread message

Rose

unread,
May 10, 2008, 10:44:28 PM5/10/08
to sage-support
Hi,

I am sorry for my english.
I want to plot a vertical line. I can draw a horisontal line by doing
f1=lambda x:1.
But when I do f1=lambda y:1 it do the same thing, and when I try with
Infinity(like if a do a circle in \mathbb(C), who past by (1,0) and
(1,infinity), I got some error.

Thanks,

Rose

William Stein

unread,
May 10, 2008, 10:47:58 PM5/10/08
to sage-s...@googlegroups.com

Here is an example of drawing a vertical line:

sage: line([(1/2,-2), (1/2,2)])

Jason Grout

unread,
May 10, 2008, 10:49:20 PM5/10/08
to sage-s...@googlegroups.com


Try doing a parametric plot:

var('t')
parametric_plot( (3,t), -10,10)

(that is off the top of my head, I haven't checked it to make sure it
works...)

Thanks,

Jason

Rose

unread,
May 10, 2008, 11:13:22 PM5/10/08
to sage-support


On 10 mai, 22:47, "William Stein" <wst...@gmail.com> wrote:

> Here is an example of drawing a vertical line:
>
> sage: line([(1/2,-2), (1/2,2)])

Wow that answer was fast,

Well if there a way to name it without drawing it (because I need to
put it in an if and I don't want it to by show anytime, like it does
with line (I don't know why line is drawing it, and I do not fine this
function in the documentation)).

Thanks for answering, even if I don't write well in english.

Rose

unread,
May 10, 2008, 11:20:52 PM5/10/08
to sage-support


> Try doing a parametric plot:
>
> var('t')
> parametric_plot( (3,t), -10,10)
>

Heeeee, I don't even understand what is a parametric plot (and what I
found in SAGE literature is to complex for me). Can you please
explain.

Thanks.

Rose

William Stein

unread,
May 10, 2008, 11:21:25 PM5/10/08
to sage-s...@googlegroups.com
On Sat, May 10, 2008 at 8:13 PM, Rose <pinkwo...@gmail.com> wrote:
>
>
>
> On 10 mai, 22:47, "William Stein" <wst...@gmail.com> wrote:
>
>> Here is an example of drawing a vertical line:
>>
>> sage: line([(1/2,-2), (1/2,2)])
>
> Wow that answer was fast,
>
> Well if there a way to name it without drawing it (because I need to
> put it in an if and I don't want it to by show anytime, like it does
> with line (I don't know why line is drawing it, and I do not fine this
> function in the documentation)).

1. Type line? for docs on line.
2. An example of "naming it", and showing only in an if:

L = line([(1/2,-2), (1/2,2)])
if 1 == 1:
L.show()

> Thanks for answering, even if I don't write well in english.
> >
>

--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Rose

unread,
May 10, 2008, 11:28:13 PM5/10/08
to sage-support


Rose a écrit :
> On 10 mai, 22:47, "William Stein" <wst...@gmail.com> wrote:
>
> > Here is an example of drawing a vertical line:
> >
> > sage: line([(1/2,-2), (1/2,2)])
>
> Wow that answer was fast,
>
> Well if there a way to name it without drawing it (because I need to
> put it in an if

Oh well my problem is not because it is in a if, I can not do a ==
Infinity, I don't understand why!

Jason Grout

unread,
May 10, 2008, 11:33:32 PM5/10/08
to sage-s...@googlegroups.com


Could you post the code that you have and explain what you are trying to
do with it?

Thanks,

Jason

Jason Grout

unread,
May 10, 2008, 11:35:42 PM5/10/08
to sage-s...@googlegroups.com

You can look it up in an algebra book or calculus book for more details,
but basically, the command above is saying to plot the points (3, t) for
any t between -10 and 10. In other words, plot points with x-coordinate
3 and y-coordinate "t", where t goes between -10 and 10.

That said, William's suggestion of using the line command might be easier.

Jason

Rose

unread,
May 11, 2008, 12:27:56 AM5/11/08
to sage-support


On 10 mai, 23:33, Jason Grout <jason-s...@creativetrax.com> wrote:
> Could you post the code that you have and explain what you are trying to
> do with it?

Ohlala nothing works tonight, I am going to post it tomorow,
I hope you will help me then.

Thanks in advance.

Rose

Rose

unread,
May 11, 2008, 9:29:55 AM5/11/08
to sage-support


On 10 mai, 23:33, Jason Grout <jason-s...@creativetrax.com> wrote:

> Could you post the code that you have and explain what you are trying to
> do with it?

Well I did it this morning. This is what I was triing to do:

sage: def creer_droite_h(a,b):
....: if a>b:
....: return creer_droite_h(b,a)
....: if b==Infinity:
....: y=line([(a,-2), (a,2)])
....: return plot(y,a-2,a+2)
....: centre=(a+b)/2
....: rayon=b-centre
....: y = lambda x:sqrt(rayon^2-(x-centre)^2)
....: return plot(y,a,b)
....:

Thanks for the help!

John Cremona

unread,
May 11, 2008, 12:15:42 PM5/11/08
to sage-s...@googlegroups.com
Rose,

S'il est necessaire, il y a des gens qui lit sage-support qui
comprennent le francais et qui peuvent peut-etre explique des choses
en francais (sans accents)!

John

2008/5/11 Rose <pinkwo...@gmail.com>:

Rose

unread,
May 11, 2008, 5:09:21 PM5/11/08
to sage-support


On 11 mai, 12:15, "John Cremona" <john.crem...@gmail.com> wrote:
> Rose,
>
> S'il est necessaire, il y a des gens qui lit sage-support qui
> comprennent le francais et qui peuvent peut-etre explique des choses
> en francais (sans accents)!
>

Merci pour l'information.
Reply all
Reply to author
Forward
0 new messages