I'm struggling a little bit trying to understand how to address this problem, I would like to do this in mathematica:
is just that I don't know how to do the dot product between $\mathbf{J}$ and $\mathbf{a}_y$ because I don't know how to define the unit vector $\mathbf{a}_y$, is it possible to do this in mathematica? thanks in advance!
$\begingroup$ $\endgroup$
4 1 Answer
$\begingroup$ $\endgroup$
1 As shown by LouisB in the comment, use coordinate vector is the standard way to go, nevertheless, it's possible to implement the symbolic coordinate bases as follows:
Clear[Subscript] Subscript /: Subscript[a, x_]^2 = 1; Subscript /: Subscript[a, x_] Subscript[a, y_] /; x =!= y = 0; Subscript[a_, b : x | y | z] := Subscript[a, ToString@b] J = -10^4 (Subscript[a, x] Sin[2 x] E^(-2 y) + Subscript[a, y] Cos[2 x] E^(-2 y)) 10^3 Integrate[J Subscript[a, y] /. y -> 1, {z, 0, 2}, {x, 0, 1}] // N Or more rigorously:
Clear[Subscript] Subscript /: Subscript[a, x_].Subscript[a, x_] = 1; Subscript /: Subscript[a, x_].Subscript[a, y_] = 0; Subscript[a_, b : x | y | z] := Subscript[a, ToString@b] J = -10^4 (Subscript[a, x] Sin[2 x] E^(-2 y) + Subscript[a, y] Cos[2 x] E^(-2 y)) 10^3 Integrate[J.Subscript[a, y] /. y -> 1 // TensorExpand, {z, 0, 2}, {x, 0, 1}] // N - $\begingroup$ Thank you very much for your help @xzczd, in your code there are some things I still don't understand because I'm new using Mathematica but I will research and try to learn more, thank you for helping me out! $\endgroup$diegosanchez– diegosanchez2021-05-10 22:50:18 +00:00Commented May 10, 2021 at 22:50


UnitVector[1]andUnitVector[2]? OrUnitVector[3, 1]etc. $\endgroup$ax = {1, 0, 0}; ay = {0, 1, 0};j = -10^4 Exp[-2 y] (Sin[2 x] ax + Cos[2 x] ay);Integrate[j.ay /. y -> 1, {z, 0, 2}, {x, 0, 1}] // N$\endgroup$