Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3555 > unrolled thread
| Started by | "Scot T. Martin" <smartin@seas.harvard.edu> |
|---|---|
| First post | 2011-07-07 11:46 +0000 |
| Last post | 2011-07-07 11:46 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Symbolic replacement of scalar products "Scot T. Martin" <smartin@seas.harvard.edu> - 2011-07-07 11:46 +0000
| From | "Scot T. Martin" <smartin@seas.harvard.edu> |
|---|---|
| Date | 2011-07-07 11:46 +0000 |
| Subject | Re: Symbolic replacement of scalar products |
| Message-ID | <iv469t$fb2$1@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@gmail.com]
Sent: Wednesday, July 06, 2011 05:40
Subject: 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?
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web