Ask Your Question
1

How to define y=constant function to plot

asked 2020-11-24 00:33:15 +0200

froli78 gravatar image

Hi!

I'm newbe with SageMath and i would like to make an y=constant function to plot but i don't find a way to do it.

I can do x=constant functions plot easily:

c=1 plot(c, (x,-2,2))

But how can I do y=constant if it is possible!?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-11-24 02:35:26 +0200

Emmanuel Charpentier gravatar image

plot(lambda u:1, (-2, 2)) plots an horizontal line where y is constant (i. e. $y=1$).

Do you want a vertical line, where the same value of x of x corresponds to (infinitely) many values of y ? This by definition cannot be the representation of a function of x.

You can use a parametric representation of such a vertical line ; for example, parametric_plot([1,lambda u:u],(0,2)) will plot the vertical segment from (1,0) to (1,2).

You can also directly use the primitive line : line([(1,0),(1,2)]) will get the same result as before.

There are probably other ways, whose search is left to you as an exercise...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-11-24 00:33:15 +0200

Seen: 56 times

Last updated: Nov 24 '20