6

I have two expressions:

expr = (a - R)^2 (a + 2 R)/(2 R^3);
factor = 1 - a^2/R^2;

I would like to write expr in terms of factor -- is there a function in Mathematica to help with this?

MarcoB
  • 67,153
  • 18
  • 91
  • 189
BillyJean
  • 1,273
  • 7
  • 25

2 Answers2

5

Rewrite your definitions as equations (i.e. using ==), then use Solve to solve for expr specifying that the R and a variables should be eliminated:

Clear[expr, factor]

Solve[
  {expr == (a - R)^2 (a + 2 R)/(2 R^3), factor == 1 - a^2/R^2},
  expr,
  {R, a}
]

Mathematica graphics

MarcoB
  • 67,153
  • 18
  • 91
  • 189
4

Using Eliminate

Eliminate[{expr == e, factor == f}, {a, R}]
3 f^2 + f^3 == (8 - 4 e) e
rhermans
  • 36,518
  • 4
  • 57
  • 149