Substitute expressions with FullSimplify
- To: mathgroup at smc.vnet.net
- Subject: [mg108656] Substitute expressions with FullSimplify
- From: Guido Walter Pettinari <coccoinomane at gmail.com>
- Date: Fri, 26 Mar 2010 05:36:41 -0500 (EST)
Hello world! This is my first post in this group, but it has been a while since I started reading it. I always found it quite useful, therefore I wish to thank everibody for their contributions! Here is my problem. Let's say I have an expression. I would like to substitute all the occurences of a given subexpression in this expression with a symbol. I want to do it in an intelligent way, i.e. by using FullSimplify instead of ReplaceAll. If my expression is: x^2 + y^2 I know that: FullSimplify [ x^2 + y^2, x^2 + y^2 == r ] will produce 'r' as a result, which is what I want. However, if my expression is x + y , then FullSimplify [ x + y, x + y == r ] produces 'x + y' and not 'r' ! I tried to use FullSimplify [ x + y, x + y == r, ComplexityFunction -> LeafCount ] but I still get 'x+y' as a result. Do you have any idea on how to substitute x+y with r in an expression? Thank you very much, Guido