diff --git a/content/GA_1_5/GA_1_5_Analysis.ipynb b/content/GA_1_5/GA_1_5_Analysis.ipynb index 82e41060413b351d3681093a22191836fdff9922..b7dc7448d8046cb123b6d591b071b189610968ec 100644 --- a/content/GA_1_5/GA_1_5_Analysis.ipynb +++ b/content/GA_1_5/GA_1_5_Analysis.ipynb @@ -32,9 +32,9 @@ "source": [ "## Overview:\n", "\n", - "Numerical derivatives are required to solve differential equations in numerical modelling and they can also be applied to data. To understand its intricacies, the ice thickness data of the Nenana River will be applied using the three derivative approximations.\n", + "Numerical derivatives are required to solve differential equations in numerical modelling and they can also be applied to data. To understand its intricacies, the three derivative approximations will be applied using the ice thickness data of the Nenana River.\n", "\n", - "Taylor Series Expansions are necessary to understand the limitations of numerical models based on finite differences/finite elements. In particular, the approximation of derivatives/integrals and its effect on representing physical systems. In the majority of cases, we use Taylor as an approximation of non-linear functions that do not have mathematically simple solutions and instead we use a polynomial to locally approximate. However, it is crucial to understand that the result is **only accurate over a small interval**. For this project, we will look at a simple function that we can solve analytically and compare our Taylor approximations. " + "Taylor Series Expansions are necessary to understand the limitations of numerical models based on finite differences/finite elements. In particular, the approximation of derivatives/integrals and its effect on representing physical systems. In the majority of cases, we use Taylor as an approximation of non-linear functions that do not have mathematically simple solutions and instead use a polynomial to locally approximate. However, it is crucial to understand that the result is **only accurate over a small interval**. For this project, we will look at a simple function that we can solve analytically and compare with our Taylor approximations. " ] }, { @@ -314,7 +314,7 @@ "\n", "**Beware: if you follow the derivation in the textbook, the distances $x_{i+1}-x_i$ and $x_{i}-x_{i-1}$ are assumed to be the same for all points (and between $x_{i-1}$, $x_i$ and $x_{i+1}$). That is not the case in this data set. Therefore, you must evaluate the derivate at some location between each data point that satisfies this criteria.** (Hint: the middle!). \n", "\n", - "<em>Note that it is not necessary to define the \"new\" locations, you can write them directly in the scatter plot arguments.</em>\n", + "<em>Note that it is not necessary to define the \"new\" points that the derivative is evaluated at, you can write them directly in the scatter plot arguments.</em>\n", "</p>\n", "</div>" ] @@ -396,7 +396,7 @@ "id": "f4952a25", "metadata": {}, "source": [ - "_Insert your derivation here._" + "_You will be asked to include your derivation in the Report, but you can also include it here._" ] }, { @@ -414,16 +414,16 @@ "source": [ "<div style=\"background-color:#AABAB2; color: black; width:95%; vertical-align: middle; padding:15px; margin: 10px; border-radius: 10px\">\n", "<p>\n", - "<b>Task 2.1:</b> Derive the Taylor series expansion terms.\n", + "<b>Task 2.1:</b> Derive the Taylor series expansion terms:\n", "\n", - "<u>On paper</u>, obtain the <b>first four</b> derivatives of the Taylor series for the expression \n", + "<u>On paper</u>, obtain the <b>first four</b> derivatives for the expression: \n", "$$\n", "f(x)= 2\\cos(x)+\\sin(x) \n", "$$ \n", "\n", "Once you obtain the expressions, evaluate them around the point $x_0=\\pi$.\n", "\n", - "These terms will be used later to assess the effects of using more or less terms in the approximation as well as the distance from $x_0$.\n", + "These terms will be used later to assess the effects of using more or less terms in the approximation as well as the distance from $x_0$ later on in the notebook.\n", "\n", "Use the following markdown cell to include your derivation of the Taylor series terms.\n", "\n", @@ -523,7 +523,7 @@ "<p>\n", "<b>Task 2.4:</b> Define the expansion point and write the Taylor series expansion of first, second, third and fourth order. \n", "\n", - "Complete the functions in the code cell below, the `taylor_#` refers to the order of the Taylor approximation and <code>x0</code> the expansion point.\n", + "Complete the functions in the code cell below, the `taylor_#` refers to the order of the Taylor approximation and <code>x0</code> the expansion point, using our previously defined $x_0$..\n", "\n", "</p>\n", "</div>\n" @@ -696,7 +696,7 @@ "id": "f0246dee-b058-40c0-bbf8-c491c11fd008", "metadata": {}, "source": [ - "_Insert your solution here._\n" + "_You will be asked to include your derivation in the Report, but you can also include it here._\n" ] }, { @@ -790,6 +790,7 @@ "ax.set_xlabel('x')\n", "ax.set_ylabel('y')\n", "ax.set_zlabel('f(x, y)')\n", + "plt.legend()\n", "\n", "# Show the plot\n", "plt.title('Original Function vs. Taylor Approximation')\n", diff --git a/content/GA_1_5/GA_1_5_Analysis_solution.ipynb b/content/GA_1_5/GA_1_5_Analysis_solution.ipynb index 9f113e5c0ca5781fab9f888c15b5cc85fdd446a6..ca86a40cba2ac31d1cd0f91498ac9f09740ba188 100644 --- a/content/GA_1_5/GA_1_5_Analysis_solution.ipynb +++ b/content/GA_1_5/GA_1_5_Analysis_solution.ipynb @@ -373,9 +373,9 @@ "\n", "<b>Task 1.4:</b> Now apply central differences and plot them. \n", "\n", - "**Beware: if you follow the derivation in the textbook, the distances $x_{i+1}-x_i$ and $x_{i}-x_{i-1}$ are assumed to be the same for all points (and between $x_{i-1}$, $x_i$ and $x_{i+1}$). That is not the case in this data set. Therefore, you must evaluate the derivate at some location between each data point that satisfies this criteria.** (Hint: the middle!). \n", + "**Beware: if you follow the derivation in the textbook, the distances $x_{i+1}-x_i$ and $x_{i}-x_{i-1}$ are assumed to be the same for all points (and between $x_{i-1}$, $x_i$ and $x_{i+1}$). That is not the case in this data set. Therefore, you must evaluate the derivate at some location between each data point that satisfies this criteria.** (Hint: the middle!). **Also, remember, we are only changing the time indices.**\n", "\n", - "<em>Note that it is not necessary to define the \"new\" locations, you can write them directly in the scatter plot arguments.</em>\n", + "<em>Note that it is not necessary to define the \"new\" points that the derivative is evaluated at, you can write them directly in the scatter plot arguments.</em>\n", "</p>\n", "</div>" ] @@ -467,7 +467,7 @@ "source": [ "<div style=\"background-color:#AABAB2; color: black; width:95%; vertical-align: middle; padding:15px; margin: 10px; border-radius: 10px\">\n", "<p>\n", - "<b>Task 2.0:</b> Write the derivation of the backward difference second order accurate! Insert an image of your math below. \n", + "<b>Task 2.0:</b> Write the derivation of the backward difference accurate to the second order!\n", "\n", "</p>\n", "</div>" @@ -478,7 +478,7 @@ "id": "f4952a25", "metadata": {}, "source": [ - "_Insert your derivation here._" + "_You will be asked to include your derivation in the Report, but you can also include it here._" ] }, { @@ -496,16 +496,16 @@ "source": [ "<div style=\"background-color:#AABAB2; color: black; width:95%; vertical-align: middle; padding:15px; margin: 10px; border-radius: 10px\">\n", "<p>\n", - "<b>Task 2.1:</b> Derive the Taylor series expansion terms.\n", + "<b>Task 2.1:</b> Derive the Taylor series expansion terms:\n", "\n", - "<u>On paper</u>, obtain the <b>first four</b> derivatives of the Taylor series for the expression \n", + "<u>On paper</u>, obtain the <b>first four</b> derivatives for the expression: \n", "$$\n", "f(x)= 2\\cos(x)+\\sin(x) \n", "$$ \n", "\n", "Once you obtain the expressions, evaluate them around the point $x_0=\\pi$.\n", "\n", - "These terms will be used later to assess the effects of using more or less terms in the approximation as well as the distance from $x_0$.\n", + "These terms will be used later to assess the effects of using more or less terms in the approximation as well as the distance from $x_0$ later on in the notebook.\n", "\n", "Use the following markdown cell to include your derivation of the Taylor series terms.\n", "\n", @@ -667,7 +667,7 @@ "<p>\n", "<b>Task 2.4:</b> Define the expansion point and write the Taylor series expansion of first, second, third and fourth order. \n", "\n", - "Complete the functions in the code cell below, the `taylor_#` refers to the order of the Taylor approximation and <code>x0</code> the expansion point.\n", + "Complete the functions in the code cell below, the `taylor_#` refers to the order of the Taylor approximation and <code>x0</code> the expansion point, using our previously defined $x_0$.\n", "\n", "</p>\n", "</div>\n" @@ -712,7 +712,7 @@ "source": [ "<div style=\"background-color:#AABAB2; color: black; width:95%; vertical-align: middle; padding:15px; margin: 10px; border-radius: 10px\">\n", "<p>\n", - "<b>Task 2.5:</b> Plot your function along with your Taylor orders to illustrate the local approximations of the inclusions of each extra term. \n", + "<b>Task 2.5:</b> Plot your function along with your Taylor orders to illustrate the local approximations of the inclusions of each extra term. Add your own labels based on the formatting of the first example plot.\n", "\n", "\n", "\n", @@ -896,7 +896,7 @@ "id": "f0246dee-b058-40c0-bbf8-c491c11fd008", "metadata": {}, "source": [ - "_Insert your solution here._\n" + "_You will be asked to include your derivation in the Report, but you can also include it here._\n" ] }, { @@ -1067,6 +1067,7 @@ "ax.set_xlabel('x')\n", "ax.set_ylabel('y')\n", "ax.set_zlabel('f(x, y)')\n", + "plt.legend()\n", "\n", "# Show the plot\n", "plt.title('Original Function vs. Taylor Approximation')\n",