# I Recursive square root inside square root problem

#### Gionata

I have been debating this issue for days:

I can't find a recursive function of this equation:
$\large{\sqrt{2+\pi \sqrt{3+\pi\sqrt{4+\pi\sqrt{5+\dotsb}}}}}$

Starting value 2 always added with pi

has been trying to find a solution this for days now, is what I have achieved so far:
This sucession result not correct:
$f\left(n\right)=\sqrt{n+1+\pi f\left(n+1\right)}$

http://www.wolframalpha.com/input/?i=f\left(n\right)=\sqrt{n+1+\pi+f\left(n+1\right)}
Unfortunately, I do not know how to move forward, thanks a lot!

Last edited:

#### .Scott

Homework Helper
I don't know the "correct way" to do this kind of recursive equation, but this was my strategy:
If you start from a large n and work backwards, whatever error you started with is going to get less and less as you move towards n=1. This is because you're doing those square roots over and over again.

So I solved for the f(100) given the recursion formula and given the approximation f(100)=f(101).
That got me f(100) = 11.74269.
Then I worked it backwards to f(1) using an Excel spreadsheet.

If you work out an estimate using this method or some other method, I let you know if it's consistent with what I have.
If it is consistent, I'll give you a Wolfram Alpha link that shows the series.

#### Gionata

Thank you very much for the very comprehensive response.

I need the recursive formula because I have to demonstrate with another program (mathlab) that at high sequnze of n (very high) the value tends to a value x.

To do this I cannot be satisfied with an approximation but rather with a recursive formula that calculates exactly the value of x on the basis of (n)

#### .Scott

Homework Helper
It sounds as though you are saying that you are looking for a version of f(n) that is not recursive.
Or are you saying that you are looking for a recursive formula in the form of $f(n)=g(f(n-1),n)$? In that form, you would be able to compute a series of f(n) given f(0).

Also, "tends to a value x": I presume x is a different function of n. In rough terms, as n gets very large, f(n) will be approximately $\sqrt{n} + \pi/2$.
But I was able to get that with the existing f(n) definition - just by presuming that f(n) is approximately equal to f(n+1) for very large n.

#### Gionata

I am a looking for a recursive formula in the form of:
$f\left(n\right)=\sqrt{n+1+\pi f\left(n+1\right)}$
in alternative
$f\left(n+1\right)=\frac{1}{\pi}\left(f\left(n\right)^2-n-1\right)$

These examples mentioned above are very close to the solution but unfortunately wrong.

What I want is to be able to get a recursive formula in order to calculate at will, repeating n times the root the exact result

Meanwhile, thank you for your interest:)

#### .Scott

Homework Helper
I am a looking for a recursive formula in the form of:
$f\left(n\right)=\sqrt{n+1+\pi f\left(n+1\right)}$
in alternative
$f\left(n+1\right)=\frac{1}{\pi}\left(f\left(n\right)^2-n-1\right)$
OK.
I have that sequence. But I'm not suppose to just give it to you. On this board, I am only suppose to help you calculate it.
So I will give the general form of the answer, but not the exact answer:
http://www.wolframalpha.com/input/?i=f(n)=sqrt(n+1+(pi+f(n+1)));+f(0)=3.5

Warning: The sequence generate by that link is also not what you want.

To get it right, you need to replace that 3.5 value with the correct value.
I told you how to calculate that value earlier in this thread. But if you want more assistance, I will assist.

#### .Scott

Homework Helper
One more thing: When you are using wolframalpha to work this problem, f(0) to f(19) will be accurate. f(20) to f(24) may be accurate. But they plot values for f(25) to f(30) which are not valid. That's because of limitations on the precision of the floating point values they are using - and the fact that tiny errors in f(0) or f(1) quickly build up after f(19).

That is why you can get much greater precision for f(n) by starting with a good estimate of f(n+20) and working backwards to f(n). This is true no matter what tool you are using: Matlab, Excel, wolfram.

#### Gionata

well now I've understood the situation,
I have to find the key value of f0), but I'm currently struggling a lot, if you're patient and want to I'd like if together you help me to calculate the value of f(0). I would be very grateful.

#### .Scott

Homework Helper
I used Excel.

I reserved column "F" for n. And "G" for f(n).
At cell F4, I put the number 100.
At cell F5, I put =f4-1. (which will be 99).
At cell G3, I put in an estimate for f(101). Almost any value will work, but I put in my estimate of 11.75. Less accurate values (0 or 20) will also work.
At cell G4, I put in your formula: =SQRT(F4+1+PI()*G3)
Then I copied G4 to G5. That gives us a good estimate of f(99).

#### Gionata

for f(99)= 11.70016315

for f(0)= 3.609993083
Correct?

Last edited:

#### .Scott

Homework Helper
for f(99)= 11.70016315

