I have recently starting using Mathematica and have recently come to what seems as an impasse in my understanding of the language. If this is too "tell me how to do it" I would certainly understand.
I have written a program that applies commutator logic to a sequence of creation and annihilation operators to produce a string of Kronecker deltas. I then need to apply the Kronecker delta restrictions to my operators. This is purely symbolic algebra, no real numbers need be produced at the end of the day.
For example,
(* KD[a,b] is a Kronecker delta with indices a and b. *)
(* KD Attributes: Orderless,NumericFunction *)
(* A[{x},{y}] is an operator with creation indices x and annihilation indices y*)
In:
A[{x},{y}] (KD[x,a1]*KD[y,a2]-KD[x,b1]*KD[y,b2])
Out:
A[{a1},{a2}]-A[{b1},{b2}]
What I have so far:
In:
rules=torules[(KD[x,a1]*KD[y,a2]]
A[{x},{y}]/.rules
Out:
{x->a1,y->a2}
A[{a1},{a2}]
This, however, is not quite what I need and converting from KD's to the rules list seems overly complicated. The main issues with this is that I cannot generate operator expressions that have plus within them. The structure of KD is not easily changed, but the input of the operator expressions is quite flexible.
Another take on this, I am not sure if it will help, but its my current direction.
In:
SetAttributes[A, NumericFunciton]
A[{x},{y}] (KD[x,a1]*KD[y,a2]-KD[x,b1]*KD[y,b2])
Out:
A[{x},{y}]*KD[x,a1]*KD[y,a2]- A[{x},{y}]*KD[x,b1]*KD[y,b2]
This should be a fairly simple replacement pattern, but I cannot get any further.
KD[x,a]
withDiracDelta[x-a]
and then justIntegrate
over{x,-Infinity,Infinity}
. $\endgroup$KD[x,a1]
. The formalism is designed so that you will not have these issues. (2)It does not exist, I was trying to supply at least something that I thought of. $\endgroup$Integrate
is symbolic. Perhaps you are thinking ofNIntegrate
? Try evaluating this to see what I mean:Integrate[ A[x, y] DiracDelta[x - a] DiracDelta[y - b], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, Assumptions -> {a, b} [Element] Reals]
$\endgroup$