Tag Info

New answers tagged

4

Example using vector notation: s = NDSolve[{m'[t] == Cross[m[t], {0, 0, 1}], m[0] == {0, 1, 0}}, m, {t, 0, 1}] Plot[Evaluate[m[t] /. s], {t, 0, 1}] s = NDSolve[{m'[t] == Cross[m[t], {Cos@t, Sin@t, 1}], m[0] == {1, 1, 0}}, m, {t, 0, 10}]; ParametricPlot3D[m[t] /. s, {t, 0, 10}]


1

If you take the problematic plot and normalize the arrows dimensions by brute force, the issue becomes clear! plot = (* copy-paste Manipulate's graphic *) Reap[plot /. Arrow[pts : {pt0 : {__}, {__}}] :> Sow[Line[{pt0, pt0 + .2 Normalize@First@Differences@pts}]]]; Graphics@%[[2, 1]] %%[[1]] The vectors are correct, but then displayed ...


1

grad = Grad[x^2 - y^2, {x, y}]; VectorPlot[{grad[[2]], -grad[[1]]}, {x, -2, 2}, {y, -2, 2}] grad2 = Grad[Sin[x] Sin[y], {x, y}]; VectorPlot[{grad2[[2]], -grad2[[1]]}, {x, -2, 2}, {y, -2, 2}]


1

You might formulate a list of rules that take into account the existing relations, such as the following. Assume there are 2 known relations p1.p2=mand p1.q1=s. The rules are as follows: rules = {p1.p2 -> m, p2.p1 -> m, p1.q1 -> s, q1.p1 -> s}; Their application is straightforard: 2 (p1.q1) (p3.p2) + (p1.p2)^2 /. rules (* m^2 + 2 s ...


3

How about this? {Slider[Dynamic[a], {0, 10, 1}], Dynamic[a]} Dynamic[u = {a, a + 1}] Dynamic[u[[1]] + u[[2]]] Edit Regarding Kuba's comment So is pure code an educational answer then? No, of course it is not and most of my answers reflect that I care about this. Let me make some extensions to my answer by going through your examples and ...



Top 50 recent answers are included