4

I would like to simplify complicated expressions by defining some variable that is a combination of other variables that appear in the expression, but without eliminating the original variables.

As a simple example, I would like to convert

a^2 + a*b^2 + b

to

a*c + b

by introducing the relation

c == a + b^2

I saw this question, but the answers require that one variable be eliminated. The best expressions I could get with those strategies are

b - b^2 c + c^2
a*c - Sqrt[-a + c]
a*c + Sqrt[-a + c]

depending on whether I eliminate a or b, but these are not meaningfully simpler than the original expression. Is there any way to introduce a new variable without eliminating one of the dependent variables in the expression? If it matters, I have Mathematica 10.3.

astay13
  • 143
  • 1
  • 4

2 Answers2

7
Simplify[a^2 + a*b^2 + b, b^2 == c - a]

(*  b + a c  *)

Or

a^2 + a*b^2 + b /. b^2 -> c - a // Simplify

(*  b + a c  *)
Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198
4

Also

Simplify[a^2 + a*b^2 + b, Assumptions -> {c == a + b^2}]

works.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257