ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 09 Jun 2019 11:18:23 -0500Derivative of a CSV data sethttps://ask.sagemath.org/question/46885/derivative-of-a-csv-data-set/I am trying to get the derivative of this CSV data set, and this is code I have so far I thought it would be similar to this matlab code:
dy=diff(y)./diff(x)
plot(x(2:end),dy)
Data Set:
0,2.58612
0.00616025,2.20018
0.0123205,1.56186
0.0184807,0.371172
0.024641,0.327379
0.0308012,0.368863
0.0369615,0.322228
0.0431217,0.171899
0.049282,-0.0635003
0.0554422,-0.110747
0.0616025,0.0701394
0.0677627,0.202381
0.073923,0.241264
0.0800832,0.193697
0.0862434,0.0797016
0.0924037,0.0103144
0.0985639,0.096153
0.104724,0.216782
There's more data...a lot more
This is my attempt at the code:
import csv
data = list( csv.reader(open('C:/images/TEST1.txt','rU')) )
data = map(lambda x: [float(x[0]),float(x[1])],data)
P = list_plot(data, plotjoined= True, color = 'blue', xmin = 0, xmax = 3)
TeraHertz = text('Tera Hertz', (1.5,-.9))
Absorbance = text('Absorbance', (0.8,5))
g = P + TeraHertz + Absorbance
g.show()
latex(g)
g.save('TeraHertzTEST1.pgf')
t=diff(x[1]).diff(x[0])
l = plot(x[0],t)
l.show()EnlightenedFunkSun, 09 Jun 2019 11:18:23 -0500https://ask.sagemath.org/question/46885/How do I deal with large, hex numbers in Sage?https://ask.sagemath.org/question/26061/how-do-i-deal-with-large-hex-numbers-in-sage/ How do I deal with large, hex numbers in Sage (say ones with 256 or 512 bytes)? How would I import them from a CSV file?
(cf. [this related answer](http://ask.sagemath.org/question/24708/how-to-enter-very-large-numbers/?answer=24710#post-id-24710))GeremiaSat, 07 Mar 2015 10:47:47 -0600https://ask.sagemath.org/question/26061/How do I multiply items within a CSVhttps://ask.sagemath.org/question/10243/how-do-i-multiply-items-within-a-csv/Hi, I am trying to import a CSV file then find the product of all of the numbers within the file. The code I have used so far is:
import csv
mylist = list(csv.reader(open(DATA+'mydata.csv','rb'),dialect='excel'))
from numpy import prod
prod(mylist)
However, this doesn't work, I receive the following error "TypeError: cannot perform reduce with flexible type".
I think this is because of the format of how the mylist is created. This list data comes out in this format:
[['1'],['2'],['3']]
How do I coerce it into the format (1,2,3)?
NickCFri, 14 Jun 2013 14:29:29 -0500https://ask.sagemath.org/question/10243/