2
$\begingroup$

I don't know a whole lot about Mathematica, and this is a fairly uncommon notation, so here goes:

How do I tell Mathematica to evaluate this? $$1+\underset{i=1}{\overset{\infty}{K}}\frac{(-1)^{i-1}}{i+1}$$

where $$\underset{i=1}{\overset{\infty}{K}}\frac{a_i}{b_i}=\cfrac{a_{1}}{b_{1}+\cfrac{a_{2}}{b_{2}+\cfrac{a_{3}}{b_{3}+\cfrac{a_{4}}{b_{4}+\ddots{}}}}}$$

Must I convert to a different notation first? Or can I create a custom notation like this? Thanks for your time.

Update: I didn't know the ContinuedFractionK command, but unfortunately:

In[1] = ContinuedFractionK[(-1)^(i-1),i+1,{i,1,Infinity}]

produces only the formula in its proper format. How can I get a numerical value?

P.S. I am working in Wolfram Cloud Open Access in my browser, if that matters.

$\endgroup$
4
  • 4
    $\begingroup$ I am not familiar with the notation, but is ContinuedFractionK relevant to your problem? $\endgroup$
    – MarcoB
    Apr 16 '20 at 18:30
  • $\begingroup$ @MarcoB Yes, that is what I am looking for. Thank you very much! $\endgroup$ Apr 16 '20 at 18:31
  • $\begingroup$ @MarcoB Hold on though, when I use this function, it doesn't actually evaluate it. It just formats in the proper way. How can I evaluate it? $\endgroup$ Apr 16 '20 at 18:42
  • 1
    $\begingroup$ It will evaluate to a value IF it knows / can calculate the value of the infinite sum. If not, it returns unevaluated. Mathematica is not magic :-) For instance,1+ ContinuedFractionK[1, {n, 1, Infinity}] evaluates to GoldenRatio. $\endgroup$
    – MarcoB
    Apr 16 '20 at 18:52
3
$\begingroup$
ContinuedFractionK[a[i], b[i], {i, 1, 5}]

enter image description here

cf = 1 + ContinuedFractionK[(-1)^(i - 1), i + 1, {i, 1, Infinity}]

enter image description here

With 25 terms this converges to 50 decimal places

(seq = Table[
    1 + ContinuedFractionK[(-1)^(i - 1), i + 1, {i, 1, m}],
    {m, 20, 25}]) // N[#, 50] &

(* {1.5904911352531017312102344422665947246625994232424, \
1.5904911352531017312102344422665947246626211968387, \
1.5904911352531017312102344422665947246626212398613, \
1.5904911352531017312102344422665947246626212397833, \
1.5904911352531017312102344422665947246626212397832, \
1.5904911352531017312102344422665947246626212397832} *)

cfn = seq // Last

(* 574085431771810544409993183/360948526557146668699034326 *)
$\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.