Hot answers tagged

5

Table[{a, b}, {a, 16, 65}, {b, 10, Min[16, a - 5 - 1]}] // Flatten[#, 1] &


5

Personally, I would prefer march's solution of using ConstantArray[] instead of the tweak I am about to show. As I noted, one should not be (re)setting system options willy-nilly, and especially if you don't know what you're doing. Thus, here is how one can localize the setting change I mentioned in the comments: With[{copt = SystemOptions["CompileOptions"]}...


5

list = {"ingenious", "forgotten", "tree", "supercomput", "hundred"}; list /. word_String :> Join[{word}, Characters@word] // Grid[#, Dividers -> All] &


3

You can manually apply a style to each heading: GM = TableForm[GraphM, TableHeadings -> {{Style["v=1", FontSize -> 18], Style["v=.5", FontSize -> 18], Style["v=.25", FontSize -> 18], Style["v=.125", FontSize -> 18]}, {Style["k=.4", FontSize -> 18], Style["k=.2", FontSize -> 18], Style["k=.1", FontSize -> 18], Style["k=....


3

You can use vertexDeleteKeepEmbedding which is a side effect of Clickable graph answer: gr = CompleteGraph[17, PlotRange -> 2] FoldList[ vertexDeleteKeepEmbedding, gr, RandomSample @ Most @ VertexList @ gr ] // ListAnimate vertexDeleteKeepEmbedding[graph_, vertex_] := Module[{ coords, vertices = VertexList[graph] } , coords = ...


3

I think this does what you want. exportToFolder[{dir_, data : {{_, _?MatrixQ} ..}}] := With[{path = "folder" <> ToString @ dir}, CreateDirectory @ path; Export[FileNameJoin[{path, ToString @ #}], #2, "Table"] & @@@ data; ] Make sure you first remove the TableForm wrapper from your data: rawoutput = First @ alloutput; Then your ...


3

To do it with Table modify your Tuples example: Flatten[Table[If[a - b > 5, {a, b}, Nothing], {a, Range[16, 65]}, {b, Range[10, 16]}], 1]; If you are not committed to Table another idea is to use Outer Flatten[Outer[If[#1 - #2 > 5, List[#1, #2], Nothing] &, Range[16, 65], Range[10, 16]], 1];


2

Mr.Wizard has shown how memory performance is affected. I wish to illustrate various aspects of timing performance. First, Developer`ToPackedArray@Table[] takes about the same time as ConstantArray[]: v = Range@1*^6; (* all examples with Mr.Wizard's (packed) v *) With[{copt = SystemOptions["CompileOptions"]}, Internal`WithLocalSettings[ ...


2

Functions march in a comment proposed ConstantArray, and indeed this works: pQ = Developer`PackedArrayQ; toP = Developer`ToPackedArray; v = Range[5]; ConstantArray[v, 7] // pQ (* True *) Padding functions will return packed arrays with some syntax but not others: PadRight[{v}, {7, Automatic}, v] // pQ (* True *) PadRight[{{}}, ...


2

The simplest way to achieve the same is FoldList[Times, 5, Range[2,10]] Ref: FoldList.


2

As the promp of Sascha's answer,I simplify this code be list={"ingenuous","forgotten","tree","supercomput","hundred"}; Grid[Join[List/@list,Characters/@list,2],Frame->All,Spacings->{2.6,0.5}]


1

You seem to know all the pieces you need except for Manipulate. As a self-contained example: table = RandomInteger[10, {100, 4}]; a = GatherBy[table, Last]; Manipulate[ ListPointPlot3D[ a[[i]][[All, 1 ;; 3]] ], {i, 1, Length @ a, 1} ] An additional example this time using GroupBy, and a few customizations. table[[All, 4]] *= 7; (* change values in ...


1

Let,s say this is your input list = {{-1, 1}, {-1, 2}, {0, 3}, {{1, -1}, {20, 12}}, {2, 4}, "0.01*Round[{}+{-1,-1}]"} First replace the String list = list /. x__ /; StringQ[x] -> {0, 0} Join[{list[[1]]}, Table[s = list[[i]]; If[Length[Flatten@s] > 2, d = Min[{Norm[s[[#]] - list[[i - 1]]], Norm[s[[#]] - list[[i + 1]]]}]...



Only top voted, non community-wiki answers of a minimum length are eligible