2
$\begingroup$

I am specifying a general two-dimensional density matrix:

ρ1 = {{Abs[α]^2, α*Conjugate[β]}, {Conjugate[α]*β, Abs[β]^2}};

I want Mathematica to recognise that the trace of the above matrix is 1. How do I specify a global assumption for this? I tried looking up the appropriate syntax of $Assumptions, but could not find anything useful.

$\endgroup$

1 Answer 1

3
$\begingroup$

If the density matrix is defined as

m[a_, b_] := {{Abs[a]^2, a Conjugate[b]}, {Conjugate[a] b, Abs[b]^2}}

then it is possible to define an UpValue for symbol m, using UpSetDelayed:

Trace[m[a_, b_]] ^:= 1

Now, simply evaluating

Trace[m[a,b]]

produces

1

Also, evaluating something like 3.1 Trace[m[x,y]] + 0.1 evaluates to 3.2 as expected.

$\endgroup$
2
  • $\begingroup$ Thanks! I had one more doubt. In case I specify the normalisation condition directly Abs[a]^2+Abs[b]^2 ^:=1, Mathematica gives a message which says that tag power is protected. Why does this happen? $\endgroup$
    – Fibonacci
    Jan 2, 2018 at 14:05
  • $\begingroup$ assuming h[x] stands for a valid expression in x, f[x_]:=h[x] associates the rhs with the symbol f (see DownValues); on the other hand, f[g[x_]]^:=h[x] associates h[x] with symbol g (not f as one might expect-that's an UpValue for g); evaluate Abs[a]^2 + Abs[b]^2 // FullForm; verify that Power is placed where g is in the example above; Power has attribute Protected which doesn't allow altering the rules defined for it; usingTrace might be a better choice $\endgroup$
    – user42582
    Jan 2, 2018 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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