Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Read from csv-file, write results in new columns in the same csv-file

Hi,

I am currently trying to achieve the following:

given a csv-file e.g. like

x,y,sinx,siny
30,45,,
60,90,,

Values for x and y are given in degree. What I want to do: take the data from the csv-file, calculate sin(x) and sin(y) for the values given in each row and then print the result in the corresponding cell. If possible, do not round the result, so the output should look something like this:

x,y,sinx,siny
30,45,1/2,sqrt(2)/2
60,90,sqrt(3)/2,1

Taking this one step further, if possible the output should be printed in complete LaTeX-code because the date from the csv-file will be used in a LaTeX-document, so the best possible result would be:

x,y,sinx,siny
30,45,\frac{1}{2},\frac{\sqrt{2}}{2}
60,90,\frac{\sqrt{3}}{2},1

I do know about sageTex which is able to do this, but for other reasons I can't use sageTex for my problem.

I am completely new to sage, so I don't know if there is a standard procedure for this or if it is possible at all. Any input is appreciated!