3
$\begingroup$

Here is a piece of sad comedy based on some Apart behavior. Is there a way to make Apart do the expected step?

Consider a very simple expression, such as

expression = (a - b + c - d)/(a - b);

If we were to consider how to take this expression Apart to simplify it, I would argue that the simplest step that would come to mind is to write

1+(c - d)/(a - b)

cancelling the obvious a-b combination in numerator and denominator.

Now, let's see if Mathematica 11.3 on windows 10 would produce the same result?

expression//Apart

enter image description here

...crickets

$\endgroup$
  • 2
    $\begingroup$ expression // Apart[#, a] & gives 1 + (c - d)/(a - b) $\endgroup$ – kglr Sep 17 at 23:27
  • 1
    $\begingroup$ Moreover it looks as if chose d as the variable: In[4]:= Apart[expression, d] Out[4]= (a - b + c)/(a - b) - d/(a - b) $\endgroup$ – Chip Hurst Sep 17 at 23:32
  • 1
    $\begingroup$ What it does will depend on the second argument. No second argument means you get what you get. $\endgroup$ – Daniel Lichtblau Sep 17 at 23:34
  • $\begingroup$ confirming @Chip's observation: expression2 = (z - b + c - d)/(z - b); expression2 // Apart $\endgroup$ – kglr Sep 17 at 23:35
  • $\begingroup$ Very interesting observations! Someone should post that the second argument is very important for Apart as an answer. $\endgroup$ – Kagaratsch Sep 18 at 0:30
3
$\begingroup$

Although it's not quite so obvious, Apart will always choose a variable when one isn't explicitly given.

Apart[(a - b + c - d)/(a - b), c]

$$\frac{c}{a-b}+\frac{a-b-d}{a-b}$$

vs

Apart[(a - b + c - d)/(a - b)]

$$\frac{a-b+c}{a-b}-\frac{d}{a-b}$$

and will choose in alphabetical inverse order which is the variable. (the last one in the alphabet. )

Apart[(a - b + d - s)/(a - b)]

$$\frac{a-b+d}{a-b}-\frac{s}{a-b}$$

Apart[(a - b + d - z)/(a - b)]

$$\frac{a-b+d}{a-b}-\frac{z}{a-b}$$

Except in this exactly same form but different variable case:

Apart[(z - b + d - s)/(z - b)]

$$\frac{d-s}{z-b}+1$$

...crickets

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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