Given an expression

$\chi\,=\,C_{p1}\,\left[ h\,e^{- i\,p1.\,x}\,\, +\,\,h^{\dagger}\,e^{+i\,p1\,.\,x}\right]$

where $p1$ and $x$ are four-vectors; $C_{p1} = \ \frac{1}{\sqrt{(2 \pi)^3} \sqrt{2 \omega\,(p1,\ m)}}$, and $x\ .\ p1\ =\omega(p_1,m)\,t\ - {\vec p1} {\vec x}$

Please note that "$x$" and "$\chi$" are different variables. $x$ is a 4-vector, the components of which are $t$, and the three components of $\vec {x}$. Similarly, $p1$ is a 4-vector with components $\omega(p_1,m)$ and the three components of $\vec p1$.

How does one teach Mathematica to do things like gradient of $\chi $, $\partial_{t} \chi$, product of $\chi$ i.e. $\chi^2$ etc. but not have to explicitly have to type the full form of the four vectors - in the subsequent input and results of evaluations?

For the product of $\chi$s, it would be great if the variables could be programmed such that the first $\chi$ would take $p1$ and $x1$ as arguments, the second $\chi$ - $p2$ and $x2$ etc.

  • 1
    $\begingroup$ Dot, D....? $\endgroup$ – Michael E2 Jan 16 '17 at 1:39
  • $\begingroup$ $\chi\ . \chi$ - meant to express $\chi^2$, where the first instance of $\chi$ would contain $p1$ as the 4-vector (i.e. $\omega(p1, m$, $\vec p1$ etc.), the second instance of $\chi$ would have $p2$ as the 4-vector etc. $\endgroup$ – arny Jan 16 '17 at 5:07
  • $\begingroup$ You would have to teach us how to do these things before we can give you any advice on how to implement it. $\endgroup$ – Kiro Jan 16 '17 at 6:12
  • $\begingroup$ Well, $p1\cdot\chi$ would be p1.chi, short for Dot[p1, chi], as explained in the docs. D computes partial derivatives and gradients. If you have trouble implementing these in your code, I think we'll need to see the code to give help. $\endgroup$ – Michael E2 Jan 16 '17 at 11:23
  • $\begingroup$ It's not $p1 . \chi$, $x$ and $\chi$ are different variables. $\endgroup$ – arny Jan 16 '17 at 14:54

Maybe this will get you started?

χ[t_, x_] = cp1 (h Exp[-I (t ω + x p)] + hDag Exp[I (t ω + x p)])


D[χ[t,x], t]
(*   cp1 (-I E^(-I (p x + t ω)) h ω + I E^(I (p x + t ω)) hDag ω)   *)


D[χ[t,x], t]
(*   cp1 (-I E^(-I (p x + t ω)) h p + I E^(I (p x + t ω)) hDag p)  *)
  • $\begingroup$ Thank you QuantumDot, yes this works. Is there a way to state that x consists of 4 components that behave or transform like a vector? I understand that there are packages out there like xact, but without such a package. $\endgroup$ – arny Jan 18 '17 at 4:27
  • $\begingroup$ I'm afraid there's no quick way to achieve what you want. You'll need to write some code to get it done. For example, you can use Indexed[x,μ] to represent a generic four-vector x with index μ. Then you'll need to define your own differentiation $\partial x_\mu/\partial x_\nu = \delta_{\mu\nu}$ like this MyGradient[Indexed[x_,mu_],Indexed[x_,nu_]] := Indexed[δ,{mu,nu}]. A lot more work is needed because you'll have to also include standard rules of differentiation, and define how $\delta_{\mu\nu}$ works. Then you'll want to define dot product, and differentiation rules... $\endgroup$ – QuantumDot Jan 18 '17 at 4:38
  • $\begingroup$ @suman_b see my comment above. Also, what exactly do you want to achieve. What sort of calculations do you ultimately want to do? $\endgroup$ – QuantumDot Jan 18 '17 at 18:45
  • $\begingroup$ Thanks QuantumDot. Yes, I need to do the calculations / program similar to the ones you stated. I tried using FeynCalc package, but the following didn't work out: p1 :=FourVector[ $\omega$[p1,m], m] x := FourVector[t,r], Chi: = Integrate[C[p1] (h[p1] e$^{-I p1 x}$ + h$^{\dagger}$[p1] E$^{I p1 x}$, d$\vec{p1}$ p1 = ( $\omega$[p1, m]*t, $\vec{p1}$) and x = (t, $\vec{x}$). $\endgroup$ – arny Jan 18 '17 at 19:15
  • $\begingroup$ @suman_b Recall that Integrate is a top-level built-in Mathematica package, so you cannot expect any 3rd party packages to teach it how to work with objects native to that package (like FourVector). You'll need to write your own rules for that. Couple questions: are you fairly new to Mathematica? Are you also somewhat new to physics? My suggestion is for you to do these calculations by hand, unless you're doing a heavy-duty research-level project that necessitates computer algebra. $\endgroup$ – QuantumDot Jan 18 '17 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.