5
$\begingroup$

I want to expand the expression but I do not want it to evaluate.

Sum[(HoldForm[1/(2 # - 1) - 1/(2 # + 1)] &)[i], {i, 1, 6}]

However if you evaluate this you get: (Fraction-Fraction)+...+(Fraction-Fraction). What i want is to have this fraction evaluated without having to evaluate the subtraction inside the parenthesis or the addition outside the parenthesis. Could someone show me a simple way to do this?

$\endgroup$
2
  • $\begingroup$ It is a good habit to hold on with an accept a day or two, let's don't discourage others. $\endgroup$
    – Kuba
    Commented Jan 17, 2015 at 16:24
  • $\begingroup$ @Kuba Okey, ill do that next time:) $\endgroup$
    – ALEXANDER
    Commented Jan 17, 2015 at 16:29

3 Answers 3

7
$\begingroup$
HoldForm[# - #2] & @@@ Table[{1/(2 i - 1), 1/(2 i + 1)}, {i, 1, 6}] // Total

enter image description here

$\endgroup$
3
  • $\begingroup$ I am still (till now) don't know how to format any of my answers that way you did it here. can you tell me how? Thanks. $\endgroup$ Commented Jan 18, 2015 at 1:30
  • $\begingroup$ @Algohi The result is a picture :) $\endgroup$
    – Kuba
    Commented Jan 18, 2015 at 8:03
  • $\begingroup$ Oh, I see. I should have known this. I can't copy it:-) $\endgroup$ Commented Jan 18, 2015 at 16:01
6
$\begingroup$

One more subtle variation:

Sum[Defer[# - #2] & @@ (1/(2 i + {-1, 1})), {i, 6}]
(1/11 - 1/13) + (1/9 - 1/11) + (1/7 - 1/9) + (1/5 - 1/7) + (1/3 - 1/5) + (1 - 1/3)
$\endgroup$
1
  • 1
    $\begingroup$ Always new thing to the scene. When the master speech, everyone has to listen. :) $\endgroup$ Commented Jan 17, 2015 at 20:49
6
$\begingroup$

Another way of doing it (something similar to Kuba's great answer) is:

Sum[HoldForm[#1 - #2] &[1/(2 i - 1), 1/(2 i + 1)], {i, 1, 6}]

May be also something different:

Sum[(1/(2 i - 1) - 1/(2 i + 1) // Trace)[[-2]], {i, 1, 6}]
$\endgroup$
1
  • 1
    $\begingroup$ Nice! (8 to go) $\endgroup$
    – Kuba
    Commented Jan 17, 2015 at 22:08

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.