for f(0)= 3.609993083
Correct?
Yes. BTW: I look for the PF alert. So if you quote something of mine, I will see it a lot quicker.

Now if you use that in Wolfram, you will see the values in the n vs. n+1 look good up to about 20.
You can't see it in the plot because the scale is messed up with f(30).

#### .Scott

Homework Helper
So that demonstrates:
1) that you formula was basically OK;
2) the value for f(0) to f(20) can be deduced from Wolfram.
3) Values for f(21) and on need another method - but you should have the first 80 of so in your Excel spreadsheet.

So, if you need f(9,000) in MatLab, do you know how to generate it?
For example: f(10000) = 101.5882103

f(1000000) = 1001.572531
Notice how close that is to $\sqrt{n} + \pi/2$

#### Gionata

So that demonstrates:
1) that you formula was basically OK;
2) the value for f(0) to f(20) can be deduced from Wolfram.
3) Values for f(21) and on need another method - but you should have the first 80 of so in your Excel spreadsheet.

So, if you need f(9,000) in MatLab, do you know how to generate it?
For example: f(10000) = 101.5882103

f(1000000) = 1001.572531
Notice how close that is to $\sqrt{n} + \pi/2$
I am really happy that it works, after days of work.
Thanks for the explanations, you have a great talent.

You asked me if I can generate f(9,000) in MatLab, the answer is no, do you want to explain it to me? That would be the culmination of the project.

#### .Scott

Homework Helper
You're going to do the same thing in MatLab that you did with Excel.
Start will 9020 and make a guess. I'd use the formula $\sqrt{n} + \pi()/2$ - but even 0 will work.
Then compute f(9019) from f(9020), f(9018) from f(9019), and so on until you get to f(9000).

#### Gionata

You're going to do the same thing in MatLab that you did with Excel.
Start will 9020 and make a guess. I'd use the formula $\sqrt{n} + \pi()/2$ - but even 0 will work.
Then compute f(9019) from f(9020), f(9018) from f(9019), and so on until you get to f(9000).
well, understood thank you very much!

Last question just to understand:
f(0)= 3.609993083
http://www.wolframalpha.com/input/?i=f\left(n+1\right)=\frac{1}{\pi}\left(f\left(n\right)^2-n-1\right);+f(0)=+3.609993083

$\sqrt{2+\pi }$ f(0) should not give 2.26751?

from the second link the first value is 3.60999

#### .Scott

Homework Helper
$\sqrt{n} + \pi()/2$ is an approximation to f(n) for large n.
As we said earlier, $f(0)=3.609993083$.
$f(1) = \sqrt{2+\pi() f(0)} = 3.829920486$.

I'm not sure where you are getting 2.26751.

#### .Scott

Homework Helper
Oh.
There is a difference between $\sqrt{2+\pi/2}$ and $\sqrt{2} + \pi/2$.

#### Gionata

Oh.
There is a difference between $\sqrt{2+\pi/2}$ and $\sqrt{2} + \pi/2$.
oh, my error ignores...

Question, if I want to replace (retaining the formula) only the pi with phi example, and doing all the calculations as we did together should work?
$\large{\sqrt{2+\phi \sqrt{3+\phi\sqrt{4+\phi\sqrt{5+\dotsb}}}}}$

#### .Scott

Homework Helper
Yup. Given some specific positive value for $\phi$.

#### Gionata

Super
Yup. Given some specific positive value for $\phi$.
Super! Thanks a lot for your help !

Homework Helper

Last edited:

#### Gionata

Strange, I calculated manually with excel the first 10 series:
I got: 3.128171204
D2= 1.6180339887 (phi)

#### .Scott

Homework Helper
You're calculating f(1).
But you have some terms backwards.
I set D10 to phi and used this:
=SQRT(2+D10*SQRT(3+D10*SQRT(4+D10*SQRT(5+D10*SQRT(6+D10*SQRT(7+D10*SQRT(8+D10*SQRT(9+D10*SQRT(10+D10*SQRT(11+D10*SQRT(12+D10*3.7)))))))))))
I got 2.560219. If you want greater precision than that, you need to use more terms.

#### Gionata

You're calculating f(1).
But you have some terms backwards.
I set D10 to phi and used this:
=SQRT(2+D10*SQRT(3+D10*SQRT(4+D10*SQRT(5+D10*SQRT(6+D10*SQRT(7+D10*SQRT(8+D10*SQRT(9+D10*SQRT(10+D10*SQRT(11+D10*SQRT(12+D10*3.7)))))))))))
I got 2.560219. If you want greater precision than that, you need to use more terms.
= RADQ (2 + D10 * RADQ (2 + D10)) = 2.2534
different
= RADQ (D10 + 2 * RADQ (D10 + 3)) = 2,4322

the value of pi I wish before the sequence 2,3,(n)

"Recursive square root inside square root problem"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving