Einstein Notation applied in programming
1–10 of 28 posts
Re: Einstein Notation applied in programming
#2I use this regularly in Matlisp: https://github.com/matlisp/matlisp/wiki
Re: Einstein Notation applied in programming
#3Re: Einstein Notation applied in programming
#4http://docs.scipy.org/doc/numpy/reference/generated/numpy.ei...
Re: Einstein Notation applied in programming
#5You might want to express the cross product using the Levi-Civita symbol epsilon_{ijk} [1].
epsilon_{ijk} = 1 for i,j,k = 1,2,3 and all even permutations thereof. epsilon_{ijk} = -1 for all odd permutations of i,j,k = 1,2,3. Else it is 0.
Then, the cross product reduces to: C_i = epsilon_{ijk} A_j B_k
Using identities for epsilon_{ijk} you can – for example – easily calculate what A cross (B cross C) is.
Re: Einstein Notation applied in programming
#6I've never seen a cross product being defined in that way using Einstein notation. You might want to express the cross product using the Levi-Civita symbol epsilon_{ijk} [1]. epsilon_{ijk} = 1 for i,j,k = 1,2,3 and all even permutations thereof. epsilon_{ijk} = -1 for all odd permutations of i,j,k = 1,2,3. Else it is 0. Then, the cross product reduces to: C_i = epsilon_{ijk} A_j B_k Using identities for epsilon_{ijk}…
In fact, I can't understand this use of the notation—namely,
C_i = A_{i + 1 `mod` 3}B_{i + 2 `mod` 3}
—and am not sure that it's correct. There is no free variable on the right-hand side, so I'm not sure over what to sum. Even if this were fixed, we'd need something like, as you say, the Levi–Civita symbol, since a given entry of the cross product is not a sum but a difference.Re: Einstein Notation applied in programming
#7I've never seen a cross product being defined in that way using Einstein notation. You might want to express the cross product using the Levi-Civita symbol epsilon_{ijk} [1]. epsilon_{ijk} = 1 for i,j,k = 1,2,3 and all even permutations thereof. epsilon_{ijk} = -1 for all odd permutations of i,j,k = 1,2,3. Else it is 0. Then, the cross product reduces to: C_i = epsilon_{ijk} A_j B_k Using identities for epsilon_{ijk}…
> I've never seen a cross product being defined in that way using Einstein notation. In fact, I can't understand this use of the notation—namely, C_i = A_{i + 1 `mod` 3}B_{i + 2 `mod` 3} —and am not sure that it's correct. There is no free variable on the right-hand side, so I'm not sure over what to sum. Even if this were fixed, we'd need something like, as you say, the Levi–Civita symbol, since a given entry of the…
But as you stated, the cross product is clearly wrong as given by the author. There's obviously no other way than defining it with a totally antisymmetric quantity like the Levi-Civita symbol.
Re: Einstein Notation applied in programming
#8Re: Einstein Notation applied in programming
#9Been a while since GR, but I'm pretty sure some of those indices are supposed to be on top. A_{ij} = B_i^k * C_{jk} possibly, but don't quote me on that.