Ask Your Question
0

For graphing, associating custom x-values with each Y?

asked 2016-03-12 17:34:02 -0600

Hello, all. This is my first time posting here, as I am new with Sage and have only started learning it this semester for a math class. So far I really love it.

I'm pretty sure this is a very basic question, but please bear with me. I have a set of Y-values in a given sequence that I would like to graph, which would normally not be a problem with "finance.TimeSeries," but I want to associate a custom set of X-values with the Y-values to be used in the graphing, and not x=o up to however far away my last Y-value is. For ex., I have Y's = [1, 2, 4, 6], and would like to graph [(3, 1), (2, 2), (12, 4), (5, 6)], instead of [(0, 1), (1, 2), (2, 4), (3, 6)].

Thanks to any replies in advance.

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2016-03-13 03:31:28 -0600

ndomes gravatar image

If you have two separated lists of values you can zip the lists:

Y = [0,1,2,3]
X = [3,2,12,5]
P = zip(X,Y)
print P
points(P)
edit flag offensive delete link more

Comments

This worked for me, thanks a lot, man! I'm glad someone somewhere decided to make a command for something so simple and routine.

mziedalski gravatar imagemziedalski ( 2016-03-17 18:20:31 -0600 )edit
0

answered 2016-03-12 19:24:51 -0600

What would I do with those points then?

edit flag offensive delete link more
0

answered 2016-03-12 18:12:16 -0600

tmonteil gravatar image

You can try:

sage: points([(3, 1), (2, 2), (12, 4), (5, 6)])
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: 2016-03-12 17:34:02 -0600

Seen: 33 times

Last updated: Mar 13 '16