Fixed GCC incompatiblity.

parent 66f10d33
...@@ -16,16 +16,19 @@ double df(double x) { ...@@ -16,16 +16,19 @@ double df(double x) {
} }
int main(void) { int main(void) {
unsigned int steps; unsigned int steps = 0;
double tmp = bisec(&f, 1, 2, EPSILON, &steps);
printf("Square root of 2 using bisection method: %.20f (%d steps)\n", printf("Square root of 2 using bisection method: %.20f (%d steps)\n",
bisec(&f, 1, 2, EPSILON, &steps), steps); tmp, steps);
tmp = newton_raphson(&f, &df, 1.4, EPSILON, &steps, 100000);
printf("Square root of 2 using Newton-Raphson method: %.20f (%d steps)\n", printf("Square root of 2 using Newton-Raphson method: %.20f (%d steps)\n",
newton_raphson(&f, &df, 1.4, EPSILON, &steps, 100000), steps); tmp, steps);
tmp = regula_falsi(&f, 1, 2, EPSILON, &steps, 100000);
printf("Square root of 2 using the Regula Falsi method: %.20f (%d steps)\n", printf("Square root of 2 using the Regula Falsi method: %.20f (%d steps)\n",
regula_falsi(&f, 1, 2, EPSILON, &steps, 100000), steps); tmp, steps);
return 0; return 0;
} }
...@@ -28,17 +28,17 @@ double f2(double x) { ...@@ -28,17 +28,17 @@ double f2(double x) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
if( argc != 2 ) { if( argc != 2 ) {
printf("Usage: %s STEPS", argv[0]); printf("Usage: %s STEPS\n", argv[0]);
return -1; return -1;
} }
PRINT_INTEGRALS(f1, 0, 1, (M_E - 1) / M_E); PRINT_INTEGRALS(f1, 0, 1, (M_E - 1) / M_E);
puts(""); puts("");
PRINT_INTEGRALS(f2, 0, 2, 1 - 3/pow(M_E, 2)); PRINT_INTEGRALS(f2, 0, 2, 1 - 3 / pow(M_E, 2));
puts(""); puts("");
PRINT_INTEGRALS(f2, 0, 20, 1 - 21/pow(M_E, 20)); PRINT_INTEGRALS(f2, 0, 20, 1 - 21 / pow(M_E, 20));
puts(""); puts("");
PRINT_INTEGRALS(f2, 0, 200, 1 - 201/pow(M_E, 200)); PRINT_INTEGRALS(f2, 0, 200, 1 - 201 / pow(M_E, 200));
puts(""); puts("");
PRINT_INTEGRALS(sin, 0, 8 * M_PI, 0.0); PRINT_INTEGRALS(sin, 0, 8 * M_PI, 0.0);
......
\documentclass[10pt,a4paper]{article} \documentclass[10pt,a4paper]{article} % {{{
\usepackage{float,url,graphicx,booktabs}
\usepackage{float,url,graphicx,booktabs}
\usepackage[dutch]{babel} \usepackage[dutch]{babel}
% }}}
\title{Modelleren, Simuleren \& Contin\"ue Wiskunde \\ \title{Modelleren, Simuleren \& Contin\"ue Wiskunde \\
Assignment 2: Differentiation, roots and Integration} Assignment 2: Differentiation, roots and Integration}
\author{Tadde\"us Kroes (6054129) \and Sander van Veen (6167969)} \author{Tadde\"us Kroes (6054129) \and Sander van Veen (6167969)}
...@@ -96,7 +98,6 @@ beoogde nauwkeurigheid. ...@@ -96,7 +98,6 @@ beoogde nauwkeurigheid.
% }}} % }}}
\section{Newton-Raphson} % {{{ \section{Newton-Raphson} % {{{
\label{sec:Newton-Raphson} \label{sec:Newton-Raphson}
...@@ -203,3 +204,4 @@ t/m 10 jaar).} ...@@ -203,3 +204,4 @@ t/m 10 jaar).}
% }}} % }}}
\end{document} \end{document}
% vim: foldmethod=marker:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment