4

Does this do what you want? array = Riffle[{list1, list2, list3}, {{{Null, Null}}}]; array = Flatten[Transpose /@ array, 1]; array = PadRight[#, Max[Length /@ array], Null] & /@ array; Export["data.xls", Transpose[array]] Riffle puts the two empty columns between each of the lists. Flatten produces a list of the spreadsheet columns. ...


4

Select[Transpose[{l1,l2}],#[[2]] =!= False &] (* {{a > b, c > d}, {m > n, j > k}} *) Select[Transpose[{l3,l4}],#[[2]] =!= False &] (* {{j > k, m > n}} *) where l1={a>b,x>y,m>n} l2={c>d,False,j>k} l3={a>b,c>d,x>y,j>k} l4={False,False,False,m>n} (Original Answer) Select[Transpose[{l1,l2}],FreeQ[#[[2]...


4

l1 = {a > b, x > y, m > n}; l2 = {c > d, False, j > k}; MapThread[ If[#1 =!= False && #2 =!= False, List[#1, #2], Nothing] &, {l1, l2}] {{a > b, c > d}, {m > n, j > k}}


3

One way of going about it is with a, in some sense, fundamental part of MMA called pattern matching via DeleteCases. l1 = {a > b, x > y, m > n}; l2 = {c > d, False, j > k}; Transpose@{l1, l2} (*Gets corresponding pairs of elements*) DeleteCases[ % (*This is the shorthand to refer to the previous output and is technically Out[-1]*), {_, ...


3

Adding InterpolationOrder -> 0 prevents this issue. Voltage[x_] := ListLinePlot[ v, PlotStyle -> {Red, AbsoluteThickness[x]}, PlotRange -> Automatic, ImageSize -> 600, LabelStyle -> {FontSize -> 20, FontFamily -> "Helvetica", Black, Bold}, Frame -> {True, True, False, False}, FrameLabel -> {{"...


2

One big speed-up you can get is realizing a $k$-regular graph has $kn/2$ edges so you don't have to generate all subsets of the edges. This goes from considering $2^{n(n-1)/2}$ subsets to $\binom{n (n-1) /2}{kn/2}$ which is a large savings. I am still thinking if there's a way to get more savings by constraints involving spanning sets or regular sets. Either ...


2

<...> when the current context is dumped, all one may have is the printout of the table left of the original calculation, and if that takes 24 h to calculate, one would have the problem of translating a table into a vector whose origin is difficult to resurrect, in order to use it for further processing. That is the context I am most interested in. If ...


1

list = Range[5]; StringRiffle[list, " "]


1

Edit 2: list1 = {{1, 1, 0}, {1, 0, 1}, {0, 1, 1}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}}; list2 = {{2, 0, 0}, {0, 2, 0}, {0, 0, 2}, {-2, 0, 0}, {0, -2, 0}, {0, 0, -2}}; a[n_] := {"a" <> "[" <> ToString@n <> "]", list1[[n]]} ...


1

input = a1 a2 b1 b2 c2 c3 + 100 a1 b2 + a1 c2 b2 d3 + a1 a2 + a3 c1 c2 + a3 c1; 1. ReplaceAll + Alternatives + Complement + Variables: ClearAll[f1] f1 = # /. Alternatives @@ Complement[Variables @ #, {##2}] -> 0 &; Examples: f1[input, a1, a2] a1 a2 f1[input, a1, b2] 100 a1 b2 f1[input, a3, c1, c2] a3 c1 + a3 c1 c2 2. ReplaceAll + Alternatives +...


1

You may use Variables with DeleteCases. With input = a1 a2 b1 b2 c2 c3 + 100 a1 b2 + a1 c2 b2 d3 + a1 a2 + a3 c1 c2 + a3 c1; Then f[expr_, vars__] := expr /. DeleteCases[Thread[Variables[expr] -> 0], Alternatives @@ {vars} -> 0] and f[input, a1, a2] a1 a2 f[input, a1, b2] 100 a1 b2 f[input, a3, c1, c2] a3 c1 + a3 c1 c2 Hope this helps.


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