Mathematica symbolic equation simplifcation

  • Context: Mathematica 
  • Thread starter Thread starter Steve Drake
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary
SUMMARY

This discussion focuses on symbolic equation simplification in Mathematica, specifically using the FullSimplify function and substitution patterns. Users can define substitutions, such as A = b*x*t, to simplify expressions, but Mathematica's substitution mechanism relies on structural matching rather than intuitive mathematical reasoning. The discussion highlights the limitations of Mathematica's pattern matching capabilities and suggests that users may need to create complex patterns for effective substitutions. It also mentions a historical tool called Semantica that aimed to enhance mathematical substitution but has not been integrated into recent versions of Mathematica.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of symbolic computation concepts
  • Knowledge of pattern matching in Mathematica
  • Basic experience with mathematical substitutions
NEXT STEPS
  • Explore advanced pattern matching techniques in Mathematica
  • Learn about the FullForm function for analyzing expression structures
  • Investigate the historical context and functionality of Semantica
  • Study examples of complex substitutions in Mathematica
USEFUL FOR

Mathematica users, mathematicians, and researchers looking to enhance their skills in symbolic computation and equation simplification.

Steve Drake
Messages
53
Reaction score
1
Hi Guys,

I am new to mathematica. I have gotten it to do an integration for me, then simplified the answer using FullSimplify.

It does a very good job, but I can see that a futher symbolic substitution would make it even nicer, e.g. I would like to define A = b*x*t. So where ever there is b*x*t in the answer it puts in A, or if there is b^2*x^2*a^2 it puts in A^2.

Is there any way to do that?

Thanks
 
Physics news on Phys.org
Simple substitution will work here

In[1]:= 4*b*c*t*x/y/.b*x*t->A

Out[1]= 4 A c/y

Note that does some commutative rearrangement and can sidestep uninvolved variables in this example. But that simple substitution fails if you make other small obvious changes.

In[2]:= 4*b^2*c*t^2*x^2/y/.b*x*t->A

Out[2]= 4 b^2 c t^2 x^2/y

This is because Mathematica does not do "common sense mathematical substitution" but rather does "structural substitution"="brute force mindless does the pattern match (almost) exactly or not" substitution.

Ten or twenty years ago someone wrote an example pattern matcher in Mathematica, called Semantica I believe, which demonstrated "mathematical substitution." That has been uniformly resisted and I don't believe anything in that was adopted or incorporated into Mathematica in the last ten or twenty years.

Or if you have a simple problem then you can write a different pattern.

In[3]:= 4*b^2*c*t^2*x^2/y/.b^e_*x^e_*t^e_->A^e

Out[3]= 4 A^2 c/y

And that fails here

In[4]:= 4*b^2*c*t^2*x^3/y/.b^e_*x^e_*t^e_->A^e

Out[4]= 4 b^2 c t^2 x^3/y

Or you can write a more complicated pattern

In[5]:= 4*b^2*c*t^3*x^4/y/.b^p_*x^q_*t^r_ ->A^Min[p,q,r]*b^(p-Min[p,q,r])*x^(q-Min[p,q,r]) *t^(r-Min[p,q,r])

Out[5]= 4 A^2 c t x^2/y

And that will fail if you think a few moments and come up with other examples to confound it.

Unfortunately, every new user and most typically modestly skilled pattern writers, myself included, are not up to writing the sort of patterns really needed to implement "mathematical substitution" in general.

Usually good advice: If you just cannot figure out why a pattern doesn't match then look at the FullForm of your target. Sometimes using that to see the "structural form" that you are trying to write a pattern for will help. If that isn't enough then use random fumbling around until somehow it works or until you just give up.
 
Last edited:

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K