Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Symbolic replacement of scalar products

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120073] Re: Symbolic replacement of scalar products
  • From: "Scot T. Martin" <smartin at seas.harvard.edu>
  • Date: Thu, 7 Jul 2011 07:33:48 -0400 (EDT)
  • References: <201107060940.FAA29437@smc.vnet.net>

Giuseppe,

Your email is fairly general, so I think the response you get will be fairly general. Along those lines of general responses, explore pattern matching using the full form:

Times[....] instead of "*"

Also, have a look as necessary at Verbatim[....] to get the effects you need.

If you post your exact code snippet that highlights your challenge, you'll probably get more specific responses from the MathGroup.

Scot
________________________________________
From: Giuseppe [juseppe78 at gmail.com]
Sent: Wednesday, July 06, 2011 05:40
To: mathgroup at smc.vnet.net
Subject: [mg120073] Symbolic replacement of scalar products

Hello,

I have very complicated expressions containing scalar products like

a1*b1 + a2*b2 + a3*b3

In order to reduce the complexity, I would like to establish a set of rules like

rule={a1*b1 + a2*b2 + a3*b3 -> pAB, ...}

in order to replace each time the scalar product by an appropriate new symbol (pAB in the example).
The problem is that, apparently, Mathematica does not perform the substitution if in the expression the scalar products appear together with some multiplying factor; for example Mathematica fails to apply the previous rule if the expression is

-a1*b1 - a2*b2 - a3*b3

or

2a1*b1 + 2a2*b2 + 2a3*b3

How could solve this problem?



  • Prev by Date: Re: How can I get better solution for this...?
  • Next by Date: Re: Numerical accuracy/precision - this is a bug or a feature?
  • Previous by thread: Re: Symbolic replacement of scalar products
  • Next by thread: Re: Symbolic replacement of scalar products