1
$\begingroup$

I'm struggling a little bit trying to understand how to address this problem, I would like to do this in mathematica: problem 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!

$\endgroup$
4
  • 3
    $\begingroup$ I don't understand what it's supposed to represent but maybe UnitVector[1] and UnitVector[2]? Or UnitVector[3, 1] etc. $\endgroup$ Commented May 10, 2021 at 4:43
  • 2
    $\begingroup$ 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$ Commented May 10, 2021 at 5:50
  • $\begingroup$ @LouisB Post it as an answer? $\endgroup$ Commented May 10, 2021 at 14:19
  • $\begingroup$ Guys thank you for all your help,@LouisB solution was easy and simple, thanks a lot. $\endgroup$ Commented May 10, 2021 at 22:47

1 Answer 1

1
$\begingroup$

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 

enter image description here

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 

enter image description here

$\endgroup$
1
  • $\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$ Commented May 10, 2021 at 22:50

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.