Skip to main content
1 of 4
Ophion
  • 187
  • 5

Replacing values of a function

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 does applies commutator logic to a sequence of creation and annihilation operators to produce a string of Kronecker delta's. 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.

EG

(* KD[a,b] is a Kronecker delta with indices a and b. *) (* KD Attributes: Orderless,NumericFunction *) (* A[{x},{y}] is an operator with*) 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.

Ophion
  • 187
  • 5