Calculate the complicated product?

I try to calculate some complicated products given on the page 68 of PROGRAMMING IN MATHEMATICA, A PROBLEM-CENTRED APPROACH as shown below but failed to figure out the trick:

As you can see, I only worked out the question 3. Are there any tips for solving the other two?
I also attached some of my attempts.

Regards,
HZ

Product.nb (7.43 KB)

From the documentation of Product:

If the range of a product is finite, i is typically assigned a sequence of values, with f being evaluated for each one.

And also:

If a product cannot be carried out explicitly by multiplying a finite number of terms, Product will attempt to find a symbolic result. In this case, f is first evaluated symbolically.

So, the errors you’re getting are because it can’t symbolically evaluate your term expression once i is plugged in. If you used a finite bound, the i would be replaced with an actual number in each term, and then your term expression could be evaluated. If you pick a large enough bound, you will be within the standard accuracy anyway, so, do you really need an infinite product?

What is your objective? Are you just trying to see if Mathematica is smart enough to know these formulas?

I want to use any feasible calculation method, say, taking the Limit to accurately verify the validity of those equations with the help of Mathematica.

Try:

  Block[{n = 500}(*is not a Infinity*), $MaxExtraPrecision = 1000; 
   N[Times @@ Table[1/2 Nest[Sqrt[2 + #] &, Sqrt[2], i], {i, 0, n}] - 2/
     Pi, 20]]

 (*6.1081960994840413729*10^-303*)

Why can equation 3 in my example be analytically verified perfectly, while the other two cannot be calculated similarly?

For example 3 you used a term expression that could be completely evaluated to a simple arithmetic expression with the formal variable i. For the other two, you needed to evaluate the Nest, and that can’t be done without replacing the i with an actual number. The real question is why was Mathematica able to evaluate example 3 analytically. :slight_smile:

For the other two, is it possible to evaluate the limit of product on the nested list, with the index approaching infinity?

I tried the method shown below based on the notes here, but failed:

In[26]:= Remove[f];
f[1] = Sqrt[2];
f[n_] := Sqrt[2 + f[n - 1]]
Limit[Product[1/2 f[i], {i, 1, n}], n -> Infinity]

During evaluation of In[26]:= $RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of -1020+i.

Out[29]= 
\!\(\*UnderscriptBox[\(\[Limit]\), \(n \[Rule] \[Infinity]\)]\) \!\(
\*UnderoverscriptBox[\(\[Product]\), \(i = 1\), \(n\)]\(Hold[
\*FractionBox[\(f[i]\), \(2\)]]\)\)

RSolve[{a[n] == Sqrt[2 + a[n - 1]], a[1] == Sqrt[2]}, a[n], n]
(?)

RSolve can’t can compute ,but I made a mistake closed-form exist.

  a[n]=2 Cos[2^(-1 - n) \[Pi]]

We can check is solution True:

    f[1] = Sqrt[2];
    f[n_] := Sqrt[2 + f[n - 1]]
    g[n_] := 2 Cos[2^(-1 - n) \[Pi]]
    N[Table[f[n] - g[n], {n, 1, 200}]]
    (*{0,0,0,}*)

Then:

 Product[1/2*2 Cos[2^(-1 - n) \[Pi]], {n, 1, Infinity}]

(*2/\[Pi]*)

.

No way to find a solution ,because we can’t find a closed-form solution from:

This sounds very frustrating. As you can see, the corresponding limit exists strictly, so it must be mathematically rigorously provable. However, the present computational algebraic system is incapable of dealing with such problems.

See here: “Viète's formula - Wikipedia”

I also mentioned this wiki page in my reply above.

I use a trick to solve equation:

 2 Cos[FindSequenceFunction[
    Table[ArcCos[
       1/2 RSolveValue[{a[n] == Sqrt[2 + a[n - 1]], a[1] == Sqrt[2]}, 
         a[m], n]], {m, 1, 7}] // FullSimplify, n]]

(*2 Cos[2^(-1 - n) \[Pi]]*)

I use a trick to solve equation:

What is the idea behind this technique, and how did you come up with this method?

Finally, the problem becomes the following: How to find its equivalent closed form which can be calculated analytically?

BTW, how to solve the original question 2?

BTW, how to solve the original question 2?

From here:Pippenger Product -- from Wolfram MathWorld

   Sqrt[2]*Product[((
       2^(-1 + 2^n)
         Gamma[1/2 + 2^(-2 + n)]^4)/(\[Pi] Gamma[
         1/2 + 2^(-1 + n)]^2))^(1/2^n), {n, 2, Infinity}]

  (*E/2*)

Finally, the problem becomes the following: How to find its equivalent closed form which can be calculated analytically?

This site: https://math.stackexchange.com is more appropriate.

What is the idea behind this technique, and how did you come up with this method?

The art and craft of it—which only comes with practice—is having the intuition to guess when it’s a good time to try that.

I noticed some related discussions here.

Number 2 is really amazing. I thought I saw it sometimes somewhere, and even a proof, but I did not find it again. It seems convergence is really fast.

A code to get the expression

nn = 3;
ppp = Join[{Sqrt[2]}, 
  hh[ Table[(z = If[OddQ[k], k + 1, k])/ If[OddQ[k], k, k + 1], #]]^(1/(2 #[[2]])) & /@ 
   Table[{k, 2^j, 2^(j + 1) - 1}, {j, 1, nn}]]
Times @@ (ppp /. hh[x_] :> Times @@ x) // N
E/2 // N

or to check convergence

ff[n_] := Module[{},
  ppp = Join[{Sqrt[2]}, 
    hh[ Table[(z = If[OddQ[k], k + 1, k])/ If[OddQ[k], k, k + 1], #]]^(1/(2 #[[2]])) & /@ 
     Table[{k, 2^j, 2^(j + 1) - 1}, {j, 1, n}]];
  
  Times @@ (ppp /. hh[x_] :> Times @@ x) // N
  ]

ListLinePlot[
 Table[{j, ff[j]}, {j, 2, 6}],
 Epilog -> {Red, Line[{{2, E/2}, {6, E/2}}]},
 PlotRange -> {1.35, 1.37}
 ]