6
$\begingroup$

How to write the first five terms of this series in the following form by MMA code?

$\sum_{n=1}^{\infty} \frac{1 \cdot 3 \cdot \cdots \cdot(2 n-1)}{2 \cdot 4 \cdot \cdots \cdot 2 n}= \frac{1}{2}+\frac{1 \cdot 3}{2 \cdot 4}+\frac{1 \cdot 3 \cdot 5}{2 \cdot 4 \cdot 6}+\frac{1 \cdot 3 \cdot 5 \cdot 7}{2 \cdot 4 \cdot 6 \cdot 8}+\frac{1 \cdot 3 \cdot 5 \cdot 7 \cdot 9}{2 \cdot 4 \cdot 6 \cdot 8 \cdot 10}$

I tried to write code with HoldForm, but I couldn't get the result.

For example,

$\sum_{n=1}^{\infty} \frac{1+n}{1+n^{2}}$

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

$\frac{1+1}{1+1^{2}}+\frac{1+2}{1+2^{2}}+\frac{1+3}{1+3^{2}}+\frac{1+4}{1+4^{2}}+\frac{1+5}{1+5^{2}}$

Or,

Total[Apply[HoldForm[#1/#2] & , Table[{1 + i, 1 + i^2}, {i, 1, 5}], {1}]] 

$\frac{2}{2}+\frac{3}{5}+\frac{4}{10}+\frac{5}{17}+\frac{6}{26}$

Update: Some other questions

How to get the results in the following form?

  1. $\sum_{n=1}^{\infty} \frac{1 \cdot 3 \cdot \cdots \cdot(2 n-1)}{2 \cdot 4 \cdot \cdots \cdot 2 n}=\frac{1}{2}+\frac{3}{8}+\frac{5}{16}+\frac{35}{128}+\frac{63}{256}$

  2. $\sum_{n=1}^{\infty} \frac{(-1)^{n-1}}{5^{n}}=\frac{1}{5}-\frac{1}{5^{2}}+\frac{1}{5^{3}}-\frac{1}{5^{4}}+\frac{1}{5^{5}}=\frac{1}{5}-\frac{1}{25}+\frac{1}{125}-\frac{1}{625}+\frac{1}{3125}$

  3. $\sum_{n=1}^{\infty} \frac{1+n}{1+n^{2}}= 1+\frac{3}{5}+\frac{2}{5}+\frac{5}{17}+\frac{3}{13}$

$\endgroup$

1 Answer 1

11
$\begingroup$
times[{i_}] := i times[{i__}] := Inactive[Times][i] Sum[times@Table[2 i - 1, {i, n}]/times@Table[2 i, {i, n}], {n, 5}] 

Mathematica graphics

If you prefer HoldForm:

times[{i_}] := i times[{i__}] := HoldForm@Times[##] &[i] Sum[times@Table[2 i - 1, {i, n}]/times@Table[2 i, {i, n}], {n, 5}] 

Mathematica graphics

If you prefer ·, then you don't need any evaluation control, just use CenterDot:

times[{i_}] := i times[{i__}] := CenterDot[i] Sum[times@Table[2 i - 1, {i, n}]/times@Table[2 i, {i, n}], {n, 5}] 

Mathematica graphics

$\endgroup$
19
  • $\begingroup$ Your answer is great! Thank you! $\endgroup$ Commented Mar 13, 2022 at 8:24
  • $\begingroup$ One more question. How to simplify each item to get this result: =1/2+3/8+5/16+35/128+63/256 $\endgroup$ Commented Mar 13, 2022 at 9:06
  • $\begingroup$ I just updated my questions and have a few more questions. Thank you very much! $\endgroup$ Commented Mar 13, 2022 at 9:33
  • $\begingroup$ @lotus2019 If you've understood my code, then you should be able to solve it yourself. What have you tried? $\endgroup$ Commented Mar 13, 2022 at 9:40
  • $\begingroup$ OK, thank you. I am learning MMA by solving math problems with MMA. I really don't understand some of the code, but I'll keep trying. $\endgroup$ Commented Mar 13, 2022 at 10:19

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.