Tag Info

New answers tagged

0

I figured it out and I believe this is one of the biggest pitfalls for newbies. Rather than filling a preallocated vector, MATLAB style, one ought to use the function table instead, which executes the expression k number of times. Hence, the following code does it: m = 2; n = 3; nonce = {{1, 0}, {0, 0}, {0, 0}}; data = Table[q = ...


0

thelist=ReadList["/tmp/foo", "Number"] Partition[Drop[thelist, 1], 2] Will give you a list of re/im pairs (I just tried it, it works).


5

The basic reason is that once you convert a tensor expression into a SparseArray, you've "given control" of all levels of that expression to SparseArray to manage on your behalf in an efficient way (the number of levels is the rank of the tensor, to mix jargon). SparseArray will then try to maintain the illusion that those levels are still really there. ...


4

Here's another somewhat shorter method: Thread @ {#, {##2}} & @@@ data\[Transpose] And this may be somewhat faster than other methods: Inner[List, data[[All, 1]], data[[All, 2 ;;]], List]


0

For instance, data1 and data13 can be obtained using x = data[[All, 1]]; data1 = Transpose[Sort[MapThread[ Function[xpt, {xpt, #} & /@ #2][#1] &, {x, Rest /@ data}]]][[1]] // TableForm data13 = Transpose[Sort[MapThread[Function[xpt, {xpt, #} & /@ #2][#1] &, {x, Rest /@ data}]]][[13]] // TableForm


7

Here is one way to accomplish this: op = data[[All, {1, #}]] & /@ Range[2, Length@data[[1]]]; Visualize: ListLinePlot[op, PlotTheme -> "Detailed"] You can collect them in different variables as follows: Evaluate[Symbol /@ ("data" <> ToString[#] & /@ Range@Length@op)] = op; Now: data1 gives {{0.020024338, 0.46718468}, ...



Top 50 recent answers are included