Solutions for FCUP's Numerical Analysis Assignments

This commit is contained in:
Diogo Cordeiro
2019-08-28 16:44:59 +01:00
commit b7b704b68b
108 changed files with 35323 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,40 @@
/* cyrillic-ext */
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 400;
src: local('Merriweather Regular'), local('Merriweather-Regular'), url(https://fonts.gstatic.com/s/merriweather/v19/u-440qyriQwlOrhSvowK_l5-cSZMZ-Y.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 400;
src: local('Merriweather Regular'), local('Merriweather-Regular'), url(https://fonts.gstatic.com/s/merriweather/v19/u-440qyriQwlOrhSvowK_l5-eCZMZ-Y.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 400;
src: local('Merriweather Regular'), local('Merriweather-Regular'), url(https://fonts.gstatic.com/s/merriweather/v19/u-440qyriQwlOrhSvowK_l5-cyZMZ-Y.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 400;
src: local('Merriweather Regular'), local('Merriweather-Regular'), url(https://fonts.gstatic.com/s/merriweather/v19/u-440qyriQwlOrhSvowK_l5-ciZMZ-Y.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 400;
src: local('Merriweather Regular'), local('Merriweather-Regular'), url(https://fonts.gstatic.com/s/merriweather/v19/u-440qyriQwlOrhSvowK_l5-fCZM.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

View File

@@ -0,0 +1,32 @@
/* cyrillic */
@font-face {
font-family: 'Oswald';
font-style: normal;
font-weight: 400;
src: local('Oswald Regular'), local('Oswald-Regular'), url(https://fonts.gstatic.com/s/oswald/v16/TK3iWkUHHAIjg752HT8Ghe4.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
font-family: 'Oswald';
font-style: normal;
font-weight: 400;
src: local('Oswald Regular'), local('Oswald-Regular'), url(https://fonts.gstatic.com/s/oswald/v16/TK3iWkUHHAIjg752Fj8Ghe4.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Oswald';
font-style: normal;
font-weight: 400;
src: local('Oswald Regular'), local('Oswald-Regular'), url(https://fonts.gstatic.com/s/oswald/v16/TK3iWkUHHAIjg752Fz8Ghe4.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Oswald';
font-style: normal;
font-weight: 400;
src: local('Oswald Regular'), local('Oswald-Regular'), url(https://fonts.gstatic.com/s/oswald/v16/TK3iWkUHHAIjg752GT8G.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

View File

@@ -0,0 +1,48 @@
/* cyrillic-ext */
@font-face {
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 400;
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(https://fonts.gstatic.com/s/ubuntumono/v8/KFOjCneDtsqEr0keqCMhbCc3CsTKlA.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 400;
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(https://fonts.gstatic.com/s/ubuntumono/v8/KFOjCneDtsqEr0keqCMhbCc-CsTKlA.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 400;
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(https://fonts.gstatic.com/s/ubuntumono/v8/KFOjCneDtsqEr0keqCMhbCc2CsTKlA.woff2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 400;
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(https://fonts.gstatic.com/s/ubuntumono/v8/KFOjCneDtsqEr0keqCMhbCc5CsTKlA.woff2) format('woff2');
unicode-range: U+0370-03FF;
}
/* latin-ext */
@font-face {
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 400;
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(https://fonts.gstatic.com/s/ubuntumono/v8/KFOjCneDtsqEr0keqCMhbCc0CsTKlA.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 400;
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(https://fonts.gstatic.com/s/ubuntumono/v8/KFOjCneDtsqEr0keqCMhbCc6CsQ.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

View File

@@ -0,0 +1,224 @@
/* latin-ext */
@font-face {
font-family: 'Quattrocento';
font-style: normal;
font-weight: 400;
src: local('Quattrocento'), url(https://fonts.gstatic.com/s/quattrocento/v10/OZpEg_xvsDZQL_LKIF7q4jP3zWj6T4g.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Quattrocento';
font-style: normal;
font-weight: 400;
src: local('Quattrocento'), url(https://fonts.gstatic.com/s/quattrocento/v10/OZpEg_xvsDZQL_LKIF7q4jP3w2j6.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
font-family: 'Quattrocento';
font-style: normal;
font-weight: 700;
src: local('Quattrocento Bold'), local('Quattrocento-Bold'), url(https://fonts.gstatic.com/s/quattrocento/v10/OZpbg_xvsDZQL_LKIF7q4jP_eE3vfqnYgXc.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Quattrocento';
font-style: normal;
font-weight: 700;
src: local('Quattrocento Bold'), local('Quattrocento-Bold'), url(https://fonts.gstatic.com/s/quattrocento/v10/OZpbg_xvsDZQL_LKIF7q4jP_eE3vcKnY.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
font-family: 'Quattrocento Sans';
font-style: italic;
font-weight: 400;
src: local('Quattrocento Sans Italic'), local('QuattrocentoSans-Italic'), url(https://fonts.gstatic.com/s/quattrocentosans/v11/va9a4lja2NVIDdIAAoMR5MfuElaRB0zMh0P2GEHJ.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Quattrocento Sans';
font-style: italic;
font-weight: 400;
src: local('Quattrocento Sans Italic'), local('QuattrocentoSans-Italic'), url(https://fonts.gstatic.com/s/quattrocentosans/v11/va9a4lja2NVIDdIAAoMR5MfuElaRB0zMh032GA.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
font-family: 'Quattrocento Sans';
font-style: italic;
font-weight: 700;
src: local('Quattrocento Sans Bold Italic'), local('QuattrocentoSans-BoldItalic'), url(https://fonts.gstatic.com/s/quattrocentosans/v11/va9X4lja2NVIDdIAAoMR5MfuElaRB0zMj_bTDXDojYsJ.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Quattrocento Sans';
font-style: italic;
font-weight: 700;
src: local('Quattrocento Sans Bold Italic'), local('QuattrocentoSans-BoldItalic'), url(https://fonts.gstatic.com/s/quattrocentosans/v11/va9X4lja2NVIDdIAAoMR5MfuElaRB0zMj_bTDX7ojQ.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
font-family: 'Quattrocento Sans';
font-style: normal;
font-weight: 400;
src: local('Quattrocento Sans'), local('QuattrocentoSans'), url(https://fonts.gstatic.com/s/quattrocentosans/v11/va9c4lja2NVIDdIAAoMR5MfuElaRB0zHt0_uHA.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Quattrocento Sans';
font-style: normal;
font-weight: 400;
src: local('Quattrocento Sans'), local('QuattrocentoSans'), url(https://fonts.gstatic.com/s/quattrocentosans/v11/va9c4lja2NVIDdIAAoMR5MfuElaRB0zJt08.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
font-family: 'Quattrocento Sans';
font-style: normal;
font-weight: 700;
src: local('Quattrocento Sans Bold'), local('QuattrocentoSans-Bold'), url(https://fonts.gstatic.com/s/quattrocentosans/v11/va9Z4lja2NVIDdIAAoMR5MfuElaRB0RyklrfPXzwiQ.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Quattrocento Sans';
font-style: normal;
font-weight: 700;
src: local('Quattrocento Sans Bold'), local('QuattrocentoSans-Bold'), url(https://fonts.gstatic.com/s/quattrocentosans/v11/va9Z4lja2NVIDdIAAoMR5MfuElaRB0RyklrRPXw.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic */
@font-face {
font-family: 'Spectral';
font-style: italic;
font-weight: 400;
src: local('Spectral Italic'), local('Spectral-Italic'), url(https://fonts.gstatic.com/s/spectral/v5/rnCt-xNNww_2s0amA9M8on7mTMuk.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
font-family: 'Spectral';
font-style: italic;
font-weight: 400;
src: local('Spectral Italic'), local('Spectral-Italic'), url(https://fonts.gstatic.com/s/spectral/v5/rnCt-xNNww_2s0amA9M8onXmTMuk.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Spectral';
font-style: italic;
font-weight: 400;
src: local('Spectral Italic'), local('Spectral-Italic'), url(https://fonts.gstatic.com/s/spectral/v5/rnCt-xNNww_2s0amA9M8onTmTMuk.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Spectral';
font-style: italic;
font-weight: 400;
src: local('Spectral Italic'), local('Spectral-Italic'), url(https://fonts.gstatic.com/s/spectral/v5/rnCt-xNNww_2s0amA9M8onrmTA.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic */
@font-face {
font-family: 'Spectral';
font-style: italic;
font-weight: 700;
src: local('Spectral Bold Italic'), local('Spectral-BoldItalic'), url(https://fonts.gstatic.com/s/spectral/v5/rnCu-xNNww_2s0amA9M8qsHDWfCFXUIJ.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
font-family: 'Spectral';
font-style: italic;
font-weight: 700;
src: local('Spectral Bold Italic'), local('Spectral-BoldItalic'), url(https://fonts.gstatic.com/s/spectral/v5/rnCu-xNNww_2s0amA9M8qsHDWfuFXUIJ.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Spectral';
font-style: italic;
font-weight: 700;
src: local('Spectral Bold Italic'), local('Spectral-BoldItalic'), url(https://fonts.gstatic.com/s/spectral/v5/rnCu-xNNww_2s0amA9M8qsHDWfqFXUIJ.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Spectral';
font-style: italic;
font-weight: 700;
src: local('Spectral Bold Italic'), local('Spectral-BoldItalic'), url(https://fonts.gstatic.com/s/spectral/v5/rnCu-xNNww_2s0amA9M8qsHDWfSFXQ.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic */
@font-face {
font-family: 'Spectral';
font-style: normal;
font-weight: 400;
src: local('Spectral Regular'), local('Spectral-Regular'), url(https://fonts.gstatic.com/s/spectral/v5/rnCr-xNNww_2s0amA9M9knj-SA.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
font-family: 'Spectral';
font-style: normal;
font-weight: 400;
src: local('Spectral Regular'), local('Spectral-Regular'), url(https://fonts.gstatic.com/s/spectral/v5/rnCr-xNNww_2s0amA9M2knj-SA.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Spectral';
font-style: normal;
font-weight: 400;
src: local('Spectral Regular'), local('Spectral-Regular'), url(https://fonts.gstatic.com/s/spectral/v5/rnCr-xNNww_2s0amA9M3knj-SA.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Spectral';
font-style: normal;
font-weight: 400;
src: local('Spectral Regular'), local('Spectral-Regular'), url(https://fonts.gstatic.com/s/spectral/v5/rnCr-xNNww_2s0amA9M5kng.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic */
@font-face {
font-family: 'Spectral';
font-style: normal;
font-weight: 700;
src: local('Spectral Bold'), local('Spectral-Bold'), url(https://fonts.gstatic.com/s/spectral/v5/rnCs-xNNww_2s0amA9uCt23FafadWQ.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
font-family: 'Spectral';
font-style: normal;
font-weight: 700;
src: local('Spectral Bold'), local('Spectral-Bold'), url(https://fonts.gstatic.com/s/spectral/v5/rnCs-xNNww_2s0amA9uCt23OafadWQ.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Spectral';
font-style: normal;
font-weight: 700;
src: local('Spectral Bold'), local('Spectral-Bold'), url(https://fonts.gstatic.com/s/spectral/v5/rnCs-xNNww_2s0amA9uCt23PafadWQ.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Spectral';
font-style: normal;
font-weight: 700;
src: local('Spectral Bold'), local('Spectral-Bold'), url(https://fonts.gstatic.com/s/spectral/v5/rnCs-xNNww_2s0amA9uCt23BafY.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,71 @@
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Numerical Analysis - Slides</title>
<link rel="stylesheet" href="css/all.css">
<link href="css/css.css" rel="stylesheet">
<link href="css/css2.css" rel="stylesheet">
<link href="css/css3.css" rel="stylesheet">
<link href="css/css4.css" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/katex.min.css">
<link rel="icon" href="https://hackersatporto.com/images/favicon.png">
<meta name="description" content="Porto's student computing society. We are a community focused on learning about and building things with technology.">
<script src="js/remark-latest.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/mark.min.js"></script>
<script src="js/MathJax.js"></script>
<script src="js/katex.min.js"></script>
<script src="js/auto-render.min.js"></script>
<script src="js/abcjs_basic_5.6.3-min.js"></script>
<script src="js/story.js"></script>
</head>
<body id="content" class="ma0 bg-white section-slides page-kind-page is-page-true feature-math feature-qrcode feature-nohighlight feature-music">
<script>
var hljs = remark.highlighter.engine;
var slideshow = remark.create({
ratio: "16:9",
countIncrementalSlides: false,
sourceUrl: 'text.md',
slideNumberFormat: '%current%',
highlightLanguage: "xaprb",
placeholder: "dummy value to end the list without a comma"
});
$(".remark-slide-content.fit-h1 h1").each(function(i, e) {
var $e = $(e);
var $p = $e.closest('div.remark-slide-container');
var needsToggle = !$p.hasClass('remark-visible');
if ( needsToggle ) $p.toggleClass('remark-visible');
while (e.scrollHeight > e.clientHeight + 1 && $e.css('font-size') != '1px') {
$e.css('font-size', (parseInt($e.css('font-size')) - 1) + "px");
}
if ( needsToggle ) $p.toggleClass('remark-visible');
});
$( function() {
if ( $( "body.feature-qrcode:not(.feature-noqrcode)" ).length ) {
if ( $( ".qrcode" ).length ) {
new QRCode($(".qrcode")[0], {
"useSVG": true,
"text": window.location.href.replace(/#\d*$/, "")
});
}
}
});
// Setup MathJax
MathJax.Hub.Config({
tex2jax: {
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
});
MathJax.Hub.Configured();
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,146 @@
// Render KaTeX math typesetting, but only if the <body> has the class
// feature-math
$( function() {
if ( $( "body.feature-math:not(.feature-nomath)" ).length ) {
renderMathInElement(document.body);
}
});
// Render abcjs sheet music, but only if the <body> has the class
// feature-music. Do this by removing the <pre><code class="language-abc">
// and replacing it with a <p id="music-X"> which will be used to hold the
// generated sheet music. Remark's code syntax highlighting transforms the
// <code> block into a bunch of
// <div class="remark-code-line">K: Emin</div>
// one per line, so we have to reassemble those to get back linebreaks.
$( function() {
if ( $( "body.feature-music:not(.feature-nomusic)" ).length ) {
$( "code.language-abc, code.abc" ).each(function(i, e){
var $this = $(this);
var abc = $this.text();
if ( $this.hasClass("remark-code") ) {
abc = "";
$this.children().each(function(i, e) {
abc += "\n" + $(this).text();
});
abc = abc.trim();
}
var p = $this.parent().before('<p id="music-' + (i+1) + '">');
$this.parent().hide();
ABCJS.renderAbc("music-" + (i+1), abc, {
paddingtop: 0,
paddingbottom: 0,
paddingright: 0,
paddingleft: 0,
responsive: "resize"
});
});
}
});
// Render tweet-styled blockquotes, if <body> has the class feature-tweetquote and the blockquote ends
// with a twitter permalink URL.
$( function() {
if ( $( "body.feature-tweetquote:not(.feature-notweetquote)" ).length ) {
$("blockquote p:first-child a[href*='twitter.com']").each(function(i, e){
$(this.parentElement.parentElement).addClass("tweet sans-serif mw6");
$(this).addClass("no-underline b");
$(this).prepend('<i class="fl mr2 fab fa-twitter fa-2x pa2 ba br3">');
var m = $(this).attr('href').match(/twitter.com\/([^\/]*)\//);
if (m.length > 1) {
$(this).append('<br><span class="normal gray">@' + m[1] + '</span>');
}
});
}
});
// Render perspective book images, if <body> has the class
// feature-3dbook-covers
$( function() {
$( "body.feature-3dbook-covers article a" ).has( "img[src~='3dbook']" ).each(function(i, e) {
$( this ).addClass("book");
$( this ).parent().addClass("books");
});
});
// Highlight code listings, if <body> has the class
// feature-highlight
$( function() {
if ( $( "body.feature-highlight:not(.feature-nohighlight)" ).length ) {
hljs.initHighlightingOnLoad();
}
});
/* Turn images into figures with captions. Several scenarios are handled, in
* order:
* If the img is followed by an <em>, then transform the <em> into a caption.
* If the img has a title, use that as the caption.
* If the img has an alt, use that.
* The following features have to be enabled:
* - feature-figcaption has to be enabled or the whole thing is disabled
* - feature-figcaption-hidden makes the captions invisible till you hover
* - feature-fignum adds figure numbering
* - feature-figlink adds automatic links of text like "Figure 4"
*/
$( function() {
$("body.feature-figcaption:not(.feature-nofigcaption) article img").each(function(i, e) {
var $this = $(this);
// Don't put captions on images that have URL fragment pseudo-classes.
if ( $this.attr('src').match(/#/) ) return;
var $txt = false;
if ( $this.next().is("em") ) {
$txt = $this.next().html();
$this.next().remove();
} else {
$txt = $this.attr('title') ? $this.attr('title')
: $this.attr('alt') ? $this.attr('alt')
: false;
}
if ( $txt ) {
var $fig = $this.wrap('<figure id="fig-' + (i+1) + '">')
.after('<figcaption class="f5 lh-copy i ph3">' + $txt + '</figcaption>')
.parent();
}
});
if ( $("body.feature-figlink").length ) {
$("article p, article li").each(function(i, e) {
var $old = $(this).html();
var $new = $old.replace(/Figure\s+(\d+)/g, '<a href="#fig-$1">Figure $1</a>');
if ( $old !== $new ) {
$(this).html($new);
}
});
}
});
/* Add captions to tables.
* If the table is followed by a <p><em>, then transform the <em> into a caption.
* The following features have to be enabled:
* - feature-tablecaption has to be enabled or the whole thing is disabled
* - feature-fignum adds table numbering
* - feature-figlink adds automatic links of text like "Table 4"
*/
$( function() {
$("body.feature-tablecaption article table").each(function(i, e) {
var $this = $(this);
var $txt = false;
if ( $this.next().is("p") ) {
if ( $this.next().children().first().is("em:only-child") ) {
$txt = $this.next().children().first().html();
$this.next().remove();
}
}
if ( $txt ) {
$this.prepend('<caption id="tbl-' + (i+1) + '">' + $txt + '</caption>');
}
});
if ( $("body.feature-figlink").length ) {
$("article p, article li").each(function(i, e) {
var $old = $(this).html();
var $new = $old.replace(/Table\s+(\d+)/g, '<a href="#tbl-$1">Table $1</a>');
if ( $old !== $new ) {
$(this).html($new);
}
});
}
});

View File

@@ -0,0 +1,216 @@
class: title, smokescreen, shelf, no-footer
# Análise Numérica - Trabalho Prático 1
### Diogo Cordeiro | Hugo Sales | Pedro Costa | Ricardo Pimenta
---
name: motivacao
class: roomy
# Motivação
Pretende-se usar os métodos de Newton e iterativo simples para determinar um valor aproximado de um zero de
$$x^2 - cos(x)^2$$
---
name: 1a
class: compact
# 1.a)
Optamos por implementar o algoritmo pedido em C++ devido à possiblidade da aplicação de
templates e lambdas. Deste modo, foi-nos possível implementar os dois métodos pedidos partindo
de um algoritmo genérico pois a diferença entre o método de Newton
e o método iterativo consiste apenas na fórmula de recorrência. Assim, o método de Newton
pode ser visto como uma forma do método iterativo simples.
int main() {
auto F = [](double x){ return std::pow(x, 2.0) - std::pow(std::cos(x), 2.0); };
auto dF = [](double x){ return 2.0 * x + std::sin(2.0 * x); };
double epsilon = 5.0 * std::pow(10.0, -12.0);
std::cout << newton(0.8, epsilon, F, dF, 100000) << `\n`;
}
---
name: 1a
class: compact
# 1.a)
template<typename step_func>
double find_root(double x0, double epsilon, step_func step, long iter_limit) {
double x1 = x0, err;
long iter = 1;
do {
x0 = x1;
x1 = step(x0);
err = std::abs(x1 - x0);
} while(err > epsilon && iter++ < iter_limit);
return x1;
}
template<typename F_t, typename dF_t>
double newton(double x0, double epsilon, F_t F, dF_t dF, long iter_limit) {
return find_root(x0, epsilon,
[&F, &dF](double x0){ return x0 - F(x0)/dF(x0); },
iter_limit);
}
---
name: 1b
class: compact, img-right
# 1.b)
![Gráfico para `\(x \in [-1;1]\)`](./graph.png)
Como `\(\forall{x}: cos^2(x) \in [0:1]\)`, temos que `\(x^2 \geq cos^2(x)\)` para `\(|x| > 1\)`, sabemos que o comportamento de `\(f(x)\)` é dominado pelo comportamento de `\(x^2\)`, a qual só tem duas raízes.
A menor das raízes encontra-se no intervalo `\(]-\infty;0]\)` e a maior destas em `\([0;\infty[\)`.
---
name: 1b-cont
class: compact, img-right
# 1.b)
![Gráfico para `\(x \in [0.7;0.8]\)`](./graph_small.png)
Através da análise do gráfico, verificamos que o intervalo `\([0.7;0.8]\)` contém uma raíz. Definimos então `\(a = 0.7\)` e `\(b = 0.8\)`.
---
name: 1c
class: compact
# 1.c)
Queremos mostrar que as condições de aplicabilidade do método de Newton são satisfeitas no intervalo. Assim,
$$F(x) = x^2 - cos(x)^2$$
$$F'(x) = 2 \cdot x + sin(2 \cdot x)$$
$$F''(x) = 2 + 2 \cdot cos(2 \cdot x)$$
Como todas estas funções são compostas partindo de somas de funções contínuas em `\(\mathbb{R}\)`, são também continuas no intervalo considerado, verificando-se assim o primeiro critério.
Dado que,
$$F(a) < 0, F(b) < 0 \Rightarrow F(a) \cdot F(b) < 0$$
---
name: 1c-cont
class: compact
# 1.c)
Verifica-se também o segundo critério.
Temos que `\(F''(x) = 2 + 2 \cdot cos(2 \cdot x)\)`, logo `\(cos(2 \cdot x) \in [-1;1]\)`, por isso `\(2 \cdot cos(2 \cdot x) \in [-2; 2]\)`, e `\(2 \cdot cos(2 \cdot x) + 2 \in [0;4]\)` o que implica que `\(F''(x) \geq 0\)`, para `\(x \in \mathbb{R}\)` e por isso `\(F'(x)\)` é não decrescente em `\(\mathbb{R}\)`, ou seja, `\(F'(b) \geq F'(a)\)` e `\(F'(a) > 3\)` e por isso `\(F'(x) \neq 0 \forall{x} : \in [a;b]\)`, o que verifica o terceiro critério.
Como foi dito anteriormente, `\(F''(x) \geq 0\)` em `\(\mathbb{R}\)` e, por isso, também para `\(\forall{x} : \in [a;b]\)`, verificando-se a quarta condição.
Para `\(x_0 = b\)`, temos que `\(F(x_0) > 0\)` e `\(F''(x_0) > 0\)`, logo `\(F(x_0) \cdot F''(x_0) > 0\)`, verificando-se a quinta condição.
Então a sucessão gerada converge para a unica raíz no intervalo `\([a;b]\)`.
---
name: 1d
class: compact
# 1.d)
Aplicamos o programa apresentado em `\(1.a\)` e obtivemos os seguintes resultados.
Iterações | Erro estimado | Valor
----------|---------------|---------------
1 | 5.9e-02 | 0.740528800196
2 | 1.4e-03 | 0.739086050826
3 | 9.2e-07 | 0.739085133216
4 | 3.7e-13 | 0.739085133215
Verficamos que o erro estimado é aproximadamente metade do erro estimado da iteração amterior,
o que justificamos com o facto de que o resultado teórico
nos dizer que o erro converge segundo uma secessão de segunda ordem.
---
name: 1e
class: compact
# 1.e)
Aplicando a fórmula
<center>\( M = \frac{1}{2} \cdot \frac{\max \limits_{a \leq x \leq b} | F''(x) | }{\min \limits_{a \leq x \leq b} | F'(x) | } \)</center>
Como `\(F''(x)\)` é decrescente em `\([0;\pi/2]\)`, então `\(\max\limits_{a \leq x \leq b} | F''(x) | = |F''(a)|\)` e como `\(F'(x)\)` é não decrescente em `\(\mathbb{R}\)`, `\(\min\limits_{a \leq x \leq b} | F'(x) | = F'(a)\)`.
Assim, obtemos `\(M = \frac{F''(0.7)}{2F'(0.7)} \leq \frac{2.4}{2 \cdot 2.3} \leq 0.53\)` e
`\(n \geq \frac{ln(\alpha)}{ln(2)}, \alpha = \frac{ln(5 \cdot 10^{-14}) + ln(0.53)}{ln(0.53) + ln(10^{-1})}\)`, logo `\(\alpha \leq \frac{-32}{2.9} \leq 12\)` e `\(n \geq 4\)`, ou seja que com 4 iterações conseguimos um erro absoluto inferior a `\(5 \cdot 10^{-14}\)`.
---
name: 2a
class: compact
# 2.a)
Dada a implementação genérica do algoritmo, o método iterativo simples pode ser
implementado sucintamente como:
template<typename F_t>
double fixed_point(double x0, double epsilon, F_t f, long iter_limit) {
return find_root(x0, epsilon, f, iter_limit);
}
---
name: 2a-cont
class: compact
# 2.a)
e usado como
auto f = [](double x){ return std::cos(x); };
std::cout << fixed_point(0.8, epsilon, f, 100000) << `\n`;
A expressão de `\(\texttt{f}\)` foi obtida por manipulação algébrica do seguinte modo:
$$F(x) = 0 \iff x^2 - cos^2(x) = 0 \iff x^2 = cos^2(x) \iff x = \pm cos(x)$$
Logo no intervalo `\([a;b]\)`, temos que `\(x = cos(x)\)` ou seja `\(f(x) = cos(x)\)`.
---
name: 2b
class: img-right
![Gŕafico da comparação do erro estimado dos dois métodos](err_fixed_point.png)
# 2.b)
Partindo destes resultados, verificamos empiricameente a diferença na ordem de convergência dos dois métodos.
Obtivemos como valor final para este método o valor `\(0.739085133217\)`, que difere do valor calculado
como o método de Newton em `\(-2 \cdot 10^{-12}\)`, por isso concluimos numericamente que, para os valores iniciais usados, este método pode ser aplicado, sendo que aproxima o valor real.
---
name: 2b
class: img-right
![Gŕafico da comparação do erro estimado dos dois métodos](err_fixed_point.png)
# 2.b)
Verificando as condições de aplicabilidade deste método, temos que `\(f(x)\)` é continua em `\([a;b]\)`, verificando-se a primeira condição,
que `\(f(0.7) \approx 0.76484219\)` e `\(f(0.7) \approx 0.69670671\)` o que implica que `\(f([a;b]) \notin [a;b]\)`, o implica que não se verifica a segunda condição
e que `\(\forall x \in [0.7;0.8] : |-sin(x)| < 1\)`, o que significa que se verifica a terceira condição.
---
name: 2b
class: img-right
![Gŕafico da comparação do erro estimado dos dois métodos](err_fixed_point.png)
# 2.b)
Apesar de não se verificar a segunda condição, verificamos na mesma a convergência da sucessão, o que não contradiz os resultados teóricos, uma vez que estas condições são suficientes, mas não necessárias para esta convergência.