{"id":2113,"date":"2024-03-20T08:25:45","date_gmt":"2024-03-20T12:25:45","guid":{"rendered":"https:\/\/blogs.mathworks.com\/matlab\/?p=2113"},"modified":"2024-03-20T08:25:45","modified_gmt":"2024-03-20T12:25:45","slug":"understanding-tolerances-in-ordinary-differential-equation-solvers","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/matlab\/2024\/03\/20\/understanding-tolerances-in-ordinary-differential-equation-solvers\/","title":{"rendered":"Understanding Tolerances in Ordinary Differential Equation Solvers"},"content":{"rendered":"<div class = rtcContent><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><a href = \"https:\/\/matlab.mathworks.com\/open\/github\/v1?repo=mathworks\/matlab-blog&amp;file=2024\/ODETolerances\/ODEtolerances.mlx\"><img class = \"imageNode\" src = \"http:\/\/blogs.mathworks.com\/matlab\/files\/2024\/03\/ODEtolerances_1.png\" width = \"155\" height = \"26\" alt = \"\" style = \"vertical-align: baseline; width: 155px; height: 26px;\"><\/img><\/a><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>This is a guest blog post by Michael Hosea, a numerical analyst at MathWorks. He works on <\/span><a href = \"https:\/\/uk.mathworks.com\/products\/matlab-coder.html\"><span>MATLAB Coder<\/span><\/a><span> and on <\/span><a href = \"https:\/\/blogs.mathworks.com\/matlab\/2023\/10\/03\/the-new-solution-framework-for-ordinary-differential-equations-odes-in-matlab-r2023b\/\"><span>MATLAB\u2019s ODE<\/span><\/a><span> and integral solvers.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><a href = \"https:\/\/blogs.mathworks.com\/matlab\/2023\/10\/03\/the-new-solution-framework-for-ordinary-differential-equations-odes-in-matlab-r2023b\/\"><span>MATLAB's ODE solvers<\/span><\/a><span> have tolerances that the user can change. Users are often reluctant to set these tolerances, perhaps because they think they are only for power users, and they are reluctant to alter \u201cfactory settings.\u201d  The sentiment is understandable. Tolerances do occur in many different contexts in MATLAB, and some of them <\/span><span style=' font-style: italic;'>are<\/span><span> that sort of thing. For example, you probably won't need or want to change the default tolerance in the <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/rank.html\"><span style=' font-family: monospace;'>rank<\/span><\/a><span> function.  But as we're going to see, that's not the situation with ODE solvers. It may surprise you to hear that we don't actually know how to set <\/span><span style=' font-style: italic;'>your<\/span><span> tolerances in an ODE Solver.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Most of what follows will be geared towards understanding how to do exactly that, but the concepts apply much more broadly. The application is direct with <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/integral.html\"><span style=' font-family: monospace;'>integral<\/span><\/a><span style=' font-family: monospace;'>,<\/span><span> <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/ismembertol.html\"><span style=' font-family: monospace;'>ismembertol<\/span><\/a><span style=' font-family: monospace;'>,<\/span><span> and <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/uniquetol.html\"><span style=' font-family: monospace;'>uniquetol<\/span><\/a><span>, to name a few, despite differences in how tolerances are supplied and used.  Even more generally, the principles apply in <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/ways-to-write-unit-tests.html\"><span>unit testing<\/span><\/a><span> when one has exact or reference values to compare with results from software being tested.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Of course we did have <\/span><span style=' font-style: italic;'>reasons<\/span><span> for the default tolerances used in the ODE solvers. We wanted the default tolerances to request enough accuracy for plotting, and it probably doesn't take a lot of accuracy to do that. Also, we're using the same defaults for all the solvers. Consequently, they needed to work with low-order and high-order solvers alike. Loose tolerances tend to work well enough with high-order solvers. On the other hand, I don't know if you've ever tried using tight tolerances with low-order solvers, but patience is virtue. Barring enough of that, ctrl-c is your friend.  The resulting default tolerances are rather loose. Unfortunately, we don't know the context of the problem you are trying to solve. You might want more accuracy than these default tolerances are requesting, particularly if you are using one of the higher order methods. So let's talk about about the tolerances and how to go about setting them for <\/span><span style=' font-style: italic;'>your<\/span><span> purposes.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Fortunately, no great understanding of the software is needed to set tolerances in a reasonable way, only an understanding of the <\/span><span style=' font-style: italic;'>problem<\/span><span> you are trying to solve and what these tolerances mean. We should be able to set reasonable tolerances if we can answer the following questions about the problem we are trying to solve:<\/span><\/div><ol  style = 'margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px; '><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><span>How small of a value do we consider negligible?<\/span><\/li><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><span>How precise is the data that defines the problem?<\/span><\/li><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><span>What <\/span><span style=' font-style: italic;'>percentage<\/span><span> error is small enough to ignore? Or, put differently, how many significant digits of accuracy do we need?<\/span><\/li><\/ol><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Our ODE solvers allow you to set two different tolerances. One is the <\/span><span style=' font-style: italic;'>absolute tolerance<\/span><span> and the other <\/span><span style=' font-style: italic;'>relative tolerance<\/span><span>. These two work together. Absolute tolerance is the simpler of the two, so let's start there.<\/span><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>Absolute Tolerance <\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>We say an approximate result <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span> is within an <\/span><span style=' font-style: italic;'>absolute tolerance<\/span><span> <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">A<\/span><span> of an exact or reference value <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span> if <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>-<\/mo><mi mathvariant=\"italic\">A<\/mi><mo>\u2264<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>\u2264<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>+<\/mo><mi mathvariant=\"italic\">A<\/mi><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Here we assume <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;mo&gt;\u2265&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">A<\/mi><mo>\u2265<\/mo><mn>0<\/mn><mo>.<\/mo><\/mrow><\/math><\/span><span> Subtracting <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/math><\/span><span> from each term gives us <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mo>-<\/mo><mi mathvariant=\"italic\">A<\/mi><mo>\u2264<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>\u2264<\/mo><mi mathvariant=\"italic\">A<\/mi><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>which we can write succinctly as <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mo stretchy=\"false\">|<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><mo>\u2264<\/mo><mi mathvariant=\"italic\">A<\/mi><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>When <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span> is the exact value we are trying to approximate with <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span>, we call the quantity on the left the <\/span><span style=' font-style: italic;'>absolute error<\/span><span>.<\/span><\/div><h3  style = 'margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: 700; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;absolute&lt;\/mi&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;error&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-9px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mi mathvariant=\"normal\">absolute<\/mi><mtext>\u2009<\/mtext><mi mathvariant=\"normal\">error<\/mi><mo>=<\/mo><mo stretchy=\"false\">|<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><\/mrow><\/math><\/span><\/h3><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Before we go too far, let's just point out the obvious. We don't usually know <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span>. If we did, there wouldn't be much point in doing any work to approximate it unless we were just testing the code. Codes like <\/span><span style=' font-family: monospace;'>integral<\/span><span> and the ODE solvers compute an <\/span><span style=' font-style: italic;'>estimate<\/span><span> of the absolute error and use that in place of  <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mo stretchy=\"false\">|<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><\/mrow><\/math><\/span><span>. Sometimes it is an approximate bound on the error rather than an estimate <\/span><span style=' font-style: italic;'>per se<\/span><span>. Exactly how this is done isn't important to our discussion here except to say that if things are going well, this estimate should be about the same size as the actual error.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>So, we're done, right? An absolute tolerance should be able to get the job of describing the accuracy we need done no matter what we're doing. Well, yes and no. Suppose you're solving a problem where the correct answer is, say, 10 meters, and you'd like an answer to be correct to within <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mo&gt;\u00b1&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mo>\u00b1<\/mo><mn>0<\/mn><mo>.<\/mo><mn>5<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/mrow><\/math><\/span><span>. So, for that, you'd set your absolute tolerance to <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;0005&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;m&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">A<\/mi><mo>=<\/mo><mtext>\u2009<\/mtext><mn>0<\/mn><mo>.<\/mo><mn>0005<\/mn><mi mathvariant=\"normal\">m<\/mi><\/mrow><\/math><\/span><span>. Notice that the absolute tolerance in a physical context has <\/span><span style=' font-style: italic;'>units<\/span><span>, in this case meters because <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span> and <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/math><\/span><span> are in meters. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>So we write some code that defines <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span style=' font-family: monospace;'>    AbsoluteTolerance = 0.0005;<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>and we keep the units in our head. We're used to doing that. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>But what if the solution to our problem isn't just a scalar value, rather an array of values representing different kinds of quantities, maybe lengths, areas, volumes, mass, temperature, you name it. Assuming the software allows you to set a different absolute tolerance for each element of a solution array in the first place, you'd need a pretty good idea of the size of the solution element to decide ahead of time what the absolute tolerance on each element should be. Probably we can't just take a number like 0.0005 and think it's going to be appropriate for everything. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Moreover, how did we decide that <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;mo&gt;\u00b1&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><mo>\u00b1<\/mo><mn>0<\/mn><mo>.<\/mo><mn>5<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/math><\/span><span> was reasonable in the first place? For something 10m long, that's rather precise for many practical purposes, often enough even for something only 1m long, but it isn't for something 0.001m long. In that case it covers a substantial difference percentage-wise. Sometimes it's not so much the absolute error that concerns us, rather the error in a \"percentage\" sense.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>And wouldn't it be convenient to have a way of describing the accuracy we want using a <\/span><span style=' font-style: italic;'>dimensionless<\/span><span> tolerance? It would be nice to have something that automatically adjusts itself for different scaling, something that we don't have to change if we merely restate the same problem using different units of measurement. After all, it shouldn't be any harder or easier to compute something to 0.5mm than 0.0005m; that's the same distance.<\/span><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>Relative Tolerance<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>You're probably familiar with the concept of <\/span><span style=' font-style: italic;'>significant digits<\/span><span> or <\/span><span style=' font-style: italic;'>significant figures <\/span><span>when reporting data. The basic idea is that if you see the measurement of some kind, say <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">x<\/mi><mo>=<\/mo><mn>1<\/mn><mo>.<\/mo><mn>5<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/mrow><\/math><\/span><span>, it corresponds to an unspecified exact quantity that has (hopefully) been correctly rounded to <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><mn>1<\/mn><mo>.<\/mo><mn>5<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/math><\/span><span>. This means that <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;45&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;exact&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;&amp;lt;&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;55&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mn>1<\/mn><mo>.<\/mo><mn>45<\/mn><mi mathvariant=\"normal\">mm<\/mi><mo>\u2264<\/mo><msub><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">exact<\/mi><\/mrow><\/msub><mo>&lt;<\/mo><mn>1<\/mn><mo>.<\/mo><mn>55<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/mrow><\/math><\/span><span> <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>since that is the interval of numbers that rounds to <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><mn>1<\/mn><mo>.<\/mo><mn>5<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/math><\/span><span>. Expressed in the parlance of absolute error, we're saying that the absolute error <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;exact&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;05&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mo stretchy=\"false\">|<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">exact<\/mi><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><mo>\u2264<\/mo><mn>0<\/mn><mo>.<\/mo><mn>05<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/mrow><\/math><\/span><span>. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>That formulation includes the upper bound of <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;55&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><mn>1<\/mn><mo>.<\/mo><mn>55<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/math><\/span><span>, but we needn't quibble about that insofar as tolerances are ultimately used with error estimates, anyway. If we had instead written <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;500&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">x<\/mi><mo>=<\/mo><mn>1<\/mn><mo>.<\/mo><mn>500<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/mrow><\/math><\/span><span>, we would be implying that <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;4995&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;exact&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;&amp;lt;&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;5005&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>1<\/mn><mo>.<\/mo><mn>4995<\/mn><mi mathvariant=\"normal\">mm<\/mi><mo>\u2264<\/mo><msub><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">exact<\/mi><\/mrow><\/msub><mo>&lt;<\/mo><mn>1<\/mn><mo>.<\/mo><mn>5005<\/mn><mi mathvariant=\"normal\">mm<\/mi><\/mrow><\/math><\/span><span>, <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>hence that <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;exact&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;0005&lt;\/mn&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;mm&lt;\/mi&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mo stretchy=\"false\">|<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">exact<\/mi><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><mo>\u2264<\/mo><mn>0<\/mn><mo>.<\/mo><mn>0005<\/mn><mi mathvariant=\"normal\">mm<\/mi><mo>.<\/mo><\/mrow><\/math><\/span><span> <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Here again we have, without apology, added in the upper end point. In the first case we say that we have 2 significant digits, and the latter 4. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Note that 0.05 can be written as <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msubsup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi data-category=&quot;placeholder-atom&quot;&gt;&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msubsup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-8px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>5<\/mn><mo>\u00d7<\/mo><msubsup><mrow><mn>10<\/mn><\/mrow><mrow><mi data-category=\"placeholder-atom\"><\/mi><\/mrow><mrow data-category=\"placeholder\"><mo>-<\/mo><mn>2<\/mn><\/mrow><\/msubsup><\/mrow><\/math><\/span><span>, and 0.0005 as <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msubsup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi data-category=&quot;placeholder-atom&quot;&gt;&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;4&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msubsup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-8px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>5<\/mn><mo>\u00d7<\/mo><msubsup><mrow><mn>10<\/mn><\/mrow><mrow><mi data-category=\"placeholder-atom\"><\/mi><\/mrow><mrow data-category=\"placeholder\"><mo>-<\/mo><mn>4<\/mn><\/mrow><\/msubsup><\/mrow><\/math><\/span><span>. The exponents seem to indicate the number of significant digits. Unfortunately, the conjecture doesn't hold up. To see this, let's just change units of measurement. That shouldn't change the precision of anything. Switching from millimeters to microns, we have in the first case<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mn&gt;1450&lt;\/mn&gt;&lt;mi&gt;\u03bc&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;exact&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;&amp;lt;&lt;\/mo&gt;&lt;mn&gt;1550&lt;\/mn&gt;&lt;mi&gt;\u03bc&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mn>1450<\/mn><mi>\u03bc<\/mi><mo>\u2264<\/mo><msub><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">exact<\/mi><\/mrow><\/msub><mo>&lt;<\/mo><mn>1550<\/mn><mi>\u03bc<\/mi><\/mrow><\/math><\/span><span> <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>and in the second,<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;1499&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mi&gt;\u03bc&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;exact&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;&amp;lt;&lt;\/mo&gt;&lt;mn&gt;1500&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mi&gt;\u03bc&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>1499<\/mn><mo>.<\/mo><mn>5<\/mn><mi>\u03bc<\/mi><mo>\u2264<\/mo><msub><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">exact<\/mi><\/mrow><\/msub><mo>&lt;<\/mo><mn>1500<\/mn><mo>.<\/mo><mn>5<\/mn><mi>\u03bc<\/mi><\/mrow><\/math><\/span><span> .<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>And again, in the language of absolute error, we have <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;exact&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;50&lt;\/mn&gt;&lt;mi&gt;\u03bc&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mo stretchy=\"false\">|<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">exact<\/mi><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><mo>\u2264<\/mo><mn>50<\/mn><mi>\u03bc<\/mi><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>and<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;exact&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mi&gt;\u03bc&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mo stretchy=\"false\">|<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">exact<\/mi><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><mo>\u2264<\/mo><mn>0<\/mn><mo>.<\/mo><mn>5<\/mn><mi>\u03bc<\/mi><\/mrow><\/math><\/span><span>, <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>respectively. The \"absolute tolerances\" on the right are <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;5&lt;\/mi&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msubsup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi data-category=&quot;placeholder-atom&quot;&gt;&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msubsup&gt;&lt;mi&gt;\u03bc&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-8px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">5<\/mi><mo>\u00d7<\/mo><msubsup><mrow><mn>10<\/mn><\/mrow><mrow><mi data-category=\"placeholder-atom\"><\/mi><\/mrow><mrow data-category=\"placeholder\"><mo>+<\/mo><mn>1<\/mn><\/mrow><\/msubsup><mi>\u03bc<\/mi><\/mrow><\/math><\/span><span> and <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;5&lt;\/mi&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msubsup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi data-category=&quot;placeholder-atom&quot;&gt;&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msubsup&gt;&lt;mi&gt;\u03bc&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-8px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">5<\/mi><mo>\u00d7<\/mo><msubsup><mrow><mn>10<\/mn><\/mrow><mrow><mi data-category=\"placeholder-atom\"><\/mi><\/mrow><mrow data-category=\"placeholder\"><mo>-<\/mo><mn>1<\/mn><\/mrow><\/msubsup><mi>\u03bc<\/mi><\/mrow><\/math><\/span><span>. Now the exponents don't seem to bear any relationship to the number of significant digits.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The problem is clearly scaling. Because absolute error has units of measurement, merely changing units of measurement rescales the data. So how can we express the idea that we want a certain number of digits to be correct? We need something that isn't sensitive to scaling. Enter the idea of <\/span><span style=' font-style: italic;'>relative error:<\/span><\/div><h3  style = 'margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: 700; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;relative&lt;\/mi&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;error&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mfrac&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-22px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mi mathvariant=\"normal\">relative<\/mi><mtext>\u2009<\/mtext><mi mathvariant=\"normal\">error<\/mi><mo>=<\/mo><mfrac><mrow><mrow><mo>|<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><mo>|<\/mo><\/mrow><\/mrow><mrow><mo stretchy=\"false\">|<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><\/mrow><\/mfrac><\/mrow><\/math><\/span><\/h3><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>All we've done here is divide the absolute errory by <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mrow><mo>|<\/mo><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><mo>|<\/mo><\/mrow><\/mrow><\/math><\/span><span>. Obviously we are assuming that <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;\u2260&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>\u2260<\/mo><mn>0<\/mn><\/mrow><\/math><\/span><span>. More on that later. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Note that relative error is just the percentage difference formula with absolute values (and without the final multiplication by 100% to convert to percent)<\/span><span style=' font-weight: bold;'>. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span style=' font-weight: bold;'><\/span><\/div><h3  style = 'margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: 700; text-align: center; '><span>If you multiply a relative tolerance by 100%, you get the percentage error that the tolerance allows. <\/span><\/h3><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>This observation may help later when we discuss how to choose the relative tolerance.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>A hopeful sign is that the relative error is now dimensionless because the numerator and denominator have the same units. Obviously any scaling of <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span> cancels out. Let's use <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">R<\/span><span> from here on out to denote a relative error tolerance. So we want<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mfrac&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-17px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mfrac><mrow><mrow><mo>|<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><mo>|<\/mo><\/mrow><\/mrow><mrow><mo stretchy=\"false\">|<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><\/mrow><\/mfrac><mo>\u2264<\/mo><mi mathvariant=\"italic\">R<\/mi><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Clearing the fraction, we get<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;\u22c5&lt;\/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mrow><mo>|<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><mo>|<\/mo><\/mrow><mo>\u2264<\/mo><mi mathvariant=\"italic\">R<\/mi><mo>\u22c5<\/mo><mo stretchy=\"false\">|<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>That's usually how we use relative error in software, since it avoids the division. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Let's try this out on an example. Suppose <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;1234500&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>1234500<\/mn><\/mrow><\/math><\/span><span>. Looks like 5 significant digits there. Let's try <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msubsup&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;10&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi data-category=&quot;placeholder-atom&quot;&gt;&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msubsup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-8px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">R<\/mi><mo>=<\/mo><mn>5<\/mn><mo>\u00d7<\/mo><msubsup><mrow><mi mathvariant=\"normal\">10<\/mi><\/mrow><mrow><mi data-category=\"placeholder-atom\"><\/mi><\/mrow><mrow data-category=\"placeholder\"><mo>-<\/mo><mn>5<\/mn><\/mrow><\/msubsup><\/mrow><\/math><\/span><span>. Plugging in, this becomes<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;1234500&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;61&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;725&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mrow><mo>|<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><mn>1234500<\/mn><\/mrow><mo>|<\/mo><\/mrow><mo>\u2264<\/mo><mn>61<\/mn><mo>.<\/mo><mn>725<\/mn><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Which means that <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mn&gt;1234500&lt;\/mn&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;61&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;725&lt;\/mn&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;1234500&lt;\/mn&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mn&gt;61&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;725&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mn>1234500<\/mn><mo>-<\/mo><mn>61<\/mn><mo>.<\/mo><mn>725<\/mn><mo>\u2264<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>\u2264<\/mo><mn>1234500<\/mn><mo>+<\/mo><mn>61<\/mn><mo>.<\/mo><mn>725<\/mn><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>or<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mn&gt;1234438&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;275&lt;\/mn&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;1234561&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;725&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mn>1234438<\/mn><mo>.<\/mo><mn>275<\/mn><mo>\u2264<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>\u2264<\/mo><mn>1234561<\/mn><mo>.<\/mo><mn>725<\/mn><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>If we were to change the units on <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span>, we would also scale those end points by the same factor as <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span> itself is changed, just as if we had multiplied the inequality through by the scaling factor. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Unfortunately, those end points don't round to 1234500 when expressed with 5 significant digits. The interval is wider than we want it to be if we wanted to guarantee 5 significant digits correct. If, instead, we tighten it up to <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msubsup&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;10&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi data-category=&quot;placeholder-atom&quot;&gt;&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;6&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msubsup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-8px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">R<\/mi><mo>=<\/mo><mn>5<\/mn><mo>\u00d7<\/mo><msubsup><mrow><mi mathvariant=\"normal\">10<\/mi><\/mrow><mrow><mi data-category=\"placeholder-atom\"><\/mi><\/mrow><mrow data-category=\"placeholder\"><mo>-<\/mo><mn>6<\/mn><\/mrow><\/msubsup><\/mrow><\/math><\/span><span>and repeat the exercise, we end up with<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mn&gt;1234493&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;8275&lt;\/mn&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;1234506&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;1725&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mn>1234493<\/mn><mo>.<\/mo><mn>8275<\/mn><mo>\u2264<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>\u2264<\/mo><mn>1234506<\/mn><mo>.<\/mo><mn>1725<\/mn><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Now it's tighter than we needed, but those endpoints do round to 1234500 written to 5 significant digits. This generalizes:. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span><\/span><\/div><h3  style = 'margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: 700; text-align: center; '><span style=' font-weight: bold;'>A relative tolerance for at least <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">n<\/span><span style=' font-weight: bold;'> significant digits is <\/span><\/h3><h3  style = 'margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: 700; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msubsup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi data-category=&quot;placeholder-atom&quot;&gt;&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mrow data-category=&quot;structure&quot;&gt;&lt;mo data-category=&quot;static&quot;&gt;(&lt;\/mo&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;n&lt;\/mi&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mo data-category=&quot;static&quot;&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/msubsup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-12px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">R<\/mi><mo>=<\/mo><mn>5<\/mn><mo>\u00d7<\/mo><msubsup><mrow><mn>10<\/mn><\/mrow><mrow><mi data-category=\"placeholder-atom\"><\/mi><\/mrow><mrow data-category=\"placeholder\"><mo>-<\/mo><mrow data-category=\"structure\"><mo data-category=\"static\">(<\/mo><mrow data-category=\"placeholder\"><mi mathvariant=\"italic\">n<\/mi><mo>+<\/mo><mn>1<\/mn><\/mrow><mo data-category=\"static\">)<\/mo><\/mrow><\/mrow><\/msubsup><\/mrow><\/math><\/span><\/h3><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>You can use this relative tolerance when you don't know what <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span> is or if you want the same formula to work when <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/math><\/span><span> varies. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Just as an aside, the interval we would have wanted to see was<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mn&gt;1234450&lt;\/mn&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;1234550&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mn>1234450<\/mn><mo>\u2264<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>\u2264<\/mo><mn>1234550<\/mn><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>You might be curious what relative tolerance gives this. If you're not the least bit curious, skip to the next section, because we won't be using this later. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Define a preliminary tolerance <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msubsup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi data-category=&quot;placeholder-atom&quot;&gt;&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mrow data-category=&quot;structure&quot;&gt;&lt;mo data-category=&quot;static&quot;&gt;(&lt;\/mo&gt;&lt;mrow data-category=&quot;placeholder&quot;&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;n&lt;\/mi&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mo data-category=&quot;static&quot;&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/msubsup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-8px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">R<\/mi><mo>=<\/mo><mn>5<\/mn><mo>\u00d7<\/mo><msubsup><mrow><mn>10<\/mn><\/mrow><mrow><mi data-category=\"placeholder-atom\"><\/mi><\/mrow><mrow data-category=\"placeholder\"><mo>-<\/mo><mrow data-category=\"structure\"><mo data-category=\"static\">(<\/mo><mrow data-category=\"placeholder\"><mi mathvariant=\"italic\">n<\/mi><mo>+<\/mo><mn>1<\/mn><\/mrow><mo data-category=\"static\">)<\/mo><\/mrow><\/mrow><\/msubsup><\/mrow><\/math><\/span><span> as above. Then the relative tolerance that gives the loosest bounds that require <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">n<\/span><span> correct significant digits is<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;\u22c5&lt;\/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;ceil&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;c&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;c&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mi mathvariant=\"italic\">R<\/mi><mo>\u22c5<\/mo><msup><mrow><mn>10<\/mn><\/mrow><mrow><mrow><mo>(<\/mo><mrow><mi mathvariant=\"normal\">ceil<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">c<\/mi><\/mrow><mo>)<\/mo><\/mrow><mo>-<\/mo><mi mathvariant=\"italic\">c<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/msup><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>where<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;c&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;log&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mi mathvariant=\"italic\">c<\/mi><mo>=<\/mo><msub><mrow><mi mathvariant=\"normal\">log<\/mi><\/mrow><mrow><mn>10<\/mn><\/mrow><\/msub><mrow><mo>(<\/mo><mrow><mrow><mo>|<\/mo><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><mo>|<\/mo><\/mrow><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The exponent there is just the fractional part of <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">c<\/span><span>. In our example the tolerance works out to be <\/span><span style=' font-style: italic;'>about<\/span><span> 8.1 times larger than <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">R<\/span><span>. This should be no surprise since we already knew from our experimentation that <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">R<\/span><span> was too tight and<\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>10<\/mn><mi mathvariant=\"italic\">R<\/mi><\/mrow><\/math><\/span><span> too loose. There's nothing very nice or memorable there, and we can only construct this \"ideal\" relative tolerance if we know <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span>, so we will not make further use of this fact, but if you were setting up a unit test comparing software output to a known correct result, you could make use of it.<\/span><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>What if <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;bold-italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-10px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"bold-italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>0<\/mn><\/mrow><\/math><\/span><span>?<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The definition of relative error has a serious problem when the reference value <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span> is zero. The requirement<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;mo&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mfrac&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-17px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mfrac><mrow><mrow><mo>|<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><mo>|<\/mo><\/mrow><\/mrow><mrow><mo stretchy=\"false\">|<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><\/mrow><\/mfrac><mo>\u2264<\/mo><mi mathvariant=\"italic\">R<\/mi><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>becomes impossible to meet. As previously mentioned, we normally avoid the division, anyway, and evaluate <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;\u22c5&lt;\/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mo stretchy=\"false\">|<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><mo>\u2264<\/mo><mi mathvariant=\"italic\">R<\/mi><mo>\u22c5<\/mo><mo stretchy=\"false\">|<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>That avoids the division by zero, but it hardly helps very much when <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>0<\/mn><\/math><\/span><span> because the test is only satisfied when <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><mo>=<\/mo><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span>, i.e. when the absolute error is zero. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>It might be helpful to think about this as a limiting case. Consider a sequence of problems where the exact solution is not zero but is smaller and smaller in magnitude. Let's say the exact solution is <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;12345&lt;\/mn&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;K&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>12345<\/mn><mo>\u00d7<\/mo><msup><mrow><mn>10<\/mn><\/mrow><mrow><mo>-<\/mo><mi mathvariant=\"italic\">K<\/mi><\/mrow><\/msup><\/mrow><\/math><\/span><span> for increasing values of <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">K<\/span><span>.You might imagine that we're rewriting the same physical quantity in larger and larger units of measurement as <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">K<\/span><span> increases.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span><\/span><\/div><table  style = 'margin: 3px; border: 1px solid rgb(191, 191, 191); border-collapse: collapse; '><col\/><col\/><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">K<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mn&gt;12345&lt;\/mn&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;K&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mn>12345<\/mn><mo>\u00d7<\/mo><msup><mrow><mn>10<\/mn><\/mrow><mrow><mo>-<\/mo><mi mathvariant=\"italic\">K<\/mi><\/mrow><\/msup><\/mrow><\/math><\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>10<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>0.0000012345<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>20<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>0.00000000000000012345<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>30<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>0.000000000000000000000000012345<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>40<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>0.0000000000000000000000000000000000012345<\/span><\/div><\/td><\/tr><\/table><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span style=' font-style: italic;'>Leading<\/span><span> zeros to the <\/span><span style=' font-style: italic;'>right<\/span><span> of the decimal point aren't \"significant\" in the sense of significant digits, but obviously they determine the magnitude of the number. Relative error control is fine for all these values <\/span><span style=' font-weight: bold; font-style: italic;'>as long as all those leading zeros are computationally free to obtain<\/span><span style=' font-style: italic;'>.<\/span><span> That might sound unlikely, but it actually could be the case if this were only a matter of scaling, say when switching units from millimeters to light years. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>In the limiting case of <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>0<\/mn><\/mrow><\/math><\/span><span>, however, relative error control assumes that <\/span><span style=' font-style: italic;'>all<\/span><span> those zeros are \"insignificant\", computationally free to obtain. Unfortunately, when <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>0<\/mn><\/math><\/span><span> those leading zeros are all the digits that there are!  <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>It still <\/span><span style=' font-style: italic;'>could<\/span><span> be the case.that they are free. For example, if everything in the problem is zero, then the intermediate computations are probably going to yield zero at every stage. Or it might happen if there is symmetry that results in perfect cancellation, e.g. integrating an odd function over the interval [-1,1] and exact zero is obtained not because the intermediate calculations are exact, rather because the intermediate results cancel out perfectly, i.e., are equal and opposite, regardless of how inexact they might be.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>These are common enough scenarios, but they are not always the case. Generally speaking, it is not easier to compute the ideal result <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">y<\/mi><mo>=<\/mo><mn>0<\/mn><\/mrow><\/math><\/span><span> when <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>0<\/mn><\/math><\/span><span> than it is to compute the ideal result <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;234567890&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">y<\/mi><mo>=<\/mo><mn>1<\/mn><mo>.<\/mo><mn>234567890<\/mn><\/mrow><\/math><\/span><span> when <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;.&lt;\/mo&gt;&lt;mn&gt;234567890&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>1<\/mn><mo>.<\/mo><mn>234567890<\/mn><\/mrow><\/math><\/span><span>. Just as it is usually impractical to require that the absolute error is zero, so it is impractical to impose <\/span><span style=' font-style: italic;'>any<\/span><span> relative tolerance when <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>0<\/mn><\/math><\/span><span>. As convenient as relative error control is, we have a hole at zero that we need to fill somehow.<\/span><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>Combining Absolute and Relative Error Control<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Absolute error is easy to understand but can be difficult to use when the problem contains values of different scales, and we need know something about the magnitude of the solution values before we have computed them. Controlling the error in the relative sense instead rectifies these limitations of absolute error control, but it doesn't work in any practical way when the desired solution happens to be very close to zero. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Fortunately, <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>0<\/mn><\/mrow><\/math><\/span><span> is a value that doesn't have any scaling to worry about. Theoretically, then, absolute error should work fine at and very near zero, while relative error works everywhere else. So let's splice them together. Historically this has been accomplished in more than one way, but more commonly today it is done like this:<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;max&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;mo&gt;,&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;\u22c5&lt;\/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;|&lt;\/mo&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mo stretchy=\"false\">|<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>-<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><mo>\u2264<\/mo><mi mathvariant=\"normal\">max<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">A<\/mi><mo>,<\/mo><mi mathvariant=\"italic\">R<\/mi><mo>\u22c5<\/mo><mo stretchy=\"false\">|<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo stretchy=\"false\">|<\/mo><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>or in MATLAB code<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>abs(y - y0) &lt;= max(AbsoluteTolerance,RelativeTolerance*abs(y0))<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>As previously mentioned, we don't generally know <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span>, and the left-hand side will be an estimate of the absolute error obtained somehow or other. If we also assume that the value of <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span> that we have computed at least has the right <\/span><span style=' font-style: italic;'>magnitude<\/span><span>, we can substitute it for <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span> in that expression.  So in software the test will take the form<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>errorEstimate &lt;= max(AbsoluteTolerance,RelativeTolerance*abs(y))<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Here <\/span><span style=' font-family: monospace;'>errorEstimate<\/span><span> is an estimate of the absolute error, or possibly an approximate upper bound on it. Using <\/span><span style=' font-family: monospace;'>max<\/span><span>, not <\/span><span style=' font-family: monospace;'>min<\/span><span>, ensures that we choose the least restrictive of the two tolerances. This is important because the hole we are trying to fill occurs because relative error control becomes too restrictive near <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>0<\/mn><\/math><\/span><span>.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Perhaps it is interesting to observe where the switchover from using the absolute tolerance to using the relative tolerance occurs. It occurs when <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;AbsoluteTolerance&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;RelativeTolerance&lt;\/mi&gt;&lt;mo&gt;\u22c5&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;abs&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"normal\">AbsoluteTolerance<\/mi><mo>=<\/mo><mi mathvariant=\"normal\">RelativeTolerance<\/mi><mo>\u22c5<\/mo><mi mathvariant=\"normal\">abs<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><span>. In other words, it occurs when <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;abs&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;AbsoluteTolerance&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;RelativeTolerance&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/mfrac&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-15px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mi mathvariant=\"normal\">abs<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mo>)<\/mo><\/mrow><mo>=<\/mo><mfrac><mrow><mi mathvariant=\"normal\">AbsoluteTolerance<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">RelativeTolerance<\/mi><\/mrow><\/mfrac><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>For example, the default tolerances for the <\/span><span style=' font-family: monospace;'>integral<\/span><span> function are <\/span><span style=' font-family: monospace;'>AbsoluteTolerance = 1e-10<\/span><span> and <\/span><span style=' font-family: monospace;'>RelativeTolerance = 1e-6<\/span><span>. Consequently when we estimate that a quantity is less than 1e-10\/1e-6 = 1e-4 in magnitude, we use AbsoluteTolerance and control the error in the absolute sense, otherwise we use RelativeTolerance and control it in the relative sense.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Not all error control strategies in numerical software have been formulated that way, but they can have similar effects. Often only one tolerance was accepted, and in that case one could adapt the above strategy to<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>errorEstimate &lt;= tol*max(1,abs(y))<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>This effectively makes the two tolerances the same, so that absolute error control is used for <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;abs&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"normal\">abs<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mo>)<\/mo><\/mrow><mo>\u2264<\/mo><mn>1<\/mn><\/mrow><\/math><\/span><span>and relative error control for <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;abs&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;mo&gt;\u2265&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"normal\">abs<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mo>)<\/mo><\/mrow><mo>\u2265<\/mo><mn>1<\/mn><\/mrow><\/math><\/span><span>. Since error control is not an exact affair to begin with, and we have even substituted <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span> for <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span>, addition can be used instead of the max function:<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>errorEstimate &lt;= tol*(abs(y) + 1)<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>If <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;abs&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"normal\">abs<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><span> is very small, the factor on the right is just a little larger than 1, hence the test is essentially comparing the estimate of the absolute error with the tolerance. That's absolute error control. If, on the other hand, <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;abs&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><mi mathvariant=\"normal\">abs<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/math><\/span><span> is very large, the addition of 1 matters but little, and so the effect is relative error control.<\/span><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>Floating Point Limitations<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Floating point arithmetic has limitations that may affect the tolerances we choose, so let's review what they are. MATLAB provides the functions <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/eps.html\"><span style=' font-family: monospace;'>eps<\/span><\/a><span>, <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/realmin.html\"><span style=' font-family: monospace;'>realmin<\/span><\/a><span>, and <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/realmax.html\"><span style=' font-family: monospace;'>realmax<\/span><\/a><span> that tell you about limits in the floating point type.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Double precision:<\/span><\/div><table  style = 'margin: 3px; border: 1px solid rgb(191, 191, 191); border-collapse: collapse; '><col\/><col\/><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>eps<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>2.220446049250313e-16<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>realmin<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>2.225073858507201e-308<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>realmax<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>1.797693134862316e+308<\/span><\/div><\/td><\/tr><\/table><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Single precision<\/span><\/div><table  style = 'margin: 3px; border: 1px solid rgb(191, 191, 191); border-collapse: collapse; '><col\/><col\/><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>eps(\"single\")<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>1.1920929e-07<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>realmin(\"single\")<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>1.1754944e-38<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'>realmax(\"single\")<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span style=' font-family: monospace;'> 3.4028235e+38<\/span><\/div><\/td><\/tr><\/table><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>We used the <\/span><span style=' font-family: monospace;'>eps<\/span><span> function above without numeric inputs, but writing just <\/span><span style=' font-family: monospace;'>eps<\/span><span> with no inputs is the same as writing <\/span><span style=' font-family: monospace;'>eps(1)<\/span><span>, and writing <\/span><span style=' font-family: monospace;'>eps(\"single\")<\/span><span> is the same as writing <\/span><span style=' font-family: monospace;'>eps(single(1))<\/span><span>. In what follows we'll stick to the double precision case, but the same principles apply to single precision. The documentation says: <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>\"<\/span><span style=' font-family: monospace;'>eps(X)<\/span><span> is the positive distance from abs<\/span><span style=' font-family: monospace;'>(X)<\/span><span> to the next larger in magnitude floating point number of the same precision as <\/span><span style=' font-family: monospace;'>X<\/span><span>.\" <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Let's unpack this in case you've never thought about it. We use floating point numbers to model the real numbers, but there are infinitely many real values and only a finite number of floating point values. In double precision there are <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;52&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msup><mrow><mn>2<\/mn><\/mrow><mrow><mn>52<\/mn><\/mrow><\/msup><mtext>\u2009<\/mtext><\/mrow><\/math><\/span><span>evenly spaced numbers in the interval <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;&amp;lt;&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>1<\/mn><mo>\u2264<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>&lt;<\/mo><mn>2<\/mn><\/mrow><\/math><\/span><span>. This goes for any consecutive powers of 2, i.e. there are <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;52&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msup><mrow><mn>2<\/mn><\/mrow><mrow><mn>52<\/mn><\/mrow><\/msup><\/mrow><\/math><\/span><span> evenly spaced double precision floating point numbers in the interval  <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;n&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;&amp;lt;&lt;\/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;n&lt;\/mi&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msup><mrow><mn>2<\/mn><\/mrow><mrow><mi mathvariant=\"italic\">n<\/mi><\/mrow><\/msup><mo>\u2264<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>&lt;<\/mo><msup><mrow><mn>2<\/mn><\/mrow><mrow><mi mathvariant=\"italic\">n<\/mi><mo>+<\/mo><mn>1<\/mn><\/mrow><\/msup><\/mrow><\/math><\/span><span>, so long as <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;1022&lt;\/mn&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;n&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn mathvariant=&quot;normal&quot;&gt;1023&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mo>-<\/mo><mn>1022<\/mn><mo>\u2264<\/mo><mi mathvariant=\"italic\">n<\/mi><mo>\u2264<\/mo><mn mathvariant=\"normal\">1023<\/mn><\/mrow><\/math><\/span><span>. In MATLAB you also have that many in the interval <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;&amp;lt;&lt;\/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;1022&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>0<\/mn><mo>\u2264<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>&lt;<\/mo><msup><mrow><mn>2<\/mn><\/mrow><mrow><mo>-<\/mo><mn>1022<\/mn><\/mrow><\/msup><\/mrow><\/math><\/span><span>. which is the same as <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;&amp;lt;&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;realmin&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>0<\/mn><mo>\u2264<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>&lt;<\/mo><mi mathvariant=\"normal\">realmin<\/mi><\/mrow><\/math><\/span><span>.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>In every case, the very next larger floating point number after <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;\u2265&lt;\/mo&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">x<\/mi><mo>\u2265<\/mo><mn>0<\/mn><\/mrow><\/math><\/span><span> is <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">x<\/mi><mo>+<\/mo><mi mathvariant=\"normal\">eps<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><span>, so the spacing between the floating point numbers in the interval <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;n&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;&amp;lt;&lt;\/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;n&lt;\/mi&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msup><mrow><mn>2<\/mn><\/mrow><mrow><mi mathvariant=\"italic\">n<\/mi><\/mrow><\/msup><mo>\u2264<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>&lt;<\/mo><msup><mrow><mn>2<\/mn><\/mrow><mrow><mi mathvariant=\"italic\">n<\/mi><mo>+<\/mo><mn>1<\/mn><\/mrow><\/msup><\/mrow><\/math><\/span><span> is <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;n&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"normal\">eps<\/mi><mrow><mo>(<\/mo><mrow><msup><mrow><mn>2<\/mn><\/mrow><mrow><mi mathvariant=\"italic\">n<\/mi><\/mrow><\/msup><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><span>. The value of <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"normal\">eps<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><span> is the same throughout the interval. For example:<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >n = 3;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >x = linspace(2^n,2^(n+1),5)<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsVariableMatrixElement\" uid=\"56F4CB1E\" prevent-scroll=\"true\" data-testid=\"output_0\" data-width=\"1145\" tabindex=\"-1\" style=\"width: 1175px; white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"matrixElement veSpecifier saveLoad eoOutputContent\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"variable output \" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"veVariableName variableNameElement double\" style=\"width: 1145px; white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"headerElementClickToInteract\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><span style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">x = <\/span><span class=\"veVariableValueSummary veMetaSummary\" style=\"white-space: normal; font-style: italic; color: rgb(97, 97, 97); font-size: 12px;\">1\u00d75<\/span><\/div><\/div><div class=\"valueContainer\" data-layout=\"{&quot;columnWidth&quot;:40,&quot;totalColumns&quot;:5,&quot;totalRows&quot;:1,&quot;charsPerColumn&quot;:6}\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"variableValue\" style=\"width: 202px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">     8    10    12    14    16\r\n<\/div><div class=\"horizontalEllipsis hide\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><mw-icon icon-id=\"meatballMenuUI\" icon-width=\"16\" icon-height=\"16\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/mw-icon><\/div><div class=\"verticalEllipsis hide\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><mw-icon icon-id=\"kebabMenuUI\" icon-width=\"16\" icon-height=\"16\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/mw-icon><\/div><\/div><\/div><div class=\"outputLayer selectedOutputDecorationLayer doNotExport\" aria-hidden=\"true\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/div><div class=\"outputLayer activeOutputDecorationLayer doNotExport\" aria-hidden=\"true\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/div><div class=\"outputLayer scrollableOutputDecorationLayer doNotExport\" aria-hidden=\"true\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/div><div class=\"outputLayer navigationFocusLayer doNotExport\" aria-hidden=\"true\" tabindex=\"-1\" role=\"application\" aria-label=\"variable output x = 1\u00d75    \r\n     8    10    12    14    16\r\n\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/div><\/div><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 6px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >eps(x)<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsVariableMatrixElement\" uid=\"34FE6B7E\" prevent-scroll=\"true\" data-testid=\"output_1\" data-width=\"1145\" tabindex=\"-1\" style=\"width: 1175px; white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"matrixElement veSpecifier saveLoad eoOutputContent\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"variable output \" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"veVariableName variableNameElement double\" style=\"width: 1145px; white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"headerElementClickToInteract\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><span style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">ans = <\/span><span class=\"veVariableValueSummary veMetaSummary\" style=\"white-space: normal; font-style: italic; color: rgb(97, 97, 97); font-size: 12px;\">1\u00d75<\/span><\/div><\/div><div class=\"veScalingFactor\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">10<sup>-14<\/sup><span class=\"multiply\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"> \u00d7<\/span><\/div><div class=\"valueContainer\" data-layout=\"{&quot;columnWidth&quot;:66,&quot;totalColumns&quot;:5,&quot;totalRows&quot;:1,&quot;charsPerColumn&quot;:10}\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"variableValue\" style=\"width: 332px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">    0.1776    0.1776    0.1776    0.1776    0.3553\r\n<\/div><div class=\"horizontalEllipsis hide\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><mw-icon icon-id=\"meatballMenuUI\" icon-width=\"16\" icon-height=\"16\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/mw-icon><\/div><div class=\"verticalEllipsis hide\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><mw-icon icon-id=\"kebabMenuUI\" icon-width=\"16\" icon-height=\"16\" style=\"white-space: nowrap; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/mw-icon><\/div><\/div><\/div><div class=\"outputLayer selectedOutputDecorationLayer doNotExport\" aria-hidden=\"true\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/div><div class=\"outputLayer activeOutputDecorationLayer doNotExport\" aria-hidden=\"true\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/div><div class=\"outputLayer scrollableOutputDecorationLayer doNotExport\" aria-hidden=\"true\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/div><div class=\"outputLayer navigationFocusLayer doNotExport\" aria-hidden=\"true\" tabindex=\"-1\" role=\"application\" aria-label=\"variable output ans = 1\u00d75    \r\n1.0e-14 *\r\n\r\n    0.1776    0.1776    0.1776    0.1776    0.3553\r\n\" style=\"white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>There are no floating point numbers between, say, <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: normal; font-weight: 400; color: rgb(33, 33, 33);\">10<\/span><span> and <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>10<\/mn><mo>+<\/mo><mi mathvariant=\"normal\">eps<\/mi><mrow><mo>(<\/mo><mrow><mn>10<\/mn><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><span>. If you try to compute the midpoint between <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;a&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">a<\/mi><mo>=<\/mo><mi mathvariant=\"italic\">x<\/mi><\/mrow><\/math><\/span><span> and <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;b&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">b<\/mi><mo>=<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>+<\/mo><mi mathvariant=\"normal\">eps<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><span>, <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;c&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;a&lt;\/mi&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;b&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/mfrac&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-15px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">c<\/mi><mo>=<\/mo><mfrac><mrow><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">a<\/mi><mo>+<\/mo><mi mathvariant=\"italic\">b<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><mrow><mn>2<\/mn><\/mrow><\/mfrac><\/mrow><\/math><\/span><span>, the result will be either <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;c&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">c<\/mi><mo>=<\/mo><mi mathvariant=\"italic\">x<\/mi><\/mrow><\/math><\/span><span> or <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;c&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">c<\/mi><mo>=<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>+<\/mo><mi mathvariant=\"normal\">eps<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/math><\/span><span>. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>OK. So what's the point again? We're talking about floating point limitations on tolerances. With extremely tight tolerances, we will, in effect, be asking the code to return one of a small set of discrete values. For example, if we chooose an absolute tolerance of <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: normal; font-weight: 400; color: rgb(33, 33, 33);\">eps<\/span><span> when <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><mo>=<\/mo><mn>2<\/mn><\/mrow><\/math><\/span><span>, then by definition, we are asking for a result <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span> such that<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mn>2<\/mn><mo>-<\/mo><mi mathvariant=\"normal\">eps<\/mi><mo>\u2264<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>\u2264<\/mo><mn>2<\/mn><mo>+<\/mo><mi mathvariant=\"normal\">eps<\/mi><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The floating point number <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>2<\/mn><mo>-<\/mo><mi mathvariant=\"normal\">eps<\/mi><\/mrow><\/math><\/span><span> is less than 2, but it turns out to be the one floating point number immediately preceding 2. At the upper end point, however, <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;2&lt;\/mi&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">2<\/mi><mo>+<\/mo><mi mathvariant=\"normal\">eps<\/mi><mo>=<\/mo><mn>2<\/mn><\/mrow><\/math><\/span><span> in floating point, so the range above is just another way of saying <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;\u2208&lt;\/mo&gt;&lt;mrow&gt;&lt;mo&gt;{&lt;\/mo&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mo&gt;,&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mo&gt;}&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mi mathvariant=\"italic\">y<\/mi><mo>\u2208<\/mo><mrow><mo>{<\/mo><mrow><mn>2<\/mn><mo>-<\/mo><mi mathvariant=\"normal\">eps<\/mi><mo>,<\/mo><mn>2<\/mn><\/mrow><mo>}<\/mo><\/mrow><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Some \"range\", that!  We have allowed for only two possible values. Similarly, for a relative tolerance of <\/span><span style=' font-family: monospace;'>eps<\/span><span>, we get from applying the definition that<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mn>2<\/mn><mo>-<\/mo><mn>2<\/mn><mtext>\u2009<\/mtext><mi mathvariant=\"normal\">eps<\/mi><mo>\u2264<\/mo><mi mathvariant=\"italic\">y<\/mi><mo>\u2264<\/mo><mn>2<\/mn><mo>+<\/mo><mn>2<\/mn><mtext>\u2009<\/mtext><mi mathvariant=\"normal\">eps<\/mi><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>which turns out to be satisfied by just 4 possible values of <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">y<\/span><span>:<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mo&gt;\u2208&lt;\/mo&gt;&lt;mrow&gt;&lt;mo&gt;{&lt;\/mo&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mo&gt;,&lt;\/mo&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;mo&gt;,&lt;\/mo&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;,&lt;\/mo&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mo&gt;+&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;}&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mi mathvariant=\"italic\">y<\/mi><mo>\u2208<\/mo><mrow><mo>{<\/mo><mrow><mn>2<\/mn><mo>-<\/mo><mn>2<\/mn><mtext>\u2009<\/mtext><mi mathvariant=\"normal\">eps<\/mi><mo>,<\/mo><mtext>\u2009<\/mtext><mn>2<\/mn><mo>-<\/mo><mi mathvariant=\"normal\">eps<\/mi><mo>,<\/mo><mtext>\u2009<\/mtext><mn>2<\/mn><mo>,<\/mo><mtext>\u2009<\/mtext><mn>2<\/mn><mo>+<\/mo><mn>2<\/mn><mtext>\u2009<\/mtext><mi mathvariant=\"normal\">eps<\/mi><\/mrow><mo>}<\/mo><\/mrow><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The upshot is that we will need to be careful when setting our tolerances so that we are asking for something reasonable.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>We will always want to choose <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;\u2265&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">R<\/mi><mo>\u2265<\/mo><mi mathvariant=\"normal\">eps<\/mi><\/mrow><\/math><\/span><span>. Even in testing scenarios where you have <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span> in hand and you're just comparing outputs, you will probably want to use at least a small multiple of <\/span><span style=' font-family: monospace;'>eps<\/span><span>. The ODE and integral solvers will not allow anything smaller than <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;100&lt;\/mi&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eps&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"normal\">100<\/mi><mtext>\u2009<\/mtext><mi mathvariant=\"normal\">eps<\/mi><\/mrow><\/math><\/span><span>.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>With absolute tolerances things are more complicated because we must take account of the scale of values. An absolute tolerance can be smaller than <\/span><span style=' font-family: monospace;'>eps<\/span><span> when the solution values will be much smaller than 1. It can also be larger than 1. Consider a problem where the exact solution is 1 meter and anything smaller than 10 microns is negligible. If you were solving the problem using meters as your unit of measurement, then you'd set your absolute tolerance to 0.00001 meters because that's 10 microns. But now rescale the problem to use microns as your unit of measurement instead of meters. Now the exact solution is 1e6 microns, and your absolute tolerance would be 10 microns. Conversely, if you were to solve the problem in petameters, the exact answer is now 1e-15 petameters, and your absolute tolerance would be 1e-20 petameters. We're just changing units to illustrate the point. Your problem will have probably have units that are natural for the problem, and you'll need to deal with that as it comes. Whereas the value of <\/span><span style=' font-family: monospace;'>eps<\/span><span> places a natural limit on the relative tolerance, the <\/span><span style=' font-family: monospace;'>realmin<\/span><span> and <\/span><span style=' font-family: monospace;'>realmax<\/span><span> values present limitations on what you can use for an absolute tolerance. As with <\/span><span style=' font-family: monospace;'>eps<\/span><span> and the relative tolerance, you should avoid these extremes. Rescale the problem if you find yourself wanting to set an absolute tolerance anywhere near <\/span><span style=' font-family: monospace;'>realmin or<\/span><span> <\/span><span style=' font-family: monospace;'>realmax<\/span><span>.<\/span><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>How to set Tolerances<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>But how does one go about actually choosing tolerances for a computation that solves some real world problem? To answer that, we just need to answer a few questions.<\/span><\/div><h3  style = 'margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: 700; text-align: left; '><span>1. How small of a value do we consider \"negligible\"?<\/span><\/h3><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>How small is small enough that it is nothing for all <\/span><span style=' font-style: italic;'>practical<\/span><span> intents and purposes?  This might be different for different pieces of the solution, but it provides a reasonable value for the absolute tolerance. If the solution to your problem contains a weight for some powder that is 1.23456g, and your scale is only accurate to 0.1g, there's not much you can do with the extra 0.03456g in the result even if those numbers are correct. What we have there is 1.2g plus a negligible quantity. It makes sense to use tolerances that only ask for accuracy to, say, 0.01g. Suppose we did that and got 1.23654 instead. Now 0.00654 of that is \"noise\", but it's the same 1.2g when rounded to the 0.1g that our scale can actually measure.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Recall that an absolute tolerance is not limited by <\/span><span style=' font-family: monospace;'>eps<\/span><span>. It has the same units as the solution, and it can be freely set to whatever value makes sense, whether 1e-40 or 1e+40 depends on how the problem is scaled. Sometimes you might even be allowed to make it exactly zero, but that's a bold move unless you know the solution isn't close to zero.  <\/span><\/div><h3  style = 'margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: 700; text-align: left; '><span>2. How precise is the data that defines the problem?<\/span><\/h3><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>If there are only a few significant digits of precision in the data that defines the problem to be solved, it's not likely that a more <\/span><span style=' font-style: italic;'>accurate<\/span><span> solution will be more <\/span><span style=' font-style: italic;'>useful<\/span><span> than one computed to about the same accuracy as the problem itself is specified. Of course, it's not really that simple.  It may be that solution curves are very sensitive or very insensitive to variations in different problem data. It usually is not clear how the error in the problem specification manifests in the solution. Nevertheless, we are typically computing an <\/span><span style=' font-style: italic;'>approximate<\/span><span> solution to an <\/span><span style=' font-style: italic;'>approximate<\/span><span> problem, and that has implications. Given that we're starting with some error, how much are we willing to pay for <\/span><span style=' font-style: italic;'>extra<\/span><span> digits of accuracy from the solver?  The answer is probably \"not a lot\", and yet these extra digits will most likely cost us additional time and maybe computing resources to obtain. If the numerical data that defines the problem is only accurate to, say, 5 significant digits, we might reasonably decide to ask the solver for no more than 5 or 6 digits of accuracy when solving it. If 5 digits of accuracy seems OK to us, we could set <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mo&gt;\u22c5&lt;\/mo&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;6&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">R<\/mi><mo>=<\/mo><msup><mrow><mn>5<\/mn><mo>\u22c5<\/mo><mn>10<\/mn><\/mrow><mrow><mo>-<\/mo><mn>6<\/mn><\/mrow><\/msup><\/mrow><\/math><\/span><span> or <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;R&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mo&gt;\u22c5&lt;\/mo&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;7&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi mathvariant=\"italic\">R<\/mi><mo>=<\/mo><msup><mrow><mn>5<\/mn><mo>\u22c5<\/mo><mn>10<\/mn><\/mrow><mrow><mo>-<\/mo><mn>7<\/mn><\/mrow><\/msup><\/mrow><\/math><\/span><span> for good measure.<\/span><\/div><h3  style = 'margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: 700; text-align: left; '><span>3. What <\/span><span style=' font-style: italic;'>percentage<\/span><span> error is small enough to ignore? or How many significant digits of accuracy do we need?<\/span><\/h3><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>If you said that a 0.01% error is small enough to ignore, then a reasonable relative tolerance would be 0.0001, as long as that isn't much beyond the precision of the data that defines the problem. If you prefer to think in terms of significant digits, and need, say, 5 significant digits, then a reasonable relative tolerance might be <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mn&gt;5&lt;\/mn&gt;&lt;mo&gt;\u00d7&lt;\/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mn&gt;10&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;mn&gt;6&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-5px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>5<\/mn><mo>\u00d7<\/mo><msup><mrow><mn>10<\/mn><\/mrow><mrow><mo>-<\/mo><mn>6<\/mn><\/mrow><\/msup><\/mrow><\/math><\/span><span>. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Then combine this with your answer to the previous question. Since there is some hand-waving about how the solution reacts to errors in the problem specification, one can make equally good arguments for picking the larger or the smaller of the two. If accuracy is especially important to you, use the smaller.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>This is just a way of setting \"reasonable\" tolerance values. It provides a baseline of sorts. Nothing prevents you from choosing tighter or looser tolerances, and there can be good reasons to go with tighter or looser tolerances. For one thing, tolerances are based on error <\/span><span style=' font-style: italic;'>estimates<\/span><span>, and in some cases not even error estimates for the final solution values. In ODE solvers, for example, they are used \"locally\", step by step. This can end up limiting the error in the final solution values in different ways to different degrees, so for some \"insurance\", slightly tighter tolerances can be a good thing. On the other hand, run times tend to go up with tighter tolerances. Memory requirements may also increase. If the solution changes but little and time is of the essence, looser tolerances might be justified, provided you are comfortable with the potential for larger errors. If the computation is occuring in a real-time system, for example, you would want to experiment with tolerances to see how the run-time and solution values react to tighter and looser tolerances.<\/span><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>Example<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Let's take a look at a first order system of ordinary differential equations.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;d&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;d&lt;\/mi&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;t&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/mfrac&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;f&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;t&lt;\/mi&gt;&lt;mo&gt;,&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;mo&gt;,&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;\/mn&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-15px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mrow><mfrac><mrow><mi mathvariant=\"normal\">d<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">d<\/mi><mrow><mi mathvariant=\"italic\">t<\/mi><\/mrow><\/mrow><\/mfrac><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><\/mrow><mo>=<\/mo><mi mathvariant=\"italic\">f<\/mi><mrow><mo>(<\/mo><mrow><mi mathvariant=\"italic\">t<\/mi><mo>,<\/mo><mi mathvariant=\"italic\">y<\/mi><\/mrow><mo>)<\/mo><\/mrow><mo>,<\/mo><mi mathvariant=\"italic\">y<\/mi><mrow><mo>(<\/mo><mrow><mn>0<\/mn><\/mrow><mo>)<\/mo><\/mrow><mo>=<\/mo><msub><mrow><mi mathvariant=\"italic\">y<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><\/msub><\/mrow><\/math><\/span><span> <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>This example has been constructed so that we know the exact solution.<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">function <\/span><span >yp = f(t,y,param)<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >yp = zeros(size(y));<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >yp(1) = 2*t*(1 - y(2)) + 1;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >yp(2) = 2*t*(y(1) - t - param);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">end<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '>&nbsp;<\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">function <\/span><span >y = exactSolution(t,param)<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >y = zeros(2,1);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >y(1) = cos(t.*t) + t + param;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >y(2) = sin(t.*t) + 1;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">end<\/span><\/span><\/div><\/div><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>And let's use this little comparison function I wrote so that we can easily see the accuracy of the results.<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">function <\/span><span >compare(y,yExact)<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >fprintf(1,<\/span><span style=\"color: #a709f5;\">\"      y(1) = %14.9f,       y(2) = %14.9f\\n\"<\/span><span >,y(1),y(2));<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >fprintf(1,<\/span><span style=\"color: #a709f5;\">\"exact y(1) = %14.9f, exact y(2) = %14.9f\\n\"<\/span><span >,yExact(1),yExact(2));<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >absoluteError = abs(y - yExact);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >relativeError = absoluteError.\/abs(yExact);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >fprintf(1,<\/span><span style=\"color: #a709f5;\">\"absolute error y(1) = %5.0e, absolute error y(2) = %5.0e\\n\"<\/span><span >,absoluteError(1),absoluteError(2));<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >fprintf(1,<\/span><span style=\"color: #a709f5;\">\"relative error y(1) = %5.0e, relative error y(2) = %5.0e\\n\\n\"<\/span><span >,relativeError(1),relativeError(2));<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">end<\/span><\/span><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Let's define this specific problem using as many digits as double precision allows. This will represent a problem that is specified exactly.<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >param = 1.234567890123456;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >y0 = exactSolution(0,param); <\/span><span style=\"color: #008013;\">% \"exact\" initial value<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >D = ode(ODEFcn=@f,Parameters=param,InitialValue=y0);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >t1 = 5; <\/span><span style=\"color: #008013;\">% Solve for the solution at this time point for comparisons.<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >yExact = exactSolution(t1,param); <\/span><span style=\"color: #008013;\">% The exact solution to our differential equation at t1.<\/span><\/span><\/div><\/div><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #008013;\">% Problem specified to full precision. Using default tolerances.<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >sol = solve(D,t1);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >compare(sol.Solution,yExact);<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsTextElement\" uid=\"C20CD31E\" prevent-scroll=\"true\" data-testid=\"output_2\" tabindex=\"-1\" style=\"width: 1175px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\" textElement eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1138\" data-previous-scroll-height=\"61\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"text output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">      y(1) =    7.227997543,       y(2) =    0.876442186\r\nexact y(1) =    7.225770702, exact y(2) =    0.867648250\r\nabsolute error y(1) = 2e-03, absolute error y(2) = 9e-03\r\nrelative error y(1) = 3e-04, relative error y(2) = 1e-02<\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The default tolerances are not tight, and it shows in the accuracy we get back. We got 3 digits correct in <\/span><span style=' font-family: monospace;'>y(1)<\/span><span> and just 1 digit correct in <\/span><span style=' font-family: monospace;'>y(2)<\/span><span>. Let's suppose we want 8 digits. So we'll set the relative tolerance to 5e-9.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>We've just made up this problem, but what amounts to a \"negligible amount\" in a system like this could in theory be different for <\/span><span style=' font-family: monospace;'>y(1)<\/span><span> than <\/span><span style=' font-family: monospace;'>y(2)<\/span><span>. A little known fact is that the MATLAB ODE solvers support having different absolute tolerances for different solution components. This problem doesn't really depend on it, but just to show how it's done, assume that for <\/span><span style=' font-family: monospace;'>y(1)<\/span><span> we think a negligible amount is 1e-10 and for <\/span><span style=' font-family: monospace;'>y(2)<\/span><span>, 1e-11.<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #008013;\">% Problem specified to full precision. Asking for about 8 significant<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #008013;\">% digits of accuracy.<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >D.RelativeTolerance = 5e-9;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >D.AbsoluteTolerance = [1e-10,1e-11];<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >sol = solve(D,t1);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >compare(sol.Solution,yExact);<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsTextElement\" uid=\"5DC594FD\" prevent-scroll=\"true\" data-testid=\"output_3\" tabindex=\"-1\" style=\"width: 1175px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\" textElement eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1138\" data-previous-scroll-height=\"61\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"text output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">      y(1) =    7.225770703,       y(2) =    0.867648251\r\nexact y(1) =    7.225770702, exact y(2) =    0.867648250\r\nabsolute error y(1) = 5e-10, absolute error y(2) = 1e-09\r\nrelative error y(1) = 7e-11, relative error y(2) = 1e-09<\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>That's more like it. We got 9 digits correct in <\/span><span style=' font-family: monospace;'>y(1)<\/span><span> and 8 in <\/span><span style=' font-family: monospace;'>y(2)<\/span><span>. But this is with the problem data at full precision. Your problem may have some measurements that aren't exact. Let's simulate that by tweaking some of the problem data while leaving the exact solution unchanged. Replacing the parameter and initial value with \"approximate\" values:<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #008013;\">% Problem specified with 6 significant digits. Still asking for 8.<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #008013;\">% significant digits.<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >param = 1.23457;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >D.InitialValue = [param + 1; 1];<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >sol = solve(D,t1);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >compare(sol.Solution,yExact);<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsTextElement\" uid=\"211B7266\" prevent-scroll=\"true\" data-testid=\"output_4\" tabindex=\"-1\" style=\"width: 1175px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\" textElement eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1138\" data-previous-scroll-height=\"61\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"text output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">      y(1) =    7.225772794,       y(2) =    0.867647972\r\nexact y(1) =    7.225770702, exact y(2) =    0.867648250\r\nabsolute error y(1) = 2e-06, absolute error y(2) = 3e-07\r\nrelative error y(1) = 3e-07, relative error y(2) = 3e-07<\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Maybe we solved the approximate problem just as accurately as before, but comparing to the \"true\" solution from the full precision problem, we only got 6 digits correct in <\/span><span style=' font-family: monospace;'>y(1)<\/span><span> and 5 digits correct in <\/span><span style=' font-family: monospace;'>y(2)<\/span><span>. This is why you might want to let the precision of the data in the problem moderate your tolerance choices. Reducing our request to 6 digits, we get.<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #008013;\">% Problem specified with 6 significant digits, now asking for 6<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: #008013;\">% significant digits.<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >D.RelativeTolerance = 5e-7;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >D.AbsoluteTolerance = 1e-9;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >sol = solve(D,t1);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >compare(sol.Solution,yExact);<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsTextElement\" uid=\"4EF625EA\" prevent-scroll=\"true\" data-testid=\"output_5\" tabindex=\"-1\" style=\"width: 1175px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\" textElement eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1138\" data-previous-scroll-height=\"61\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"text output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">      y(1) =    7.225770368,       y(2) =    0.867649499\r\nexact y(1) =    7.225770702, exact y(2) =    0.867648250\r\nabsolute error y(1) = 3e-07, absolute error y(2) = 1e-06\r\nrelative error y(1) = 5e-08, relative error y(2) = 1e-06<\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>This time we got 6 digits correct in <\/span><span style=' font-family: monospace;'>y(1)<\/span><span>. We only got 5 digits correct in <\/span><span style=' font-family: monospace;'>y(2)<\/span><span>, though, so maybe we should have set the relative tolerance at 5e-8. It's not a bad idea to ask for 7 digits when you need 6.  <\/span><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>When Failures Occur<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>A failure related to tolerances usually occurs when the problem is too difficult to solve to the requested accuracy. If that is the case, then one must either use an algorithm that is able to solve that problem more easily, or one must relax the tolerances, or both. Failing that, the problem itself will have to be reformulated.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Sometimes, paradoxically, one must <\/span><span style=' font-style: italic;'>tighten<\/span><span> the tolerances to succeed. There is an example of this here:<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><a href = \"https:\/\/www.mathworks.com\/help\/symbolic\/solve-daes-using-mass-matrix-solvers.html\"><span>Solve DAEs Using Mass Matrix Solvers - MATLAB &amp; Simulink (mathworks.com)<\/span><\/a><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The tolerances for ode15s are specified in that example because the integration fails with the default tolerances, which are looser. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>How is that even possible, you ask? Well, when you're driving a car on a mountain road, you need to keep the car <\/span><span style=' font-style: italic;'>on the road<\/span><span>, and that's going to require a practical minimum amount of accuracy. If your tolerances are too loose and you drive off the cliff, then you won't get where you're going. How much accuracy you need in a mathematical problem is less clear than how to keep a car on the road, but the point is that if you get a failure, and if loosening the tolerances doesn't help, try tightening them. What have you got to lose? It might work. Probably the worst that's going to happen is that it fails quicker.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Now get out there and set those tolerances!<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><\/div>\r\n<\/div><script type=\"text\/javascript\">var css = '.eoOutputWrapper { width: calc(90vw - 10px) !important; } .variableValue { width: 100% !important; } .embeddedOutputsMatrixElement,.eoOutputWrapper .matrixElement {    min-height: 18px;    box-sizing: border-box;} .embeddedOutputsMatrixElement .matrixElement,.eoOutputWrapper  .matrixElement,.rtcDataTipElement .matrixElement {    position: relative;} .matrixElement .variableValue,.rtcDataTipElement .matrixElement .variableValue {    white-space: pre;    display: inline-block;    vertical-align: top;    overflow: hidden;} .embeddedOutputsMatrixElement.inlineElement {} .embeddedOutputsMatrixElement.inlineElement .topHeaderWrapper {    display: none;} .embeddedOutputsMatrixElement.inlineElement .veTable .body {    padding-top: 0 !important;    max-height: 100px;} .inlineElement .matrixElement {    max-height: 300px;} .embeddedOutputsMatrixElement.rightPaneElement {} .rightPaneElement .matrixElement,.rtcDataTipElement .matrixElement {    overflow: hidden;    padding-left: 9px;} .rightPaneElement .matrixElement {    margin-bottom: -1px;} .embeddedOutputsMatrixElement .matrixElement .valueContainer,.eoOutputWrapper .matrixElement .valueContainer,.rtcDataTipElement .matrixElement .valueContainer {    white-space: nowrap;    margin-bottom: 3px;} .embeddedOutputsMatrixElement .matrixElement .valueContainer .horizontalEllipsis.hide,.embeddedOutputsMatrixElement .matrixElement .verticalEllipsis.hide,.eoOutputWrapper .matrixElement .valueContainer .horizontalEllipsis.hide,.eoOutputWrapper .matrixElement .verticalEllipsis.hide,.rtcDataTipElement .matrixElement .valueContainer .horizontalEllipsis.hide,.rtcDataTipElement .matrixElement .verticalEllipsis.hide {    display: none;} .embeddedOutputsVariableMatrixElement .matrixElement .valueContainer.hideEllipses .verticalEllipsis, .embeddedOutputsVariableMatrixElement .matrixElement .valueContainer.hideEllipses .horizontalEllipsis {    display:none;} .eoOutputWrapper .embeddedOutputsVariableMatrixElement .matrixElement .valueContainer {    cursor: default !important;} .embeddedOutputsVariableElement {    white-space: pre-wrap;    word-wrap: break-word;    min-height: 18px;    max-height: 250px;    overflow: auto;} .eoOutputWrapper .variableElement {    padding-top: 2px;} .embeddedOutputsVariableElement.inlineElement {} .inlineElement .variableElement {} .embeddedOutputsVariableElement.rightPaneElement {    min-height: 16px;} .rightPaneElement .variableElement {    padding-left: 9px;} .outputsOnRight .embeddedOutputsVariableElement.rightPaneElement .eoOutputContent {    \/* Remove extra space allocated for navigation border *\/    margin-top: 0;    margin-bottom: 0;} .variableNameElement {    margin-bottom: 3px;    display: inline-block;} \/* * Ellipses as base64 for HTML export. *\/.matrixElement .horizontalEllipsis,.rtcDataTipElement .matrixElement .horizontalEllipsis {    display: inline-block;    margin-top: 3px;    \/* base64 encoded version of images-liveeditor\/HEllipsis.png *\/    width: 30px;    height: 12px;    background-repeat: no-repeat;    background-image: url(\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAJCAYAAADO1CeCAAAAJUlEQVR42mP4\/\/8\/A70xw0i29BUDFPxnAEtTW37wWDqakIa4pQDvOOG89lHX2gAAAABJRU5ErkJggg==\");} .matrixElement .verticalEllipsis,.textElement .verticalEllipsis,.rtcDataTipElement .matrixElement .verticalEllipsis,.rtcDataTipElement .textElement .verticalEllipsis {    margin-left: 35px;    \/* base64 encoded version of images-liveeditor\/VEllipsis.png *\/    width: 12px;    height: 30px;    background-repeat: no-repeat;    background-image: url(\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAZCAYAAAAIcL+IAAAALklEQVR42mP4\/\/8\/AzGYgWyFMECMwv8QddRS+P\/\/KyimlmcGUOFoOI6GI\/UVAgDnd8Dd4+NCwgAAAABJRU5ErkJggg==\");} \/* Styling that is common to warnings and errors is in diagnosticOutput.css *\/.embeddedOutputsErrorElement {    min-height: 18px;    max-height: 550px;} .embeddedOutputsErrorElement .diagnosticMessage-errorType {    overflow: auto;} .embeddedOutputsErrorElement.activeOutput .eoOutputContent {    user-select: text;    -webkit-user-select: text;} .embeddedOutputsErrorElement.activeOutput .eoOutputContent button {    user-select: none;    -webkit-user-select: none;} .embeddedOutputsErrorElement .eoOutputContent ::selection {    color: var(--rtc-output-textSelection-color);    background: var(--rtc-output-textSelection-bg-color);} .embeddedOutputsErrorElement.inlineElement {} .embeddedOutputsErrorElement.rightPaneElement {} \/* Styling that is common to warnings and errors is in diagnosticOutput.css *\/.embeddedOutputsWarningElement {    min-height: 18px;    max-height: 550px;} .embeddedOutputsWarningElement .diagnosticMessage-warningType {    overflow: auto;} .embeddedOutputsWarningElement.activeOutput .eoOutputContent {    user-select: text;    -webkit-user-select: text;} .embeddedOutputsWarningElement .eoOutputContent ::selection {    color: var(--rtc-output-textSelection-color);    background: var(--rtc-output-textSelection-bg-color);} .embeddedOutputsWarningElement.inlineElement {} .embeddedOutputsWarningElement.rightPaneElement {} \/* Copyright 2015-2023 The MathWorks, Inc. *\/\/* In this file, styles are not scoped to rtcContainer since they could be in the Dojo Tooltip *\/.diagnosticMessage-wrapper {    font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;    font-size: 12px;} .diagnosticMessage-wrapper.diagnosticMessage-warningType {    \/*This fallback value will be used for appdesigner warnings*\/    color: var(--rtc-warning-output-color, var(--mw-color-matlabWarning));} .diagnosticMessage-wrapper.diagnosticMessage-warningType a {    \/*This fallback value will be used for appdesigner warnings*\/    color: var(--rtc-warning-output-color, var(--mw-color-matlabWarning));    text-decoration: underline;} .rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-warningType,.rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-warningType a {    color: var(--mw-color-matlabWarning) !important;} .diagnosticMessage-wrapper.diagnosticMessage-errorType {    \/*This fallback value will be used in appdesigner error tooltip text*\/    color: var(--rtc-error-output-color, var(--mw-color-matlabErrors));} .diagnosticMessage-wrapper.diagnosticMessage-errorType a {    \/*This fallback value will be used in appdesigner error tooltip text*\/    color: var(--rtc-error-output-color, var(--mw-color-matlabErrors));    text-decoration: underline;} .rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-errorType,.rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-errorType a {    color: var(--mw-color-matlabErrors) !important;} .diagnosticMessage-wrapper .diagnosticMessage-messagePart,.diagnosticMessage-wrapper .diagnosticMessage-causePart {    white-space: pre-wrap;} .diagnosticMessage-wrapper .diagnosticMessage-stackPart {    white-space: pre;} .embeddedOutputsTextElement,.embeddedOutputsVariableStringElement {    white-space: pre;    word-wrap:  initial;    min-height: 18px;    max-height: 550px;} .embeddedOutputsTextElement .textElement,.embeddedOutputsVariableStringElement .textElement {    overflow: auto;} .embeddedOutputsTextElement.activeOutput .eoOutputContent,.embeddedOutputsVariableStringElement.activeOutput .eoOutputContent {    user-select: text;    -webkit-user-select: text;} \/*embeddedOutputsTextElement has a different dom structure than embeddedOutputsVariableStringElement.Unlike variableString, the text output has both TEXT nodes and elements as children. Hence we needa selector for each.*\/.embeddedOutputsTextElement .eoOutputContent::selection,.embeddedOutputsTextElement .eoOutputContent ::selection,.embeddedOutputsVariableStringElement .eoOutputContent ::selection {    color: var(--rtc-output-textSelection-color);    background: var(--rtc-output-textSelection-bg-color);} .textElement,.rtcDataTipElement .textElement {    padding-top: 2px;} .embeddedOutputsTextElement.inlineElement,.embeddedOutputsVariableStringElement.inlineElement {} .inlineElement .textElement {} .embeddedOutputsTextElement.rightPaneElement,.embeddedOutputsVariableStringElement.rightPaneElement {    min-height: 16px;} .rightPaneElement .textElement {    padding-top: 2px;    padding-left: 9px;}'; var head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); head.appendChild(style); style.type = 'text\/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); }<\/script>","protected":false},"excerpt":{"rendered":"<p>This is a guest blog post by Michael Hosea, a numerical analyst at MathWorks. He works on MATLAB Coder and on MATLAB\u2019s ODE and integral solvers.MATLAB's ODE solvers have tolerances that the user can... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/matlab\/2024\/03\/20\/understanding-tolerances-in-ordinary-differential-equation-solvers\/\">read more >><\/a><\/p>","protected":false},"author":176,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[68,30,54,85],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/posts\/2113"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/users\/176"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/comments?post=2113"}],"version-history":[{"count":2,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/posts\/2113\/revisions"}],"predecessor-version":[{"id":2137,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/posts\/2113\/revisions\/2137"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/media?parent=2113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/categories?post=2113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/tags?post=2113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}