Tag Info

New answers tagged

0

As Sektor mentioned in his comment, you really had almost everything you needed to answer your own question already. Here is an example to put those ideas together (you don't specify your matrix, so I just made one up): matrix = {{4, 3, 5}, {7, rs, 10}, {7, 9, 19}}; results = Table[ Flatten@{rs, Eigenvalues[matrix, 3, Cubics -> True]}, {rs, 0, 2, ...


0

I think this can done as follows: pol = {1, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3}; ip = Join @@ (Permutations /@ PadRight[IntegerPartitions[3, 3]]); subs = Subsets[Range[18], {3}]; rl = Flatten[Map[Function[u, Thread[u -> #] & /@ ip], subs], 1]; cand = ReplacePart[ConstantArray[0, 18], #] & /@ rl; ex = Position[pol, 1] pck = ...


3

I think the comment solution will serve you well: p1 = Join @@ Permutations /@ IntegerPartitions[3, {18}, Range[0, 3]]; result = Cases[p1, Alternatives @@@ Range[0, {1, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3}]]; Testing this (on my loungebook, so I limited both yours and this to indices to u), yours took ~30 seconds and the initial table took ...


1

I don't know if this will save you sufficient memory, but it will certainly cut down your memory use. $HistoryLength = 0; list1 = Flatten[ Table[{i, j, k, l, m, n, o, p, q, r, s, u, v, x, y, z, a, b}, {i, 0, 1}, {j, 0, 3}, {k, 0, 3}, {l, 0, 1}, {m, 0, 3}, {n, 0, 3}, {o, 0, 1}, {p, 0, 3}, {q, 0, 3}, {r, 0, 1}, {s, 0, 3}, {u, 0, 3}, ...


-1

How about results=Cases[ ParallelTable[If[!FailedQ[g = grab[i]], g], {i, 2000000, 3000000}],Except[Null]] At some point you'll run into a memory issue with all the Nulls, but I think with only 10^6 you are ok.


0

This may not be the fastest way, but it's a way: SetSharedFunction[ParallelSow] ParallelSow[expr_] := Sow[expr] Reap[ParallelDo[If[countedQ[i], ParallelSow[f[i]]], {i, 1, 10^7}]] where countedQ[i] is some Boolean function that determines whether f[i] gets added to the accumulated list. Feel free to make improvements. Note that AppendTo scales as $O(n^2)$ ...


1

Perhaps this is what you are looking for. arry = Array[a, {4, 3}] {{a[1, 1], a[1, 2], a[1, 3]}, {a[2, 1], a[2, 2], a[2, 3]}, {a[3, 1], a[3, 2], a[3, 3]}, {a[4, 1], a[4, 2], a[4, 3]}} funcTable = Map[With[{a = #}, Function[x, a (1 + f[x])]] &, arry, {2}]; This shows how the functions in funcTable can be evaluated at an arbitrary value t. ...


3

Probably. A = Array[a, {3, 4}]; functionTable = A + A f@# &; functionTable[x]


2

If it is enough to apply a uniform style to the whole table, then that can be achieved after applying TableForm: data = Transpose[{Range[9, 14], RandomReal[{-5, 20}, 6]}]; Style[ TableForm[data, TableAlignments -> "."], Red, FontFamily -> "Times New Roman", FontSize -> 23 ]


1

Try something like this. Also study this to learn how to create a minimal working example: mwe = Table[{j, Table[RandomInteger[10, 3], {i, 1, 36, 1}]}, {j, 1, 25}]; Row[Column[{#[[1]], MatrixForm@#[[2]]} , Center ] & /@ mwe] showing here a smaller version:


1

Here's an alternative take. pdf[n_Integer] := Tally@Flatten@Array[Plus, ConstantArray[6, n]] Manipulate[ListPlot[pdf[n]], {n, 1, 5, 1}] Performance is significantly improved (10 dice is bearable). To get the cdf add memoization (because bruteforce computation is costly, but end result is simple) and have this: pdf[n_Integer] := (pdf[n] = ...


2

I figured out a way to do what I was trying to do. Turns out the graph is not that interesting b/c the scale explodes so quickly. In anycase, I believe what I have made use of here (the xx[n] construct) is an "indexed object". Manipulate[ formals = Table[xx[n], {n, 1, a}]; data = {#, 1, 6} & /@ formals; t = Table @@ Prepend[data, formals]; pdf ...


1

Summarizing J.M.'s comments you could use: Do[ f[m] = Table[i/11 + j/m, {i, 5}, {j, 5}], {m, 9, 12} ]; f[11] // MatrixForm $\left( \begin{array}{ccccc} \frac{2}{11} & \frac{3}{11} & \frac{4}{11} & \frac{5}{11} & \frac{6}{11} \\ \frac{3}{11} & \frac{4}{11} & \frac{5}{11} & \frac{6}{11} & \frac{7}{11} \\ \frac{4}{11} ...


2

The second argument to ListInterpolation can either be a range of x-values (assumed to be equally spaced) or a list of x-values corresponding to the list values. So in your case you may simply do ListInterpolation[ pressure[[All,2]] , pressure[[All,1]] ] Or simply use Interpolation[ptopp] for the same result, or InterpolatingPolynomial[ptopp,x] if ...


1

This is an alternate method, but I rather prefer kale's: FindCol[t_, n_, col_] := t[[Position [t, n][[1, 1]], col]] FindCol[data, 0.049, 3] (* -0.439999 *)


0

If you want to use AppendTo, you could just make list a shared variable and change your ParallelTable to a ParallelDo: list = {}; SetSharedVariable[list]; ParallelDo[Block[{x = x2, y}, y = 2 x^2; AppendTo[list, {x, y}];];, {x2, 1, 4}]



Top 50 recent answers are included