Skip to content

Commit

Permalink
latest
Browse files Browse the repository at this point in the history
  • Loading branch information
williamgilpin committed Dec 27, 2023
1 parent 0cee49c commit f12d719
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 0 additions & 4 deletions talks/resources/von_karman_street/file_locations.txt

This file was deleted.

21 changes: 16 additions & 5 deletions talks/time_and_space_complexity_recursion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -592,17 +592,26 @@
"source": [
"### Improving our calculation of doubling values\n",
"\n",
"Now let's return to our logistic map. We will use a binary search to find the values of $r$ at which the period doubles. By using a binary search, we can avoid scanning the large set of \"intermediate\" values of $r$ for which the period does not double. \n",
"Now let's return to our logistic map. We will use a binary search to find the values of $r$ at which the period doubles. By using a binary search, we can avoid scanning the large set of intermediate values of $r$ for which the period does not double. \n",
"\n",
"There a are a few nuances to our approach compared to traditional binary search.\n",
"\n",
"1. We need to perform a three-way comparison between the period of the logistic map at $r_{max}$, $r_{middle}$, and $r_{max}_$. This is because the period doubling may not occur exactly at $r$. We encapsulate this comparison within a three-way comparison function.\n",
"2. We need to find several values of $r$ corresponding to critical doubling values, rather than just one value. This will require multiple binary searches over different intervals, as well as a heuristic for modifying the intervals to ensure that we don't repeatedly find the same root. Here, we initially search the full $r$ interval. Upon finding a doubling value, we shrink the interval so that its rightmost value is just below the root we just found by some tolerance $\\epsilon$. We then search the new interval for the next doubling value. We repeat this process until we have found all the doubling values. This heuristic will fail if the period doubling values are closer than $\\epsilon$ apart. In this case, we would need to reduce $\\epsilon$ and try again. This same difficulty manifests in methods used to find multiple roots (zero crossings) of continuous functions."
"1. We need to perform a **three-pointer comparison** among the periods of the logistic map at $r_{min}$, $r_{middle}$, and $r_{max}$. This is because the period doubling may not occur exactly at $r$. We thus implement a three-way comparison function.\n",
"\n",
"2. We need to find several values of $r$ corresponding to critical doubling values, rather than just one value. This requires multiple binary searches over different intervals, as well as a heuristic for modifying the intervals to ensure that we don't repeatedly find the same root. We break down this process as follows:\n",
"\n",
" + We search the full $r$ interval. \n",
" \n",
" + Upon finding a doubling value, we shrink the interval so that its rightmost value is just below the root we just found by some tolerance $\\epsilon$. \n",
" \n",
" + We then search the new interval for the next doubling value. \n",
" \n",
" + We repeat this process until we have found all the doubling values. This heuristic will fail if the period doubling values are closer than $\\epsilon$ apart. In this case, we would need to reduce $\\epsilon$ and try again. This same difficulty manifests in methods used to find multiple roots (zero crossings) of continuous functions."
]
},
{
"cell_type": "code",
"execution_count": 586,
"execution_count": null,
"id": "a847238c",
"metadata": {},
"outputs": [
Expand All @@ -625,6 +634,8 @@
}
],
"source": [
"\n",
"## Three-way comparison function\n",
"def check_period_doubling2(left_traj, middle_traj, right_traj):\n",
" \"\"\"\n",
" Check if the period has doubled from the previous trajectory to the current \n",
Expand Down Expand Up @@ -1246,7 +1257,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.11.5"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit f12d719

Please sign in to comment.