11

The variable i is a dummy one. The evaluated expression: Sum[f[i], {i, 1, 10}] f[1] + f[2] + f[3] + f[4] + f[5] + f[6] + f[7] + f[8] + f[9] + f[10] contains no explicit variable f[i], hence, the result is 0. Try to first Inactivate the sum, and only then to calculate the derivative: expr1 = D[Inactivate[Sum[f[i], {i, 1, 100}], Sum], f[i]] The result is ...


8

f = Thread @* Map[Thread]; With listsas your input list: MatrixForm /@ f[lists] Alternatively, you can replace 0. with {0., 0.} in lists paddedlists = lists /. 0. -> {0., 0.}; and use paddedlists with Transpose or with Flatten to get the same result: f @ lists == Flatten[paddedlists, {{3}, {2}, {1}}] == Transpose[paddedlists, {3, 2, 1}] True


7

You can try Array: Array[c, {3, 3, 3, 3}] arraydepth = 3; Array[c, ConstantArray[3, arraydepth]]


5

lst1=#1&@@@#&/@lst {{0.05792, 0., 0., 0., 0., 0.}, {0., 0.28832, 0.17173, 0., 0., 0.}, {0., 0.17173, 0.104, 0., 0., 0.}, {0., 0., 0., 0.30752, 0.322232, 0.214663}, {0., 0., 0., 0.322232, 0.392, 0.277128}, {0., 0., 0., 0.214663, 0.277128, 0.2}} lst2=#2&@@@#&/@lst {{0.31744, 0., 0., 0., 0., 0.}, {0., 0.49024, 0.386393, 0., 0., 0.}, {0., 0....


5

index[_[x__]] := x (* <-- Extracts arguments from an expression. *) muteIndexSum[list_] := Module[ {indices, repeatedIndices, result}, (*ALL indices: *) indices = Table[index[gamma], {gamma, list}]; (*REPEATED indices: *) repeatedIndices = {}; Do[If[Count[indices, i] == 2 && ContainsNone[repeatedIndices, {i}], AppendTo[...


5

Consider using the Increment operator: (*In[1]:= *)i = 1; (*In[2]:= *)inp = {x, y, z, x, y, x, x, z}; (*In[3]:= *)inp /. x :> i++ (*Out[3]= {1, y, z, 2, y, 3, 4, z}*) Hopefully it's obvious how this can be extended to your example using Symbol.


4

Some time ago I've written a search routine which allows searching inside of Notebooks using string patterns: Searching a phrase in all *.nb files Other solutions from that thread can also be of interest for you. Alternatively you can program your own search routine on the base of one of the following functions: Import[nbFilePath, "Plaintext"] ...


4

Here is a potential workaround. Windows 10 has a feature called the Windows Subsystem for Linux. You should be able to activate from the start menu and typing "Windows Features" and selecting the first hit. Then, turn it on as shown in the image. Linux has a command called grep that provides many options to search text files. After installing, you can ...


4

What the shape of $ \gamma_\mu \gamma^\mu $ do you expect? I am not sure whether the code below works to your satisfaction or not: Total @ MapThread[Dot, {γ[Range[0, 3]], γ[Range[0, 3]]}] Update OK, let me make it in a more formal and natural way. First let some points made clear: Contraction of a pair of two same Greek indexes is accompanied with ...


4

test = <|"key1" -> <|"key11" -> 11, "key12" -> 12, "key13" -> 13|>, "key2" -> <|0 -> <|"X" -> 5, "Y" -> 0|>, 1 -> <|"X" -> 6, "Y" -> 0|>, 2 -> <|"X" -> 7, "Y" -> 0|>, 3 ...


3

To elaborate on b.gates.you.know.what's comment, this is a scalable version equivalent to kglr's solution: Outer[c, Sequence @@ ConstantArray[{1, 2, 3}, 4]] === Array[c, {3, 3, 3, 3}] True {1, 2, 3} can be a list of any elements.


3

If we can rely upon the target associations always being under "key2" and always having a subkey "X", then: test // MapAt[Select[#X > 6 &], "key2"] % === test2 (* True *) or test // Query[{"key2" -> Select[#X > 6 &]}] In a more general case where we do not know the parent key or even if the ...


3

array = Array[Subscript[m, ##] &, {8, 5}]; {checkmark, dot} = {"✓", "\[FilledSmallCircle]"}; labeledcells = Join[Thread[{1, Range[5]}], {{2, 1}, {8, 1}}]; markedcells = {{2, 2}, {4, 3}, {6, 5}}; dottedcells = Complement[Tuples[{Range[8], Range[5]}], labeledcells, markedcells]; array2 = ReplacePart[array, {markedcells :> checkmark,...


3

SeedRandom[1] data = RandomReal[300, {300, 2}]; Construct lists of neighbors within radius 20 of each point using Nearest: r = 20; listy = Association @ MapIndexed[#2[[1]] -> Rest@Nearest[data -> "Index", #, {All, r}] &, data]; You can wrap each data point with Callout: pPar[i_] := ListPlot[{Callout[data[[i]], i]}, AspectRatio -> 1, ...


2

As a workaround, you can just use Func[f_, xx_] := Total@Grad[f, xx] Func[x^2 + y^2, {x, y}] Func[x^2 + s^2, {x, s}] 2 x + 2 y 2 s + 2 x


2

Does it fit your needs? MapIndexed[ SetOptions[#, CellLabel -> StringTemplate["In[``]"][#2[[1]]]] &, Cells[EvaluationNotebook[], CellStyle -> {"Input"}] ]


2

Sum[foo[i], {i, 1, 3.5}] foo[1] + foo[2] + foo[3] How -0.289281 is obtained in the first case in OP: Sum evaluates before ReplaceAll takes effect: Sum[Cos[x - i], {i, 0, x}] 1/2 (1 + Cos[x] + Cot[1/2] Sin[x]) % /. x -> 3.5 -0.289281 You can see this using Trace: Trace[Sum[Cos[x - i], {i, 0, x}] /. x -> 3.5] // Column


2

With help from Kglr's answer, I worked out what I was looking for. For the computation to work with arbitrary sequence of 0 and 1's I found I needed to explicitly identify all pairs of indices. I am sure this is not the most elegant or concise, but it seems to work. IndexList = {1, 5, 10, 12}; Data = {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0}; ValidRanges = ...


2

Maybe Split[IndexList, Total[Data[[# ;; #2]]] >= 1 &] {{1, 5}, {10, 12}} Also Split[IndexList, MemberQ[Data[[# ;; #2]], 1] &] {{1, 5}, {10, 12}}


2

Try Select[list, #[[2]] > 2 &] (*{{1, 11}, {2, 7}, {7, 9}}*)


1

psi = -4 (x^2 + y^2); gradPsi = Grad[psi, {x, y}] R = TransformedRegion[Rectangle[], {Indexed[#, 1] - First@gradPsi /. x -> #[[1]], Indexed[#, 2] + Last@gradPsi /. y -> #[[2]]} &]; Show[Graphics[{Opacity[.5], Blue, Rectangle[]}], RegionPlot[R, PlotStyle -> Opacity[.5, Red]], PlotRange -> All, Frame -> True, FrameTicks -> ...


1

No good news i'm afraid. The same response is shown for Version 12.0. Assuming they didn't fix it just to break it, the intervening versions are probably bad as well. If you have defined the functions in an initialization cell and auto-save the ".m" file, this file extension is set up to use plain text search. This is the method i use. Otherwise, you ...


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