[Mathematica] Simplify can't handle this trivial example

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 4K views
GargleBlast42
Messages
28
Reaction score
0
Hi everyone,

I'm wondering why Mathematica (8.0) can't bring this to the obvious form -1, and leaves the expression as is:
Code:
Simplify[(b^8 + c^4) /a^8, a^8 + b^8 + c^4 == 0]
Is there any nice and elegant way how to achieve that?

(I know, that I could take e.g. /.c->(-a^8-b^8)^(1/4), but I'd like Mathematica to do it just by using the equation).
 
Physics news on Phys.org
The obvious form is not always correct, for example, when a=0. Also, simplify works better with equations than with expressions. You can get it to work using

Simplify[(b^8 + c^4)/a^8 == k, {a^8 + b^8 + c^4 == 0, a^8 != 0}]

or if you want to allow for the case that a=0

Reduce[{(b^8 + c^4)/a^8 == k, a^8 + b^8 + c^4 == 0}]
 
Thanks, your solution works, but it still has a problem - it only seems working when I take the expression in an equation. But I want to simplify solely the expression (b^8 + c^4)/a^8 without putting it into an equation.
 
It seems like what you would like to have happen is for Mathematica to automatically recognize that it should replace a^8 by -(b^8+c^4). So I try this:

(b^8+c^4)/a^8 /. a^8 -> -(b^8+c^4)

and it just returns (b^8 + c^4)/a^8 unchanged. What went wrong?

FullForm[(b^8 + c^4)/a^8] shows Times[Power[a, -8], Plus[Power[b, 8], Power[c, 4]]]
and Power[a,8] is not going to match Power[a,-8] so the pattern matcher finds no matches, replaces nothing and returns the original.

Manually this can be fixed, try substituting for a^-8 by taking reciprocals.

(b^8+c^4)/a^8 /. a^-8 -> -1/(b^8+c^4)

returns -1 as I think you wish.

There have been raging arguments for a couple of decades over whether the pattern matching in Mathematica is just fine and perfectly correct the way it is or whether it is sometimes wrong or inconvenient and could or should be changed. Feel free to search the archives of comp.soft-sys.math.mathematica for decades of postings, some of which include the arguments and most puzzling examples of such behavior. But it appears that none of those arguments have ever resulted in a single change in the pattern matcher.

Unfortunately there is no DoWhatIMean button that when clicked will do what is "obviously mathematically correct" in every case and give you the answer you want. Mathematica, like almost all complex software tools, and certainly all computer algebra tools, probably requires thousands of hours of intense study to gain real proficiency.
 
GargleBlast42 said:
Thanks, your solution works, but it still has a problem - it only seems working when I take the expression in an equation. But I want to simplify solely the expression (b^8 + c^4)/a^8 without putting it into an equation.
So then you will need to write a function which takes the expression without the equation as an argument, puts it into an equation, passes it to Simplify, and then casts the result as an expression, and returns that expression. Writing that type of interface function is a pretty common activity in any programming language.
 
Last edited: