# Tag Info

8

myTable = Array[Subscript[a, Row[{##}]] &, {5, 10}]; MatrixForm @ myTable functions = {foo, bar}; columns = {2, 5}; 1. Part assignment: myTable[[All, columns]] = {foo@#, bar@#2} & @@@ myTable[[All, columns]]; myTable // MatrixForm 2. MapAt myTable = Array[Subscript[a, Row[{##}]] &, {5, 10}]; myTable = Fold[MapAt[First@#2, #, {All, Last@#2}] &...

8

A little too long for a comment, and I have marked this as 'Community Wiki' (not an original contribution). In addtion, I think the Query method should not be 'buried' in a comment. Query Sjoerd Smit has posted a neat method for applying a function to a matrix column using Query. Query[All, {1 -> (#+1/137&),3->(2 Pi# + 42&)}]@myTable2//...

7

a = 2; a[n_] := a[n] = 4 Sum[a[i], {i, n - 1}] Table[a[n], {n, 1, 10}] {2, 8, 40, 200, 1000, 5000, 25000, 125000, 625000, 3125000}

6

kglr's ReplacePart method is completely general, but I think in many situations writing the rules explicitly is easier and gives more readable code. So I would write: data = Array[f, {4, 4}]; ReplacePart[data, {{r_, 1} :> data[[r, 1]] + 137, {r_, 3} :> 2 π data[[r, 3]]}] {{137 + f[1, 1], f[1, 2], 2 π f[1, 3], f[1, 4]}, {137 + f[2, 1], f[2, 2], 2 π f[...

6

Table[Plot[{Re[ReleaseHold@f] /. j -> 3, Im[ReleaseHold@f] /. j -> 3}, {n, 0, 15}, GridLines -> Automatic, PlotRange -> All, ImageSize -> 350, PlotLegends -> {"Real", "Imaginary"}, PlotLabel -> f], {f, {HoldForm@Sum[Sinc[Pi*(n - i*j)], {i, 1, Floor[n]}], HoldForm[(-1 + E^(2*I*Pi*n))/(j*(-1 + E^((2*I*...

5

Table[Plot[f, {x, 1, 10}], {f, {1/x, x^2}}] Table[Plot[f[x], {x, 1, 10}], {f, {1/# &, #^2 &}}] Table[Plot[f[x], {x, 1, 10}], {f, {1/x &, x^2 &}}] all give

4

Sum[f, {t, tlist}] E^(-20/T) + E^(-18/T) + E^(-16/T) + E^(-14/T) + E^(-12/T) + E^(-10/ T) + E^(-8/T) + E^(-6/T) + E^(-4/T) + E^(-2/T)

3

You can introduce a memory variable b[n] and solve for both a[n] and b[n]. RecurrenceTable[{a[n + 1] == 4 b[n], b[n] == b[n - 1] + a[n], a == b == 2}, {a, b}, {n, 1, 10}][[All, 1]] (* {2, 8, 40, 200, 1000, 5000, 25000, 125000, 625000, 3125000} *)

2

Clear["Global*"] In your code, you have the wrong syntax for the Sum. However, even with the correct syntax rt = RecurrenceTable[{a[n + 1] == 4 Sum[a[i], {i, 1, n}], a == 2}, a, {n, 1, 10}] As stated in the error message, all instances of a[_] must have arguments of the form n + integer Amplifying on the answer by Suba Thomas a = 2; a[...

2

You can do FindInstance[n^2 == 9 (x^3 (y - 2)^2 + 3 x^2 (y - 2) - 2 x (y - 45) (y - 2) + 7 (y - 1)^2), {x, y, n}, PositiveIntegers] (* {{x -> 3, y -> 5, n -> 102}} *) to find an exemplary instance. If you want all solutions up to $x,y\le s$, you can do With[{s = 20}, Solve[{n^2 == 9 (x^3 (y - 2)^2 + 3 x^2 (y - 2) - 2 x (y - 45)...

1

Clear["Global*"] \[ScriptH][k_] := DifferenceRoot[ Function[{\[FormalY], \[FormalN]}, {-(1 + k)^2 + (3 + 4 k) \[FormalN] - 4 \[FormalN]^2 - 2 (-k - 1 + \[FormalN]) (-k/2 + \[FormalN]) (-k - 1 + 2 \[FormalN]) \[FormalY][\[FormalN]] + 2 (-k - 1 + \[FormalN]) (-k/2 + \[FormalN]) (-k - 1 + 2 \[...

1

f[n_]:=2*(3n+6-1)(n+2)+Total[9Table[Binomial[n,j]+n,{j,0,n}] ] f f f f 29 84 178 320 Also here is the hole Table: Table[Flatten[Riffle[Table[{3n+6-1,3n+6-1},n+2],9Table[Binomial[n,j]+n,{j,0,n} ]]],{n,0,3}] {{5,5,9,5,5},{8,8,18,8,8,18,8,8},{11,11,27,11,11,36,11,11,27,11,11},{14,14,36,14,14,54,14,14,54,14,14,36,14,14}}

1

The working examples are all using the pattern iterating over a given list from the section Scope on the documentation page for Table. Table[Sqrt[x], {x, {1, 4, 9, 16}}] ({1, 2, 3, 4}) Plot prefers the pure function as input. In the section Generalizations & Extensions Table[a[x]!, {a[x], 6}] ({1, 2, 6, 24, 120, 720}) The variables need not just be ...

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