Matrix to Table [closed]

asked 2019-12-21 19:52:09 +0100

Colin Clout gravatar image

I'm new to Sage, so this is probably a basic question.

I'm trying to use Sage to construct a time series, and turn the output into some form of table or matrix. (I'm trying to do this to learn Sage). The way I want to construct the time series is to use two matrices A1 and A2, and two seed vectors x0 and x1 to calculate xt=A1x(t-1)+A2x(t-2). It's easy to calculate, say x3, x4, x5 by hard coding each vector. And I can write a program that outputs the first k entries in the time series as a series of 1x2 matrices or row vectors. And, of course, I could highlight that output, copy and paste it into wordpad, and then use find and replace to turn it into a csv file.

But that last step is super inelegant. I'd like to be able create a table with the outputs. But the problem is that the outputs are 1xk matrices (or I can easily turn them into 1xk vectors), but the table command takes lists as inputs, and I can't figure out how to turn these 1xk matrices into 1xk lists, or to get the table to take a 1xk matrix as an input. I've tried googling ways to coerce matrices or vectors into lists, but I think my Sage vocabulary isn't developed enough to get the results I need.

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by tmonteil
close date 2019-12-22 16:14:59.253238