Ask Your Question
0

Can LibreOffice calc convert data to Sage vectors? [closed]

asked 2013-08-09 17:28:37 +0200

Jaakko Seppälä gravatar image

updated 2013-08-09 21:53:25 +0200

I have a CSV data file of the following format:

pcb138  pcb180  pcb52   pcb118  pcb
1.46    0.738   0.532   0.72    19.9959
0.64    0.664   0.03    0.236   6.0996
3.29    1.15    0.134   1.54    24.9655
3.94    1.33    0.466   1.94    37.4436
3.18    2.14    0.243   1.47    30.183

I would like to do statistical computation on Sage with these values. Can I use LibreOffice to convert that data to Sage's syntax? The syntax the Sage uses is like this:

pcb138=vector([1.46,0.64,3.29,3.94,3.18])
...
pcb=vector([19.9959,6.0996,24.9655,37.4436,30.183])
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-11-06 04:40:36.989573

3 Answers

Sort by » oldest newest most voted
0

answered 2013-08-10 00:43:02 +0200

m.a.riosv gravatar image

If what you want is transpose columns to rows.
Select data.
Copy [Ctrl+C]
Goto to first cell in a destination range
Menu/Edit/Paste special [Shift+Ctrl+V], enable Options-Transpose
Ok.

edit flag offensive delete link more
0

answered 2013-08-10 06:35:37 +0200

mikebibo gravatar image

Sage should be able to import data from the .csv file as it is. See, for example, http://ask.sagemath.org/question/2559/how-to-save-and-use-data-from-spreadsheet. The Sage syntax you quote is for when you are entering data manually from the command line.

edit flag offensive delete link more
0

answered 2013-08-10 04:14:16 +0200

horst gravatar image

As I understand your question, you want to export a formatted list file to use in Sage.

1) Transpose your matrix as @mariosv described it.

2) Write following formula in the next empty cell:

=A1&"=vector(["&TEXT(A2,"General")&","&TEXT(A2,"General").....&"])"

now you can copy the formula down for as many vectors you have.

3) Mark the formula cell and print them to a Text file for import in Sage.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-08-09 17:28:37 +0200

Seen: 240 times

Last updated: Aug 10 '13