Tag Info

New answers tagged

3

data= Import["http://pastebin.com/raw.php?i=7jJ4e2jW"]; titles = First@data; data = Rest@data; TableForm[data, TableHeadings -> {None, titles}] (*Displays the Table *) (*Do Something with Data*) ArrayPlot[data]


3

You can use a Table with variable iterator limit. e.g. Table[f[i, r], {i, 0, 5}, {r, {i}}] {{f[0, 0]}, {f[1, 1]}, {f[2, 2]}, {f[3, 3]}, {f[4, 4]}, {f[5, 5]}} Or Table[f[i, r], {i, 0, 5}, {r, 0, i, 2}] // TableForm f[0,0] f[1,0] f[2,0] f[2,2] f[3,0] f[3,2] f[4,0] f[4,2] f[4,4] f[5,0] f[5,2] f[5,4]


4

There are two easy approaches that come to mind. The first is to simply use MapThread. MapThread[foo, {Range[0, 4], Range[24, 32, 2]}] {foo[0, 24], foo[1, 26], foo[2, 28], foo[3, 30], foo[4, 32]} If you are collecting all results this is probably a perfectly good approach as memory is unlikely to be a problem. The second is to define the ...


6

In Version 10, we can use Inactivate and Activate to achieve this easily: With[{rl = Array[{m -> #} &, 5], s = Inactivate[Sum[i^m, {i, 1, n}], Sum]}, Thread[Equal[s /. rl, Factor[Activate[s] /. rl]]]] // Column // TeXForm \begin{array}{l} \underset{i=1}{\overset{n}{\sum }}i=\frac{1}{2} n (n+1) \\ \underset{i=1}{\overset{n}{\sum ...


2

ClearAll[f]; f = Transpose@Table[i {##2}/#^{##2} , {i, 1, #}] &; f[3, x] (*{{3^-x x,2 3^-x x,3^(1-x) x}} *) f[3, x, y, z] (* {{3^-x x,2 3^-x x,3^(1-x) x}, {3^-y y,2 3^-y y,3^(1-y) y}, {3^-z z,2 3^-z z,3^(1-z) z}} *)


2

If your n is a very big integer and your x and y are real values, and you need realy high speed, than you should try Compile: cf = Compile[{{x, _Real, 0}, {n, _Integer, 1}}, n*x/Length[n]^x, RuntimeAttributes -> {Listable}, Parallelization -> True, CompilationTarget -> "C" ] f[n_, x_, y_] := {cf[x, Range[n]], cf[y, Range[n]]} For ...


1

perhaps something like this: function[n_, x_, y_] := ({table1, table2} = Table[i {x/n^x, y/n^y}, {i, n}] // Transpose;) But note your example does not need Table at all: function[n_, x_, y_] := ({table1, table2} = {x/n^x, y/n^y} # & /@ Range[n] // Transpose;) Of course assigning to global variables inside a ...


0

Perhaps tab = {{2, 5}, {5, 7}}; tab2 = List /@ # & /@ tab (* or tab2 = Map[List,tab,{-1}] *) (* {{{2},{5}},{{5},{7}}} *) Export["fileA.xls", tab2]


1

Correct it to be: Export["file.xls",{{2,5},{5,7}}] or more explicitly Export["file.xls",{{2,5},{5,7}},"XLS"] "Table" is a generic Table-Format, suitable for a simple Text-Editor, not specially dedicated to Excel When you leave away the 3rd argument, then the default value is "XLS", and Excel will import it without additional Import-Dialog.


0

Fixing the OP's original function :- data = {{0.349661, 0.380297}, {0.858156, 0.8442}, {0.906745, 0.171579}, {0.0847783, 0.277227}, {0.198453, 0.40206}, {0.941614, 0.347187}}; judge = {{0.0423892, 0.141616}, {0.141616, 0.274057}, {0.274057, 0.603909}, {0.603909, 0.882451}, {0.882451, 0.924179}, {0.924179, 0.959049}}; Which @@ Flatten@ ...


0

For more variety, using a rule replacement data = {{0.349661, 0.380297}, {0.858156, 0.8442}, {0.906745, 0.171579}, {0.0847783, 0.277227}, {0.198453, 0.40206}, {0.941614, 0.347187}}; range = {{0.0423892, 0.141616}, {0.141616, 0.274057}, {0.274057, 0.603909}, {0.603909, 0.882451}, {0.882451, 0.924179}, {0.924179, 0.959049}}; data[[All, 1]] ...


1

indexF = Function[{x}, Piecewise[MapIndexed[{First@#2, #[[1]] <= x <= #[[2]]} &, #]]]&; h = MapAt[indexF[#2], #1, {All, 1}] &; data = {{0.349661, 0.380297}, {0.858156, 0.8442}, {0.906745, 0.171579}, {0.0847783, .277227}, {0.198453, 0.40206}, {0.941614, 0.347187}}; ints = {{0.0423892, 0.141616}, {0.141616, 0.274057}, {0.274057, ...


0

Just for variety: data = {{0.349661, 0.380297}, {0.858156, 0.8442}, {0.906745, 0.171579}, {0.0847783, 0.277227}, {0.198453, 0.40206}, {0.941614, 0.347187}}; int = {{0.0423892, 0.141616}, {0.141616, 0.274057}, {0.274057, 0.603909}, {0.603909, 0.882451}, {0.882451, 0.924179}, {0.924179, 0.959049}}; Changing the intervals and sorting ...


4

data = {{0.349661, 0.380297}, {0.858156, 0.8442}, {0.906745, 0.171579}, {0.0847783, .277227}, {0.198453, 0.40206}, {0.941614, 0.347187}}; ints = {{0.0423892, 0.141616}, {0.141616, 0.274057}, {0.274057, 0.603909}, {0.603909, 0.882451}, {0.882451, 0.924179}, {0.924179, 0.959049}}; {IntegerPart@ InverseFunction[Interpolation[ints[[All, 1]], ...


4

If I'm interpreting your question correctly... data = {{0.349661, 0.380297}, {0.858156, 0.8442}, {0.906745, 0.171579}, {0.0847783, 0.277227}, {0.198453, 0.40206}, {0.941614, 0.347187}}; intervals = Interval /@ {{0.0423892, 0.141616}, {0.141616, 0.274057}, {0.274057, 0.603909}, {0.603909, 0.882451}, {0.882451, 0.924179}, ...


1

data = {{0.349661, 0.380297}, {0.858156, 0.8442}, {0.906745, 0.171579}, {0.0847783, 0.277227}, {0.198453, 0.40206}, {0.941614, 0.347187}}; data2 = {{0.0423892, 0.141616}, {0.141616, 0.274057}, {0.274057, 0.603909}, {0.603909, 0.882451}, {0.882451, 0.924179}, {0.924179, 0.959049}}; data3 = Range[6] f[{x_, y_}] := Evaluate@Piecewise@Transpose@{{#, ...



Top 50 recent answers are included