# [✓] Use imported data for calculations?

GROUPS:
 I am just getting started using Mathematica. I have a code I developed in Matlab, but I realize now that Matlab does not calculate Macdonald functions of imaginary order. So, here I am with Mathematica. I have a *.csv file with numeric data array. I figured out how to read in array, but cannot find anything to instruct me how to extract element-wise values that I can use in computations. The convention of "{{ }}", or "[{ }]", or "[[ ]]" is not explained in any of the documentation, and no combination I try works. I am trying to extract, for instance, element at position [2,3] of the array to perform a calculation. The output I get is taking the entire array and performing the calculation on all elements. How do I get the calculation on the single element I want?Dwight
10 months ago
7 Replies
 Here is a List: myList = {{a, b, c}, {d, e, f}, {g, h, i}} To access the 3rd element of the 2nd row, i.e. [2,3]: myList[[2,3]] More details can be found in the doucmentation at http://reference.wolfram.com/language/ref/Part.htmlThis tutorial on Lists should help as well: http://reference.wolfram.com/language/tutorial/ListsOverview.html
10 months ago
 You should read at least the quick introduction to using Mathematica in the Mathematica Book (Documentation Center, version 11).I think the Mathematica Book version 4.0 (or 5.x) are easier to sit down and read the introduction of than Documentation Center.You can find a free mathematica book pdf at:http://reference.wolfram.com/legacy/v5_2/
10 months ago
 Thanks for all the good help. I was able to get started using the following simple: ae = Table[0, {Nd}]; Zae = Table[0, {Nd}]; Zbe = Table[0, {Nd}]; For[Nd = 1, Nd < Necc + 1, Nd++, g = gap[[Nd]]; Da = 2 ra 1000; Db = 2 rb 1000; ae[[Nd]] = (g (Db - g) (Db - Da - g) (Da + g))^0.5 /(Db - Da - 2 g); Zae[[Nd]] = ArcSinh[2 ae[[Nd]] /Da]; Zbe[[Nd]] = ArcSinh[2 ae[[Nd]] /Db]; a = ae[[Nd]] /1000; Za = Zae[[Nd]]; Zb = Zbe[[Nd]]; ];and this works. But then I try using the same here: frq1 = 50 10^6; frq2 = 1000 10^6; Nfrq = 95; frq = Table[0, {Nfrq}]; for [Nf = 1, Nf < Nfrq + 1, Nf++, frq[[Nf]] = frq1 + (Nf - 1) (frq2 - frq1)/Nfrq; ];and it does not work. Any idea why this does not work?
10 months ago
 I had a couple typo's in my response. But my question remains: Why does this script not work? frq1 = 50.0 10^6; frq2 = 1000.0 10^6; Nfrq = 10; frq = Table[0, {Nfrq}]; for[nf = 1, nf <= Nfrq + 1, nf++, frq[[nf]] = frq1 + (nf - 1) (frq2 - frq1)/Nfrq; ];The output keeps all zeroes for frq, except frq[2] which gives the correct calculation: {0, 1.45*10^8, 0, 0, 0, 0, 0, 0, 0, 0}Dwight