Message Boards Message Boards

0
|
4635 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Simplifying expressions

Posted 9 years ago

Hi All,

I consistently observe that mathematica is not able to simplify a few expressions that are quite obvious to human eye. I tried Simplify, FullSimplify, and other such functions.

For instance, Simplify[128 d^2 + 412 d g - 49 g^2 - 256 d m - 412 g m + 128 m^2 + 412 d w - 98 g w - 412 m w - 49 w^2] FullSimplify[ 128 d^2 + 412 d g - 49 g^2 - 256 d m - 412 g m + 128 m^2 + 412 d w - 98 g w - 412 m w - 49 w^2]

give the same expression 128 d^2 + 412 d g - 49 g^2 - 256 d m - 412 g m + 128 m^2 + 412 d w - 98 g w - 412 m w - 49 w^2, though one can easily see that it could be written more simply as 128(d-m)^2 - 49(g+w)^2 +....

Can anyone suggest the appropriate command to use to attain this simplification?

POSTED BY: Prashant
2 Replies
Posted 9 years ago

So is there a way that I can tell mathematica to use basic identities in algebra (a+b)^2 , (a+b)^3 etc, to simplify an expression?

POSTED BY: Prashant

Whats obvious to a human is not always obvious to a machine. How does the machine know what form you want? You can help along with substitutions:

In[27]:= FullSimplify[
 128 d^2 + 412 d g - 49 g^2 - 256 d m - 412 g m + 128 m^2 + 412 d w - 
  98 g w - 412 m w - 49 w^2]

Out[27]= 128 d^2 - 49 g^2 - 412 g m + 128 m^2 - 98 g w - 412 m w - 
 49 w^2 + 4 d (103 g - 64 m + 103 w)

In[28]:= FullSimplify[
 128 d^2 + 412 d g - 49 g^2 - 256 d m - 412 g m + 128 m^2 + 412 d w - 
    98 g w - 412 m w - 49 w^2 /. m -> d - x /. g -> y - w]

Out[28]= 128 x^2 + 412 x y - 49 y^2

In[29]:= % /. x -> (d - m) /. y -> (g + w)

Out[29]= 128 (d - m)^2 + 412 (d - m) (g + w) - 49 (g + w)^2

FullSimplify won't alter this expression either:

In[30]:= FullSimplify[%]

Out[30]= 128 (d - m)^2 + 412 (d - m) (g + w) - 49 (g + w)^2
POSTED BY: Kay Herbert
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract