{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Math 466/666 Programming Project 1**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**1.** List the members on your team and explain how the work for this project was conducted. Please provide details concerning how many meetings were held, what was discussed at each meeting and what work was done between meetings. Further include a written statement attesting that the submitted report representsthe original efforts of the team members listed and, in particular, does contain the work of other students in the class."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*You answer will be different than the made up one here.* \n",
"\n",
"This project was completed in four meetings by\n",
"Student A, Student B and Student C. Setting up a\n",
"discussion group on WebCampus helped schedule these\n",
"meetings; however, email was used to send working\n",
"copies of the project report back and forth between\n",
"members of the team.\n",
"\n",
"The initial meeting was held through Zoom. Student C\n",
"had trouble connecting and then their computer crashed so\n",
"the meeting was abruptly cancelled and rescheduled for the\n",
"same time on the following week.\n",
"\n",
"At the second meeting Test Student A wrote code to\n",
"calculate the recurrence relation in question 2 using the\n",
"terminal version of Julia as JupyterLAB was not installed.\n",
"Code for this relation was communicated through the screen\n",
"share and later emailed to each team member to work with.\n",
"Student B agreed to watch the video on installing\n",
"JupyterLAB. Student C volunteered to perform a web\n",
"search to find additional information on the Foias constant.\n",
"\n",
"At the third meeting most of the time was spent helping\n",
"Student B install Julia on their computer using a screen\n",
"share over Zoom. While trying to write a loop to determine\n",
"whether the sequence was bounded, Anaconda started using\n",
"all available computer cycles and then Zoom crashed. It\n",
"was decided to set up the another meeting through WebCampus.\n",
"\n",
"At the fourth meeting Student C presented two interesting\n",
"links which discussed the Foias constant. A draft was\n",
"started for the project report using a JupyterLAB notebook\n",
"by Student C and sent through email to each member of the\n",
"team.\n",
"\n",
"At the fifth meeting, new code was written and improved\n",
"by all team members for inclusion into the final project.\n",
"Difficulties understanding the theoretical questions were\n",
"discussed along with a plan for tacking those problems\n",
"at the next meeting. Drafts of the new report were circulated\n",
"through email and improved in preparation for the last meeting.\n",
"\n",
"At the sixth and final meeting everyone in the team read\n",
"the report that had been polished over email. One error\n",
"was found and fixed. All team members then agreed that the\n",
"report was finished and ready to turn in.\n",
"\n",
"The report you are reading here was written represents the independent work of the team members listed below and, in particular, does not contain the work of any other student in the class."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**2.** Given $\\alpha\\in [1,2]$ consider the recurrence relation\n",
"$$\n",
" x_{n+1}=\\Big(1+{1\\over x_n}\\Big)^n\n",
"$$\n",
"where $x_1=\\alpha$.\n",
"Set $\\alpha=1$ and write a computer program\n",
"in Julia that computes $x_n$ for $n=1,\\ldots,50.$\n",
"Please include the full program listing and output.\n",
"For reference,\n",
"$$\n",
" x_{15}\\approx 1.1.2634346914781789\n",
"$$\n",
"and\n",
"$$\n",
" x_{16}\\approx 6283.87526674291.\n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"alpha=1"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2 2.0\n",
"3 2.25\n",
"4 3.0137174211248285\n",
"5 3.1461328651361042\n",
"6 3.9749418398300125\n",
"7 3.8436459461081727\n",
"8 5.046648974589512\n",
"9 4.24710770652293\n",
"10 6.705641594809613\n",
"11 4.014991943105442\n",
"12 11.546255851436948\n",
"13 2.7094151558091024\n",
"14 59.372935430968965\n",
"15 1.2634346914781789\n",
"16 6283.87526674291\n",
"17 1.0025492407161776\n",
"18 128267.71346883844\n",
"19 1.0001403407948934\n",
"20 523589.5387780858\n",
"21 1.0000381985532598\n",
"22 2.0963110569382557e6\n",
"23 1.000010494678316\n",
"24 8.387595658020036e6\n",
"25 1.0000028613721854\n",
"26 3.355323187755784e7\n",
"27 1.0000007748883877\n",
"28 1.3421632395741531e8\n",
"29 1.00000020861846\n",
"30 5.3686928798555815e8\n",
"31 1.0000000558795226\n",
"32 2.1474817879952881e9\n",
"33 1.0000000149011754\n",
"34 8.589932479998269e9\n",
"35 1.000000003958121\n",
"36 3.435973598800008e10\n",
"37 1.000000001047738\n",
"38 1.3743895080800003e11\n",
"39 1.0000000002764864\n",
"40 5.49755810924e11\n",
"41 1.0000000000727596\n",
"42 2.199023252272e12\n",
"43 1.0000000000190994\n",
"44 8.796093018596e12\n",
"45 1.0000000000050022\n",
"46 3.5184372084872e13\n",
"47 1.0000000000013074\n",
"48 1.40737488351004e14\n",
"49 1.000000000000341\n",
"50 5.62949953416608e14\n"
]
}
],
"source": [
"x=alpha\n",
"for n=1:49\n",
" x=(1+1/x)^n\n",
" println(n+1,\" \",x)\n",
"end"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that the output agrees with the expected values\n",
"for $x_{15}$ and $x_{16}$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**3.** Based on the numerical evidence in the previous step,\n",
"make a conjecture regarding the value of the limits\n",
"$$\n",
" \\lim_{n\\to\\infty} x_{2n}\n",
"$$\n",
"and\n",
"$$\n",
" \\lim_{n\\to\\infty} x_{2n+1}\n",
"$$\n",
"when $x_1=1$.\n",
"Explain your reasoning in as much mathematical detail as possible."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A visual inspection of the output from the program\n",
"in question 2 indicates that the even terms growing\n",
"without bound while the odd terms appear to decrease\n",
"towards 1.\n",
"\n",
"Note that if $x_{2n+1}=1+\\epsilon$ for $\\epsilon$ very\n",
"small then\n",
"$$\n",
" 1+{1\\over x_{2n+1}} = 1+{1\\over 1+\\epsilon}\n",
" = {2+\\epsilon\\over 1+\\epsilon}\\approx 2\n",
"$$\n",
"Therefore\n",
"$$\n",
" x_{2n+2}=\\Big(1+{1\\over x_{2n+1}}\\Big)^{2n+1}\n",
" \\approx 2^{2n+1} \\to \\infty\n",
"$$\n",
"as $n\\to\\infty$.\n",
"\n",
"On the other hand if $x_{2n}$ is very close to infinity\n",
"than\n",
"$$\n",
" 1+{1\\over x_{2n}} \\approx 1\n",
"$$\n",
"and so it's reasonable (but not guaranteed because $1^\\infty$ is an indeterminate form) that\n",
"$$\n",
" x_{2n+1}=\\Big(1+{1\\over x_{2n}}\\Big)^{2n}\n",
" \\approx 1^{2n} = 1\n",
"$$\n",
"as $n\\to\\infty$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"At anyrate, given the numerical evidence and the above\n",
"heuristic argument, our conjecture is that\n",
"$$\n",
" \\lim_{n\\to\\infty} x_{2n}=\\infty\n",
"$$\n",
"and\n",
"$$\n",
" \\lim_{n\\to\\infty} x_{2n+1}=1\n",
"$$\n",
"when $x_1=1$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**4.** Change the program in the previous step to compute the\n",
"values of $x_n$ when $\\alpha=2$. Look at the output and now\n",
"make a conjecture regarding the value of the limits\n",
"$$\n",
" \\lim_{n\\to\\infty} x_{2n}\n",
"$$\n",
"and\n",
"$$\n",
" \\lim_{n\\to\\infty} x_{2n+1}\n",
"$$\n",
"when $x_1=2$. Explain the reasoning behind your conjecture."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"alpha=2"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2 1.5\n",
"3 2.7777777777777772\n",
"4 2.515456000000001\n",
"5 3.814694524582706\n",
"6 3.202910914929112\n",
"7 5.105425602411104\n",
"8 3.4977433630005117\n",
"9 7.475734025618049\n",
"10 3.0953609877250656\n",
"11 16.436481006193045\n",
"12 1.9149171433392773\n",
"13 154.77995881694767\n",
"14 1.0873244478087112\n",
"15 9230.628993458884\n",
"16 1.001626257595803\n",
"17 64689.92026265085\n",
"18 1.0002628246012701\n",
"19 261524.77368382475\n",
"20 1.0000726533613016\n",
"21 1.0478144924485891e6\n",
"22 1.0000200419068173\n",
"23 4.193379435467222e6\n",
"24 1.0000054848507496\n",
"25 1.6776111794572083e7\n",
"26 1.0000014902152625\n",
"27 6.710756392755206e7\n",
"28 1.000000402339224\n",
"29 2.6843394397513205e8\n",
"30 1.000000108034036\n",
"31 1.0737400839916067e9\n",
"32 1.0000000288710484\n",
"33 4.2949653119971633e9\n",
"34 1.0000000076834112\n",
"35 1.7179866940000143e10\n",
"36 1.0000000020372681\n",
"37 6.8719474216000046e10\n",
"38 1.0000000005384209\n",
"39 2.74877904132e11\n",
"40 1.0000000001418812\n",
"41 1.099511624656e12\n",
"42 1.0000000000372893\n",
"43 4.39804650766e12\n",
"44 1.000000000009777\n",
"45 1.7592186040632e13\n",
"46 1.000000000002558\n",
"47 7.0368744173524e13\n",
"48 1.000000000000668\n",
"49 2.81474976706144e14\n",
"50 1.000000000000174\n"
]
}
],
"source": [
"x=alpha\n",
"for n=1:49\n",
" x=(1+1/x)^n\n",
" println(n+1,\" \",x)\n",
"end"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When $\\alpha=2$ the subsequence which remains bounded and\n",
"the one which goes to infinity appears to change.\n",
"Likely, since $2$ is bigger, then starting $x_1$ with that\n",
"larger number now makes the odd sequence $x_{2n+1}$ be\n",
"the one which tends to infinity while the evens sequence\n",
"tends to $1$.\n",
"In particular, based on the numerical evidence, we conjecture\n",
"that\n",
"$$\n",
" \\lim_{n\\to\\infty} x_{2n}=1\n",
"$$\n",
"and\n",
"$$\n",
" \\lim_{n\\to\\infty} x_{2n+1}=\\infty.\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**5.** [Extra Credit] Use rigorous mathematical analysis to\n",
"prove the conjectures made in the previous two steps."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The theory in the reference\n",
"\n",
" - J. Ewing, C Foias, An Interesting Serendipitous Real Number,\n",
" *Finite versus Infinite: Contributions to an Eternal Dilema*,\n",
" Springer-Verlag, pp. 119-120, 2000.\n",
" \n",
"implies that limits conjectured in the previous questions are\n",
"correct. Truthfully, more should be written for extra\n",
"credit, for example quote the theorem from that book, to\n",
"summarize the result and explain how the above conjectures\n",
"follow from it. For this solution key, I have not gone\n",
"into these necessary details.\n",
"\n",
"More information may be found at\n",
"\n",
" - *Foias Constant* Wikipedia, dowloaded October 17, 2020. \n",
" https://en.wikipedia.org/wiki/Foias_constant.\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**6.** Define\n",
"$$\n",
" \\alpha_*=\\sup\\Big\\{\\alpha :\n",
" |x_{2n+1}|\\hbox{ is bounded as }n\\to\\infty\\Big\\}.\n",
"$$\n",
"Intuitively, $\\alpha_*$ is the largest value of $\\alpha$ such\n",
"that $|x_{2n+1}|$ is bounded. Explain in details how the\n",
"interval bisection method could be used to approximate $\\alpha_*$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The interval bisection method is a natural search technique that\n",
"can be used to find a critical value at which a function or system\n",
"or changes state or behavior. A typical example of such a change\n",
"is when a continuous function $f$ changes from being positive to\n",
"negative. Note to get started\n",
"that it is imporant to have two reference values\n",
"$a$ and $b$ such that $f(a)$ and $f(b)$ have opposite signs.\n",
"In this case, finding the critical value at which the\n",
"transition occurs is equivalent to finding a root $x$ such that $f(x)=0$.\n",
"\n",
"In the present case the value $\\alpha=1$ leads to the odd terms \n",
"$x_{2n+1}$ being\n",
"bounded while $\\alpha=2$ leads to that sequence not being bounded.\n",
"Bisection can be used to find the critical value at which the \n",
"transition from bounded to unbounded behavior occurs.\n",
"Thus, we take $a=1$ and $b=1$ and note that $\\alpha_*\\in[a,b]$\n",
"\n",
"To search for $\\alpha_*$ we narrow down that value by bisecting\n",
"the interval into the pieces $[a,c]$ and $[c,b]$ where $c$ is\n",
"given as the midpoint $c=(a+b)/2$. Now, if $\\alpha=c$ results in\n",
"bounded behavior of the sequence, then we know \n",
"$\\alpha_*\\in[c,b]$. On the other hand, if $\\alpha=c$ results in\n",
"unbounded behavior of the sequence, then we know $\\alpha_*\\in[a,c]$.\n",
"\n",
"In either case, the above bisection results in better knowledge\n",
"of the true value of $\\alpha_*$. The bisection algorithm can then\n",
"be used to divide subsequence intervals in half until a bound\n",
"that determines $\\alpha$ to the desired precision is obtained."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**7.** Write a computer program that bisects the interval $[1,2]$\n",
"to find an approximation of $\\alpha_*$ good to at least\n",
"4 significant digits. Include the full program listing and\n",
"output."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First create a function that returns true if the resulting sequence\n",
"is bounded and false if it isn't. This function assumes the behavior\n",
"observed in the previous part of this assignment is typical and\n",
"simply checks whether $|x_{51}|$ is greater than or less than $2$\n",
"in order to determine whether the entire sequence $x_{2n+1}$\n",
"is bounded or not.\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"isoddbounded (generic function with 1 method)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function isoddbounded(alpha)\n",
" x=alpha\n",
" for n=1:50\n",
" x=(1+1/x)^n\n",
" end\n",
" return abs(x)<2\n",
"end"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Before continuing, we then check that our function\n",
"with the known values $\\alpha=1$ and\n",
"$\\alpha=2$ to make sure it is working."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"isoddbounded(1)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"false"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"isoddbounded(2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Since $\\alpha_*\\in [1,2]$ we know the first digit of $\\alpha$ is\n",
"be one and the remaining digits will appear after the decimal\n",
"point. Therefore,\n",
"to obtain 4 significant digits we need to arrive at an interval $[a,b]$\n",
"such that $\\alpha_*\\in[a,b]$ and with a length $|b-a|<0.0005$.\n",
"Since the interval will be cut in half at each iteration, this\n",
"implies at least $n$ iterations where\n",
"$$\n",
" {1\\over 2^n}<0.0005\n",
"$$\n",
"will be sufficient. Taking logarithms as solving for $n$ yields\n",
"$$\n",
" n>\\log(1/0.0005)/\\log(2).\n",
"$$\n",
"Since"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"10.965784284662087"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"log(1/0.0005)/log(2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"we perform $n=11$ bisection steps."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"alpha_* in [1.18701171875,1.1875]\n"
]
}
],
"source": [
"a=1\n",
"b=2\n",
"for n=1:11\n",
" c=(a+b)/2\n",
" if isoddbounded(c)\n",
" a=c\n",
" else\n",
" b=c\n",
" end\n",
"end\n",
"println(\"alpha_* in [\",a,\",\",b,\"]\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Therefore, the $\\alpha_*\\approx 1.187$ to 4 significant digits."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**8.** Explain theoretically how many times the interval \n",
"[1,2] needs to be bisected to ensure the\n",
"resulting approximation is good to at least 4 \n",
"significant digits. What if 6 \n",
"significant digits are desired?\n",
"How about 8 significant digits?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Most of the explanation is already contained in the answer to\n",
"the previous question. In summary, at the beginning it is known\n",
"that $\\alpha_*\\in [1,2]$ which is an interval of length 1 and\n",
"further implies the first digit of $\\alpha_*$ is one.\n",
"\n",
"In general, since the first digit is one and the rest are\n",
"after the decimal point, to obtain $k$ significant digits\n",
"it is required that the\n",
"length of the interval be less than $5\\times 10^{-k}$.\n",
"Consequently, taking the number of interations $n$ such\n",
"that\n",
"$$\n",
" {1\\over 2^n}< 5\\times 10^{-k}\n",
"$$\n",
"or equivalently so\n",
"$$\n",
" n > {\\log(0.2 \\times 10^{k})\\over \\log 2}\n",
" = 1+ (k-1){\\log 10 \\over \\log 2}.\n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"$ (generic function with 1 method)"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Taking $k=4,6$ and $8$ yields"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"For 4 significant digits use 11 iterations\n",
"For 6 significant digits use 18 iterations\n",
"For 8 significant digits use 25 iterations\n"
]
}
],
"source": [
"for k=4:2:8\n",
" n=Integer(ceil(1+(k-1)*log(10)/log(2)));\n",
" println(\"For $k significant digits use $n iterations\")\n",
"end"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**9.** Define\n",
"$$\n",
" \\alpha^*=\\inf\\Big\\{\\alpha: |x_{2n}| \n",
" \\hbox{ is bounded as }n\\to\\infty\\Big\\}.\n",
"$$\n",
"Intuitively $\\alpha^*$ is the smallest value of $\\alpha$\n",
"such that $|x_{2n}|$ is bounded.\n",
"Modify the program from the previous step to obtain\n",
"an approximation of $\\alpha^*$.\n",
"Include the output and describe what modifications\n",
"were made to the code."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The main difference is that the function *isoddbounded* needs to\n",
"be replaced by *isevenbounded* which stops at the 50th iteration\n",
"rather than the 51st iteration."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"isevenbounded (generic function with 1 method)"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function isevenbounded(alpha)\n",
" x=alpha\n",
" for n=1:49\n",
" x=(1+1/x)^n\n",
" end\n",
" return abs(x)<2\n",
"end"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then since"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"false"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"isevenbounded(1)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"isevenbounded(2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"One also needs to switch the logic in the\n",
"if statement to reassign the upper index $b$ of\n",
"the interval\n",
"when $x_{2n}$ is bounded and lower index $a$\n",
"when it's not."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"alpha^* in [1.18701171875,1.1875]\n"
]
}
],
"source": [
"a=1\n",
"b=2\n",
"for n=1:11\n",
" c=(a+b)/2\n",
" if isevenbounded(c)\n",
" b=c\n",
" else\n",
" a=c\n",
" end\n",
"end\n",
"println(\"alpha^* in [\",a,\",\",b,\"]\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**10.** Based on the numerical evidence obtained in the previous two problems conjecturewhether the values of\n",
"$\\alpha_*$ and $\\alpha^*$ are equal or different."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After $11$ iterations $\\alpha_*$ are and $\\alpha^*$ are still in the\n",
"same interval. This numerical evidence suggests\n",
"that $\\alpha_*=\\alpha^*$. For greater confirmation, we check after\n",
"$25$ iterations."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"alpha_* in [1.187452346086502,1.1874523758888245]\n"
]
}
],
"source": [
"a=1\n",
"b=2\n",
"for n=1:25\n",
" c=(a+b)/2\n",
" if isoddbounded(c)\n",
" a=c\n",
" else\n",
" b=c\n",
" end\n",
"end\n",
"println(\"alpha_* in [\",a,\",\",b,\"]\")"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"alpha^* in [1.187452346086502,1.1874523758888245]\n"
]
}
],
"source": [
"a=1\n",
"b=2\n",
"for n=1:25\n",
" c=(a+b)/2\n",
" if isevenbounded(c)\n",
" b=c\n",
" else\n",
" a=c\n",
" end\n",
"end\n",
"println(\"alpha^* in [\",a,\",\",b,\"]\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Even for this much smaller interval we numerically see\n",
"that $\\alpha_*$ and $\\alpha^*$ are still in the same interval.\n",
"This further suggests they are equal."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**11.** [Extra Credit] Use rigorous mathematical analyisis \n",
"to prove the conjecture stated in the previous step.\n",
"Alternatively, further support your conjecture by computing\n",
"additional digits of $\\alpha_*$ and $\\alpha^*$ using the\n",
"BigFloat arbitrary precision arithmetic built\n",
"into the Julia programming language."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The reference cited in question 5 proves that $\\alpha_*=\\alpha^*$.\n",
"For extra credit, an more explanation how the theory in those works\n",
"implies $\\alpha_*=\\alpha^*$ and a brief description of the\n",
"techniques used, if not a rephrasing of the full proof.\n",
"An original proof of this result would be even better.\n",
"\n",
"We finish with an example of using BigFloat arbitrary precision\n",
"arithmetic to show that $\\alpha_*$ and $\\alpha^*$ agree to many\n",
"many digits."
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"function bigoddbounded(alpha)\n",
" x=alpha\n",
" for n=1:250\n",
" x=(1+1/x)^n\n",
" end\n",
" return abs(x)<2\n",
"end\n",
"function bigevenbounded(alpha)\n",
" x=alpha\n",
" for n=1:249\n",
" x=(1+1/x)^n\n",
" end\n",
" return abs(x)<2\n",
"end;"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"alpha_* in [\n",
"1.187452351126501054595480158396519351215692681585860353010104126198780418723321,\n",
"1.187452351126501054595480158396519351215692681585860353010104126198780418723338]\n"
]
}
],
"source": [
"a=big(1)\n",
"b=big(2)\n",
"for n=1:256\n",
" c=(a+b)/2\n",
" if bigoddbounded(c)\n",
" a=c\n",
" else\n",
" b=c\n",
" end\n",
"end\n",
"println(\"alpha_* in [\\n\",a,\",\\n\",b,\"]\")"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"alpha^* in [\n",
"1.187452351126501054595480158396519351215692681585860353010104126198780418723321,\n",
"1.187452351126501054595480158396519351215692681585860353010104126198780418723338]\n"
]
}
],
"source": [
"a=big(1)\n",
"b=big(2)\n",
"for n=1:256\n",
" c=(a+b)/2\n",
" if bigevenbounded(c)\n",
" b=c\n",
" else\n",
" a=c\n",
" end\n",
"end\n",
"println(\"alpha^* in [\\n\",a,\",\\n\",b,\"]\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The intervals are the same after 256 interations. This\n",
"implies that $\\alpha_*=\\alpha^*$ agree to within"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.727233711018888925077270372560079914223200072887256277004740694033718360632485e-77"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b-a"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"or equivalently are the same to at least $77$ decimal digits."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.5.2",
"language": "julia",
"name": "julia-1.5"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}