New answers tagged

4

There is definitely something wrong here. The alternative form of the third derivative would be to do three successive differentiations on the same object. The result in that approach is correct: D[y[t], t, t, t] // MatrixForm $$\left( \begin{array}{c} y_1{}^{(3)}(t) \\ y_2{}^{(3)}(t) \\ y_3{}^{(3)}(t) \\ y_4{}^{(3)}(t) \\ y_5{}^{(3)}(t) \\ ...


4

Here's a fast way if you have general values, like @ciao's: SeedRandom[0]; sa = SparseArray[(# -> RandomChoice[Join[{x^2 + y^2, x^3}, Range@200]]) & /@ RandomInteger[{1, 2000}, {4000, 2}]]; Extract[sa["NonzeroPositions"], Position[sa["NonzeroValues"], x^2 + y^2, 1]] // RepeatedTiming {0.00015, {{22, 1644}, {165, 37}, {207, 910}, {332, ...


0

This is unlikely to be efficient, due to the Complement, and it's quite possible that the very first operation we do on the array "unpacks" it, but here's one possibility. Let's suppose we have a sample array, array = SparseArray@RandomInteger[{0, 5}, {10, 10}]; array // MatrixForm We set a new background for this SparseArray by doing array1 = ...



Top 50 recent answers are included