Tag Info

New answers tagged

1

You can do that this way: Values = {{1, 2}, {3, 4}, {5, 6}}; VariableS = {{x1, x2}, {x3, x4}, {x5, x6}}; MapThread[Set, {VariableS, Values}, 2]; Integrate[Sin[x], {x, x1, x2}] Cos[1] - Cos[2] Your way is not working because VariableS[[1]] = Values[[1]]; sets the value of the first element of VariableS not the symbol names stored there.


1

The matrix Clear[a,B,d,j,M]; m = {{B/2 - d - j/2 + a, (Sqrt[2]*j)/2, M}, {(Sqrt[2]*j)/2, B/2 + a, 0}, {M, 0, (-3*B)/2 - d + j/2 + a}}; has eigenvalues determined by the characteristic polynomial of (maximal) degree 3. In the absence of any other information, we get three Root objects as the eigenvalues, which is Mathematica's way of preserving all ...


0

h[x_, y_, z_] := y (a - z) - z (a - t) + (y + x) (Max[0, b - (y - z)] - x + 1) Maximize[{h[x, y, z], 0 <= z <= t, z <= y <= a,0 <= x <= Max[0, b - (y - z)]}, h] Finds a lot of solutions. Sounds too simple to be your problem, but can't add comments.


0

Nothing special here, except it uses your idea of encoding the card using a base-13 representation: card[n_Integer /; 1 <= n <= 52] := With[{suits = {"Hearts", "Diamonds", "Clubs", "Spades"}, values = Join[{"Ace"}, ToString /@ Range[2, 10], {"Jack", "Queen", "King"}]}, IntegerDigits[n - 1, 13, 2] /. {s_, v_} :> values[[v + 1]] ...


0

randomHand[x_] := Module[{cards, suits, value}, cards = DeleteCases[#, {___, 0}, 2] &@ PadLeft[IntegerDigits[RandomInteger[{1, 52}, x], 13]]; suits = First /@ cards /. {0 -> "Hearts", 1 -> "Diamonds", 2 -> "Clubs", 3 -> "Spades"}; value = Last /@ cards /. {11 -> "Jack", 12 -> "Queen"}; StringJoin @@ Insert[ToString /@ #, ...


5

suits = {" of Hearts", " of Diamonds", " of Clubs", " of Spades"}; deck = Join @@ Outer[StringJoin, Join[ToString /@ Range[2, 10], {"Jack", "Queen", "King", "Ace"}], suits]; RandomSample[deck, 5] (* {"King of Diamonds", "2 of Spades", "6 of Hearts", "5 of Clubs", "8 of Diamonds"} *)



Top 50 recent answers are included