New answers tagged

2

A straightforward way to implement Kronecker Delta is as follows: SetAttributes[\[Delta], Orderless]; \[Delta][a_, b_] f_[c___, b_, d__] ^:= f[c, a, d] /; ! NumericQ[b]; \[Delta][a_, a_] := dim /; ! NumericQ[a]; \[Delta][a_, b_] := Boole[a == b] /; NumericQ[a] && NumericQ[b]; Format[\[Delta][a_, b_]] := Subscript[\[Delta], a, b]; where dim is the ...


2

Try this: Subscript[δ, i_, j_] := KroneckerDelta[i, j]; ruleDelta = KroneckerDelta[1, i_] KroneckerDelta[1, k_] + KroneckerDelta[2, i_] KroneckerDelta[2, k_] + KroneckerDelta[3, i_] KroneckerDelta[3, k_] -> Subscript[δ, i, k] On your screen it looks as follows: Then Sum[Subscript[δ, i, j]*Subscript[δ, j, k], {j, 1,3}] /. ...


3

As an example, you could write this quite literally eqn = {-1, -1, -1} < {3, 4, 5} + α {5, 6, 7} < {1, 1, 1} (* {-1, -1, -1} < {3 + 5 α, 4 + 6 α, 5 + 7 α} < {1, 1, 1} *) Reduce[Thread[eqn], α] (* -(4/5) < α < -(4/7) *) If your inequalities are infeasible, you will need to decide how you would define a "best" solution.


5

As far as I know, cross product is unique for 3D vectors. Pad 0s to the vectors as their 3rd components before crossing them Cross[{a, b, 0}, {c, d + e, 0}] {0, 0, -b c + a d + a e} and one can take the 3rd component of the result. Update One can also use TensorWedge without padding TensorWedge[{a, b}, {c, d + e}][[1, 2]]


7

Create a mesh mesh[θ_,n_]:=Table[{Cos[ϕ] Sin[θ],Sin[ϕ] Sin[θ],Cos[θ]},{ϕ,π/n,2 π,(2 π)/n}]; p={{0,1},{π/6,6},{2π/6,9},{3π/6,12},{4π/6,9},{5π/6,6},{π,1}}; points=Join[Flatten[mesh[#[[1]],#[[2]]]&/@p,1]]; There are 7 θ-slices: {0, π/6, 2π/6, 3π/6, 4π/6, 5π/6, π}. The number of ϕ-points in each slice is different for esthetic reasons. p contains data of ...


6

You can actually use a built-in function called SliceVectorPlot3D: SliceVectorPlot3D[{y, -x, z}, "CenterSphere", {x, -2, 2}, {y, -2, 2}, {z, -2, 2}] to get:


3

Just for the records: This is how I would write the code. At least the loading of data is now optimized for minimizing communication overhead. stocks7 = {"GOOG", "FB", "AMZN", "NFLX", "AAPL", "MSFT", "TSLA"}; n = Length[stocks7]; α = {2015, 1, 1}; β = {2017, 12, 31}; data0 = FinancialData[stocks7, "Close", {α, β}]; data = Developer`ToPackedArray[...


1

If you want reals, then try plots as VectorPlot[{1, 3*CubeRoot[y^2]}, {x, -8, 3}, {y, -3, 4}, Axes -> True, AspectRatio -> Automatic] and StreamPlot[{1, 3*CubeRoot[y^2]}, {x, -8, 3}, {y, -3, 4}, Axes -> True, AspectRatio -> Automatic] They then match.


7

Slightly awkward, but certainly possible: Assuming[v ∈ Vectors[n, Reals], Integrate[TensorExpand[a Sin[Norm[a v]]/Norm[a v]], {a, 0, 1}]] (1 - Cos[Norm[v]])/Norm[v]^2


3

I found that you missed the SetDelayed. v[a_, b_] := {a, b} If you evaluate v[1, 2], you could get {1, 2}.


1

I was wrong in the comments, since you have an analytical expression for θ, there is no need for an InterpolationFunction. f[y_, θ_] = 2 y Cos[θ] + 4 y^2 (1 - 3 Cos[θ]); gradf[y_, θ_] = Grad[f[y, θ], {y, θ}]; v0 = f[y, θ]/gradf[y, θ]; There was a typo, the Cos didn't have brackets in the first line, also I added v0 to save the evaluated expression before ...


Top 50 recent answers are included