Re: Simplifying with KroneckerDelta
- To: mathgroup at smc.vnet.net
- Subject: [mg101465] Re: [mg101426] Simplifying with KroneckerDelta
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 8 Jul 2009 07:09:16 -0400 (EDT)
- References: <1551538.1246958483039.JavaMail.root@n11> <002701c9fef8$2e446ab0$8acd4010$@net> <22328692.1246984359264.JavaMail.root@n11>
Hello Francisco, I'm not really an expert in whatever subtleties there might be in using the KroneckerDelta, or what some built-in Mathematica routines might do with it. But you could write your own routine for simplifications along the following line. SimplifyKroneckerDelta::usage = "SimplifyKroneckerDelta[expr] will simplify expressions of factor \ KroneckerDelta[a,b] by using a -> b in factor."; SimplifyKroneckerDelta[expr_] := expr /. factor_ KroneckerDelta[a_, b_] :> Module[{work = factor}, work = work /. a -> b; Simplify[work] KroneckerDelta[a, b]] Exp[a - b] KroneckerDelta[a, b] // SimplifyKroneckerDelta KroneckerDelta[a, b] I wrote the routine in a rather step-by-step manner because maybe you would want to use other rules or tests or specific types of simplification on the resulting factor expression =96 depending on what you have. Or maybe you would want several forms of the top level rule, each with its own Module steps. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Francisco Rojas Fern=E1ndez [mailto:fjrojas at gmail.com] Thanks. That helps, but maybe I should have been more specfic because I actually have long and more involved expressions. What would be really useful for me in this case would be a replacement rule like this: krule = f[b_] KroneckerDelta[a_, b_] -> f[a] KroneckerDelta[a, b] where f[ ] is any function. For example, if I had an expression like: Exp[a-b] KroneckerDelta[a,b] I would like Mathematica to give me Exp[0] KroneckerDelta[a,b] which after simplifying of course it's just KroneckerDelta[a,b] Is there anyway I can do this? I tried some ways but they didn't work (maybe writing f[b_] is not the right way?) Thanks in advance again for your help. -Francsico On Tue, Jul 7, 2009 at 7:43 AM, David Park <djmpark at comcast.net> wrote: Why not use a rule? krule = b_ KroneckerDelta[a_, b_] -> a KroneckerDelta[a, b] (m + n) KroneckerDelta[k, m + n] /. Krule k KroneckerDelta[k, m + n] But the real work might be if you have a sum before the KroneckerDelta that only includes m + n as sub-terms. You could write a routine that collected on the KroneckerDelta forms, then wrapped Hold around the m+n sub-terms (both places), then applied the rule and released the Hold. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ <http://home.comcast.net/%7Edjmpark/> From: frojasf [mailto:fjrojas at gmail.com] Hello, Does anybody know how to tell mathematica to use the KroneckerDelta in order to simplify expressions? For example, it would be great if it could receive something like this: (m+n) KroneckerDelta[k,m+n] and give k KroneckerDelta[k,m+n] Of course this is simple example, but I have an expression which is about 200 terms long, so if it could use the delta to simplify things by itself, that would be great. Thanks to all in advance, Francisco -- View this message in context: http://www.nabble.com/Simplifying-with-KroneckerDelta-tp24362541p24362541.ht <http://www.nabble.com/Simplifying-with-KroneckerDelta-tp24362541p24362541.h t%0Aml> ml Sent from the MathGroup mailing list archive at Nabble.com.