Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
134e61e4
Commit
134e61e4
authored
Mar 01, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ModSim: Added result table to 2.5
parent
5c46eed8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
29 deletions
+34
-29
modsim/ass2/q5.c
modsim/ass2/q5.c
+2
-2
modsim/ass2/report.tex
modsim/ass2/report.tex
+32
-27
No files found.
modsim/ass2/q5.c
View file @
134e61e4
...
@@ -22,8 +22,8 @@ double f2(double x) {
...
@@ -22,8 +22,8 @@ double f2(double x) {
#define PRINT_INTEGRAL(func, a, b, method, real) { \
#define PRINT_INTEGRAL(func, a, b, method, real) { \
_i = integral(&func, &method, a, b, atoi(argv[1])); \
_i = integral(&func, &method, a, b, atoi(argv[1])); \
printf(#func " from " #a " to " #b " using %-19s %.
80e (%.2f%%
)\n", \
printf(#func " from " #a " to " #b " using %-19s %.
12e (%.12e
)\n", \
#method " method:", _i, fabs((real - _i)
/ real * 100
)); \
#method " method:", _i, fabs((real - _i))); \
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
...
...
modsim/ass2/report.tex
View file @
134e61e4
\documentclass
[10pt,a4paper]
{
article
}
\documentclass
[10pt,a4paper]
{
article
}
\usepackage
{
float,url,graphicx
}
\usepackage
{
float,url,graphicx
,booktabs
}
\usepackage
[dutch]
{
babel
}
\usepackage
[dutch]
{
babel
}
...
@@ -147,32 +147,37 @@ double sin(x);
...
@@ -147,32 +147,37 @@ double sin(x);
\noindent
Dit heeft het volgende resultaat gegeven als we het programma met
\noindent
Dit heeft het volgende resultaat gegeven als we het programma met
1.000.000 steps uitvoeren:
1.000.000 steps uitvoeren:
\begin{verbatim}
\begin{table}
[H]
f1 from 0 to 1 using rectangle method: 6.32120558829e-01
\begin{tabular}
{
llllrr
}
\toprule
f1 from 0 to 1 using trapezoidal method: 6.32120558829e-01
f
&
a
&
b
&
methode
&
\multicolumn
{
1
}{
l
}{
benadering
}
&
\multicolumn
{
1
}{
l
}{
afwijking
}
\\
f1 from 0 to 1 using simpson method: 6.32120558829e-01
\midrule
f1 from 0 to 1 using gauss method: 6.32120558829e-01
f1
&
0
&
1
&
rectangle
&
$
6
.
321205588285
\cdot
10
^{
-
01
}$
&
$
3
.
952393967666
\cdot
10
^{
-
14
}$
\\
f1
&
0
&
1
&
trapezoidal
&
$
6
.
321205588286
\cdot
10
^{
-
01
}$
&
$
4
.
141131881852
\cdot
10
^{
-
14
}$
\\
f2 from 0 to 2 using rectangle method: 5.93994150290e-01
f1
&
0
&
1
&
simpson
&
$
6
.
321205588285
\cdot
10
^{
-
01
}$
&
$
1
.
276756478319
\cdot
10
^{
-
14
}$
\\
f2 from 0 to 2 using trapezoidal method: 5.93994150290e-01
f1
&
0
&
1
&
gauss
&
$
6
.
321205588285
\cdot
10
^{
-
01
}$
&
$
1
.
276756478319
\cdot
10
^{
-
14
}$
\\
f2 from 0 to 2 using simpson method: 5.93994150290e-01
\midrule
f2 from 0 to 2 using gauss method: 5.93994150290e-01
f2
&
0
&
2
&
rectangle
&
$
5
.
939941502904
\cdot
10
^{
-
01
}$
&
$
2
.
019495681793
\cdot
10
^{
-
13
}$
\\
f2
&
0
&
2
&
trapezoidal
&
$
5
.
939941502898
\cdot
10
^{
-
01
}$
&
$
3
.
644862189844
\cdot
10
^{
-
13
}$
\\
f2 from 0 to 20 using rectangle method: 9.99999956716e-01
f2
&
0
&
2
&
simpson
&
$
5
.
939941502902
\cdot
10
^{
-
01
}$
&
$
1
.
454392162259
\cdot
10
^{
-
14
}$
\\
f2 from 0 to 20 using trapezoidal method: 9.99999956715e-01
f2
&
0
&
2
&
gauss
&
$
5
.
939941502902
\cdot
10
^{
-
01
}$
&
$
1
.
454392162259
\cdot
10
^{
-
14
}$
\\
f2 from 0 to 20 using simpson method: 9.99999956716e-01
\midrule
f2 from 0 to 20 using gauss method: 9.99999956716e-01
f2
&
0
&
20
&
rectangle
&
$
9
.
999999567325
\cdot
10
^{
-
01
}$
&
$
1
.
671296434580
\cdot
10
^{
-
11
}$
\\
f2
&
0
&
20
&
trapezoidal
&
$
9
.
999999566825
\cdot
10
^{
-
01
}$
&
$
3
.
332367715103
\cdot
10
^{
-
11
}$
\\
f2 from 0 to 200 using rectangle method: 1.00000000001e+00
f2
&
0
&
20
&
simpson
&
$
9
.
999999567158
\cdot
10
^{
-
01
}$
&
$
2
.
831068712794
\cdot
10
^{
-
14
}$
\\
f2 from 0 to 200 using trapezoidal method: 9.99999999965e-01
f2
&
0
&
20
&
gauss
&
$
9
.
999999567158
\cdot
10
^{
-
01
}$
&
$
2
.
808864252302
\cdot
10
^{
-
14
}$
\\
f2 from 0 to 200 using simpson method: 9.99999999998e-01
\midrule
f2 from 0 to 200 using gauss method: 9.99999999998e-01
f2
&
0
&
200
&
rectangle
&
$
1
.
000000001666
\cdot
10
^{
+
00
}$
&
$
1
.
666276006063
\cdot
10
^{
-
09
}$
\\
f2
&
0
&
200
&
trapezoidal
&
$
9
.
999999966665
\cdot
10
^{
-
01
}$
&
$
3
.
333514797532
\cdot
10
^{
-
09
}$
\\
sin from 0 to 8 * M
_
PI using rectangle method: -1.04730878509e-13
f2
&
0
&
200
&
simpson
&
$
9
.
999999999998
\cdot
10
^{
-
01
}$
&
$
1
.
918465386552
\cdot
10
^{
-
13
}$
\\
sin from 0 to 8 * M
_
PI using trapezoidal method: -1.08168370335e-13
f2
&
0
&
200
&
gauss
&
$
9
.
999999999998
\cdot
10
^{
-
01
}$
&
$
1
.
918465386552
\cdot
10
^{
-
13
}$
\\
sin from 0 to 8 * M
_
PI using simpson method: -8.63149135973e-14
\midrule
sin from 0 to 8 * M
_
PI using gauss method: -8.55165510887e-14
sin
&
0
&
$
8
\pi
$
&
rectangle
&
$
1
.
649022273643
\cdot
10
^{
-
14
}$
&
$
1
.
649022273643
\cdot
10
^{
-
14
}$
\\
\end{verbatim}
sin
&
0
&
$
8
\pi
$
&
trapezoidal
&
$
-
2
.
597858752022
\cdot
10
^{
-
14
}$
&
$
2
.
597858752022
\cdot
10
^{
-
14
}$
\\
sin
&
0
&
$
8
\pi
$
&
simpson
&
$
-
1
.
797341770030
\cdot
10
^{
-
14
}$
&
$
1
.
797341770030
\cdot
10
^{
-
14
}$
\\
sin
&
0
&
$
8
\pi
$
&
gauss
&
$
-
1
.
797258919631
\cdot
10
^{
-
14
}$
&
$
1
.
797258919631
\cdot
10
^{
-
14
}$
\\
\bottomrule
\end{tabular}
\end{table}
% }}}
% }}}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment