Mathematica symbolic equation simplifcation

  • Mathematica
  • Thread starter Steve Drake
  • Start date
  • Tags
    Mathematica
In summary, the conversation discusses the use of symbolic substitution in Mathematica to simplify an integration answer. It is noted that Mathematica does not do "common sense mathematical substitution" but rather "structural substitution." Various examples and patterns are provided to demonstrate the limitations and difficulties in achieving "mathematical substitution" in general. The advice is given to look at the FullForm of the target to better understand the structural form and to experiment until a working solution is found.
  • #1
Steve Drake
53
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
  • #2
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:

1. What is Mathematica symbolic equation simplification?

Mathematica symbolic equation simplification is a process of manipulating mathematical equations using symbolic representations instead of numerical values. This allows for more general and flexible solutions to equations.

2. How does Mathematica simplify equations?

Mathematica uses a variety of algorithms and rules to simplify equations, such as simplifying fractions, factoring polynomials, and applying trigonometric identities. It also uses user-defined rules and assumptions to simplify equations according to specific criteria.

3. Can Mathematica solve all types of equations?

No, Mathematica is not capable of solving all types of equations. It is most effective at simplifying algebraic, trigonometric, and exponential equations. However, it may struggle with more complex equations or those that require advanced mathematical knowledge.

4. How accurate is Mathematica's simplification process?

Mathematica's simplification process is highly accurate, as it uses precise algorithms and rules to simplify equations. However, it is always recommended to double-check the results and make sure they align with your expectations and assumptions.

5. Can I customize Mathematica's simplification process?

Yes, Mathematica allows for customization of the simplification process through user-defined rules and assumptions. This can help tailor the simplification to specific needs and criteria, resulting in more accurate and relevant solutions.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
256
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
216
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
5K
Back
Top