Hot answers tagged

5

You can wrap each element with Pane[#, BaselinePosition -> Top] &: Panel[Row[ Pane[#, BaselinePosition -> Top] & /@ {grf, Spacer[50], tbl}], Background -> LightBlue]


4

Something like this? Grid[Partition[Graphics[{#, Rectangle[{0, 0}, {1, 1}]}, PlotRange -> {{0, 1}, {0, 1}}, ImageSize -> 20] & /@ Map[ColorData[64], Range[100]], UpTo[16], 16], Spacings -> {0, 0}] or Grid[Partition[Graphics[{#, Rectangle[{0, 0}, {1, 1}], White, Inset["a", Center]}, PlotRange -> {{0, 1}, {0, ...


4

A zero-order interpolation is a good way to in effect invert the function from positive integers to values in sortedlist. Timing[ table = Table[N[n^2 + m^2], {n, 1, 3000}, {m, 1, 3000}]; sortedlist = Sort[Apply[Join, table[[1 ;; 50]]]]; lastpairs = SplitBy[Join[{{0, 0}}, Transpose[{sortedlist, Range[Length[sortedlist]]}]], First][...


3

Here are some suggestions for simpler methods to find the counts, and to make a plot. Instead of Array[table[[#]]&, 50]] use table[[;; 50]]. Check the documentation for Part. An easy way to count the number of values that are less or equal to $x$, is to count the values with Tally, and then total the tallies with Accumulate. table = Table[N[n^2 + m^2], {...


3

It's faster and cleaner not to use any For loops and use list processing whenever possible: nn = 6; x = Cos[Subdivide[nn]*Pi] (* {1, Sqrt[3]/2, 1/2, 0, -1/2, -Sqrt[3]/2, -1} *) d1 = Outer[Subtract, x, x] (* {{0, 1 - Sqrt[3]/2, 1/2, 1, 3/2, 1 + Sqrt[3]/2, 2}, {-1 + Sqrt[3]/2, 0, -(1/2) + Sqrt[3]/2, Sqrt[3]/2, 1/2 + Sqrt[3]/2, Sqrt[3], 1 + ...


3

crystalsystemnames = {"Cubic", "Tetragonal", "Orthorhombic", "Hexagonal", "Monoclinic", "Rhombohedral", "Triclinic"}; metrictensors = Partition[{g1, g2, g3, g4, g5, g6, g7}, 1]; data = MapThread[Append, {metrictensors, crystalsystemnames}]; MatrixForm[MapAt[MatrixForm, data, {All, 1}...


2

Maybe this is a bit closer to what you want to do. RF = Table[ Plus[ f[d, b, a, c], Conjugate[f[c, a, b, d]], If[b == d, -Sum[f[a, i, i, c], {i, 1, n}], 0], If[a == c, -Conjugate[Sum[f[b, i, i, d], {i, 1, n}]], 0] ] , {a, 1, n}, {b, 1, n}, {c, 1, n}, {d, 1, n}]; Note that I use Plus instead of + only because it is more legible of ...


2

If @Rom38's pure-function definition looks a bit esoteric, here's a more straightforward definition to the same effect: rij[ri_, rj_, kij_] = ri/2 + dri + rj/2 + drj + kij + 10 Log[ss/(1 lij)]; Try it out: rij[1, 2, 3] (* 9/2 + dri + drj + 10 Log[ss/lij] *) Of course you'll have to define the other parameters (dri, drj, ss, lij) as well.


2

You should make a function: rij=#1 /2 + dri + #2 /2 + drj + #3 + 10 Log[ss/(1 lij)]& And further call it by rij[ri,rj,kij], substituting the desired values of ri, rj and kij which are associated with numbered slots for arguments (#1,#2,#3) of the function


2

It suffices to Flatten the Table[...] : Uexact[x_, t_] := Exp[x + t] Uapprox[x_, t_] := 0.1*Exp[x + t] Grid[Prepend[ Flatten[ Table[{x, t, Uexact[x, t], Uapprox[x, t], Abs[Uapprox[x, t] - Uexact[x, t]]}, {x, -1, 1, 0.2}, {t, 0, 1, 0.1}] , 1] , {"x", "t", "Approx", "...


1

A possible solution using GraphicsRow: x = N[2 Pi/24] Range[0, 5]; data = Transpose[{x, Chop@Sin[x]}]; grf = Plot[Sin[x], {x, 0, 2 Pi}, Frame -> True, ImageSize -> 400, AspectRatio -> 0.75, ImagePadding -> {{80, 20}, {15, 5}} ]; title = Item[Style["sine data", 18, Blue], Alignment -> Center]; hdr = Item[Style[#, Bold,...


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