Symbolic replacement of scalar products

  • Thread starter Jusepè
  • Start date
  • Tags
    Scalar
In summary, the problem with replacing scalar products in expressions with appropriate new symbols is that Mathematica does not always perform the substitution. If the expression includes a multiplying factor together with the scalar products, then the substitution does not work. There are a few patterns that might be needed in order to match the FullForm that Mathematica produces.
  • #1
Jusepè
2
0
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?
 
Physics news on Phys.org
  • #2
Some things within Mathematica "understand mathematics", they have a lot of programming hiding in the background that simulates common sense math.

Replacement rules specifically document that they do not do this. They work on the raw underlying, often hidden, form of the expressions.

Usually a helpful technique for getting more complicate patterns to work when you don't have a lot of experience to be able to guess what to do is to look at

FullForm[-a1*b1 - a2*b2 - a3*b3]

and see what it is that Mathematica is going to match. Then you can sometimes write a pattern that will match that FullForm.

So for example in your case, perhaps one or perhaps two patterns might be needed, one that includes a positive scale factor in front of all the terms and possibly a second that includes a negative scale factor, if the FullForm shows you that your expression with minus signs is really different from the one with a plus sign. Look at FullForm[x*y] and then FullForm[x/y] if you want to see a hint of how different the internal form can be.

So, just to give you an idea, you might want a rule something in the direction of

x_*a1*b1 + x_*a2*b2 + x_*a3*b3 -> pAB
or possibly
x_*a1*b1 + x_*a2*b2 + x_*a3*b3 -> x*pAB

That is trying to match all your ai*bi when multiplied by the same scale factor named x.

See if this description makes sense and try it on a few simple examples first.

Over the years pattern matching has been a source of confusion and problems for users. There has been some interest in pattern matching that would understand mathematics or that would overcome some of the problems people have, but it seems that this has never been accepted.
 

Related to Symbolic replacement of scalar products

1. What is "symbolic replacement of scalar products"?

The symbolic replacement of scalar products is a mathematical process used in physics and other scientific fields to simplify and manipulate equations involving dot or inner products of vectors. It involves replacing the dot product with a new symbol and applying algebraic rules to simplify the equation.

2. Why is symbolic replacement of scalar products useful?

This technique allows for the manipulation of equations involving dot products without having to explicitly calculate the dot product. It can also help to simplify and solve complex equations more efficiently.

3. What are some common symbols used in symbolic replacement of scalar products?

The most commonly used symbols for dot products are the centered dot (·), the asterisk (*), and the colon (:). Other symbols, such as the diamond (⋅) and the triangle (∙), may also be used.

4. Can symbolic replacement of scalar products be applied to any type of vector?

Yes, this technique can be applied to any type of vector, including Cartesian, polar, and complex vectors.

5. Are there any limitations or drawbacks to using symbolic replacement of scalar products?

One limitation is that it may not always result in a simpler equation, as it depends on the complexity of the original equation. In addition, this technique may not be suitable for certain equations that involve cross products or other vector operations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
5K
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Precalculus Mathematics Homework Help
Replies
10
Views
3K
  • Calculus and Beyond Homework Help
Replies
1
Views
5K
  • Calculus and Beyond Homework Help
Replies
3
Views
7K
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
1K
Replies
1
Views
1K
Back
Top