Hot answers tagged

4

f[x_, t_] := x + t; z = Table[{x, t, f[x, t]}, {x, 0, 1}, {t, 0, 2}]; There are several different formatting options, including the following. Note that the first two are presentation forms only; you can't do further operations on them. You can see this for yourself by applying Transpose to each of the three. z1 = Flatten[z, 1]; TableForm[z1, ...


3

You can use the command ArrayReshape ArrayReshape[ Table[{x, t, f[x, t]}, {x, 0, 1}, {t, 0, 2}], {6, 3}] // MatrixForm which gives


3

You can use DecimalForm to format your table: \[Rho] = 0.5; numeric[x_, t_] := 0.03125 (1 - 4 Sech[0.25 x]^2) + 0.0078125 t Sech[0.25 x]^4 Tanh[0.25 x] + 0.0078125 t Sech[0.25 x]^2 Tanh[0.25 x]^3 + 0.00012207 t^2 (-2.25 Sech[0.25 x]^4 + 2.25 Sech[0.25 x]^6 + 1. Sech[0.25 x]^8 + 4.5 Sech[0.25 x]^2 Tanh[0.25 x]^2 + 20.25 Sech[0.25 ...


2

Using example data from DanielHuber's answer: SeedRandom[1] d = Table[{x, y, RandomReal[3 {-1, 1}]}, {x, 5}, {y, 20}]; 1. ListPlot3D + MeshFunctions lp3d = ListPlot3D[Join @@ d, PlotStyle -> None, MeshFunctions -> {# &}, Mesh -> {{#, ColorData[97]@#} & /@ Range[5]}, MeshStyle -> Thick, BoundaryStyle -> None] Use ...


2

Clear["Global`*"] Grid[ Table[i*j, {i, 1, 10}, {j, 1, 10}], Frame -> All, Background -> {{1 -> LightGray}, None, ({#, #} -> LightGray & /@ Range[10])}] Or perhaps Grid[ Table[i*j, {i, 1, 10}, {j, 1, 10}], Frame -> All, Background -> {{1 -> LightGray}, {1 -> LightGray}, ({#, #} -> LightBlue & /@ ...


1

$Version (* "12.3.0 for Mac OS X x86 (64-bit) (May 10, 2021)" *) Clear["Global`*"] HeadingForTable = {"x", "R1", "R1A1", "R1A2", "R1A3", "R1A4", "R2", "R2A1", "R2A2", "R2A3", "R2A4", "R3", "R3A1", "...


1

I am assuming that you want integers as the input to the function F[x_,y_] and that you want to apply them to all combinations of the lists, x and y. Continue on with your use of Table and apply it to x and y. Table is very powerful and can accept lists in addition to iteration parameters. Table[F[x, y], {x, {14, 9, 7, 5, 10}}, {y, {1, 3, 2, 4, 5}}]


1

Maybe use NMaximize. n = 4; A = Table[Indexed[x, {i, j}], {j, 1, n}, {i, 1, n}]; vars = Flatten[A]; solns = NMaximize[{Det[A], 1 <= vars <= n, vars ∈ Integers, Plus @@ vars == n*Plus @@ Range[n], Times @@ vars == (n!)^n}, vars][[2]] A /. solns A /. solns // Transpose {{3, 4, 1, 2}, {3, 1, 3, 3}, {1, 4, 2, 4}, {1, 2, 4, 2}} {{3, 3, 1, 1}, {4, ...


1

"MapThread" is your friend. Here is your corrected code: d = 3; ag = 6; pg = 6; wp = 10; torootL[al_?NumericQ, t_?NumericQ, zl_?NumericQ, zh_?NumericQ] := al - ((2 zl Sqrt[(1 + t^2 (1 - (zl/zh)^(d + 1))^-1)^-1])/((d + 1) (zl/zh)^(d + 1))) NIntegrate[ x/Sqrt[(1 - x^2) (1 - (((1 + t^2 (1 - (zl/zh)^(d + 1))^-1)^-1) (zl/ ...


1

Try MapThread[{#1, #2, tz[0.1, #1, #2]} & , {{0.937858, 9.30684, 18.6124,27.9182, 37.2237, 46.5288, 55.8341, 65.1388, 74.4432, 83.7471,93.0506} , {1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}}] (*{{0.937858, 1, -1.471551293}, {9.30684, 10, -15.50176577}, {18.6124,20, -31.01646875}, {27.9182, 30, -46.52851902}, {37.2237,40, -62.04170567}, {46.5288, 50, -77....


1

Maybe I’ve misunderstood this, but...using the example data from DanielHuber’s answer: SeedRandom[1]; d = Table[{x, y, RandomReal[3 {-1, 1}]}, {x, 5}, {y, 20}]; We can simply use the new in 12.3 ListLinePlot3D: ListLinePlot3D[d] To get the other orthogonal direction, with your formatting of list we can simply take the Transpose of the list: ListLinePlot3D[...


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