1
$\begingroup$

Given:

originalFormat = 2/3*y + 3/4*y^2 + 1/2*y^3/(1 - y);
simplified = Simplify[originalFormat];

I would like a function that, given "simplified", will return back originalFormat. Functions that get part of the way there are also appreciated. For example, Expand returns:

 -((2 y)/(3 (-1+y)))-y^2/(12 (-1+y))+y^3/(4 (-1+y))

, which, if the factor (-1 + y) was multiplied out, would give the answer, except for the last term. I do not know a function to pair with Expand to multiply out the common denominator.

$\endgroup$
5
  • 1
    $\begingroup$ given "simplified", will return back originalFormat if I understand you right (and I am not sure I do now), but if so, this is not possible. There are infinite expressions that could give the same simplified result. For example, if I give you x, how would you know the original expression? it could be x^2/x or x^3/x^2 or any number of infinite possibilities. $\endgroup$
    – Nasser
    Commented Oct 10, 2019 at 20:50
  • $\begingroup$ Maybe look into Apart? $\endgroup$ Commented Oct 10, 2019 at 20:51
  • $\begingroup$ Apart[simplified] gives -(1/2)-1/(2 (-1+y))+y/6+y^2/4. $\endgroup$ Commented Oct 10, 2019 at 20:52
  • $\begingroup$ @Nasser, it's true that it's not one-to-one, but I still think there's an algorithm to consistently get the format I want. $\endgroup$ Commented Oct 10, 2019 at 20:55
  • $\begingroup$ @ThatGravityGuy, Apart is close too though. With the assumption that 0<y<1, I think Apart would give the correct answer if it only split it into positive components. $\endgroup$ Commented Oct 10, 2019 at 21:13

1 Answer 1

1
$\begingroup$

The question is not very clearly formulated. Therefore I present a solution that works specifically for the given case.

Notice that what you are asking is essentially a polynomial division with a small difference that highest, not lowest power of y should go into the reminder. This can be realized by inverting the variable, i.e. y->1/z.

The procedure goes on

  • by extraction the numerator and the denominator,

  • making the substitution,

  • polynomial division,

  • back-substitution,

  • and, finally, computation of the reminder.


n = (Numerator[simplified] /. y -> 1/z) z^3 // Simplify    
Out[1]= 3 - z - 8 z^2

d = (Denominator[simplified] /. y -> 1/z) z // Simplify
Out[2]= -12 (-1 + z)

p = PolynomialQuotient[n, d, z]/z^2 /. {z -> 1/y} // Expand    
Out[3]= (2 y)/3 + (3 y^2)/4

q = Simplify[simplified - p]   
Out[4]= y^3/(2 - 2 y)

p + q    
Out[5]= (2 y)/3 + (3 y^2)/4 + y^3/(2 - 2 y)
$\endgroup$
1
  • $\begingroup$ There was definite confusion on my part, but your solution does give me better tools to work with $\endgroup$ Commented Oct 11, 2019 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.