Introduction
Introduction Statistics Contact Development Disclaimer Help
tREADME.rst - numeric - C++ library with numerical algorithms
git clone git://src.adamsgaard.dk/numeric
Log
Files
Refs
LICENSE
---
tREADME.rst (4389B)
---
1 ============================================
2 README: ODE integration with complex numbers
3 ============================================
4 Exam exercise for *Numerical Methods* by Anders D. Christensen (mail_)
5
6 File description
7 ----------------
8 - ``Makefile``: Description for GNU Make, handles compilation and execut…
9 - ``README.rst`` (this file): Description of numeric implementation and …
10 Written with reStructuredText syntax.
11 - ``check.cpp``: Function for displaying the state of a condition to std…
12 - ``check.h``: Prototype for the check-function.
13 - ``functions.h``: Input functions to be evaluated.
14 - ``mainA.cpp``: Main source code file for part A.
15 - ``ode.cpp``: Constructor and functions for the ODE class, including Ru…
16 stepper and driver.
17 - ``ode.h``: Header file with the ODE class. This file must be included …
18 programs that want to utilize the ODE functionality.
19 - ``plot.gp``: Script for plotting all graphs with Gnuplot.
20 - ``typedefs.h``: Header file containing definitions of two main types,
21 ``Inttype``, a whole-number type, and ``Floattype``, a floating point …
22 type. The type definitions can be changed to different lengths and pre…
23 The program can be compiled for verbose output by changing the ``verbo…
24 variable.
25 - ``vector_arithmetic.h``: Operator overloading functions for the ``std:…
26 class.
27
28 Problem descriptions
29 --------------------
30 The four generated executables each demonstrate the ODE solvers function…
31 performing the following tasks. The results consist of the console outpu…
32 the corresponding plot with filename ``plot<Character>.png``.
33 - *A*: Construct an ODE solver that can handle functions with complex va…
34 Demonstrate that it solves the real component correctly, by stepping alo…
35 a path in the real range.
36 - *B*: Demonstrate that the ODE solver can solve the imaginary component…
37 stepping along a path in the imaginary range.
38 - *C*: Demonstrate the solution of a set of complex equations by stepping
39 through the complex plane.
40 - *D*: For an integration path in the complex plane, visualize how the
41 requirements of absolute- and relative precision are related to the numb…
42 integration steps, for a given floating point precision.
43
44 Implementation
45 --------------
46 This exercise was written in object-oriented C++ for easy reuse. For
47 portability, all included classes are from the standard template library.
48
49 The necessary ``std::vector`` arithmetic operations where overloaded to …
50 element-wise operations, such as vector-scalar multiplication, vector-ve…
51 addition, etc. This approach was preferred over using ``std::valarray``,…
52 is not dynamically expandable.
53
54 When creating a new ODE object, the user specifies the end-points of the…
55 range, where the specified system of ordinary differential equations with
56 complex values will be solved. The range end-points are complex numbers
57 themselves, and the user can thus specify whether the integrator steps t…
58 range of real values, imaginary values, or both components in the comple…
59
60 The solver steps through the specified range by an adaptive step size, w…
61 also a complex number. The user specifies the fraction of the range to b…
62 as a start value for the step. The default value is 0.01.
63
64 The ODE class contains functions for writing the ODE solution to stdout
65 (``ODE::print``) or to a text file (``ODE::write``). The output format i…
66 following; the first column is the real part of x, second column the ima…
67 part. The subsequent columns do in turn consist of real- and imaginary …
68 the variables in the ODE.
69
70 The program requires a modern C++ compiler, GNU Make and Gnuplot. It has…
71 tested with GCC, Clang and llvm.
72
73 Compiliation and execution
74 --------------------------
75 To make and execute the program, go to the root folder and type `make`. …
76 will compile and execute the programs for part A-D, and plot output grap…
77 desired, individual parts can be compiled and executed using `make <Char…
78
79 To view the source code in a browser with vim's syntax highlighting, typ…
80 html`, and view the files in the `html` folder. The generation of HTML f…
81 requires a newer vim for the source code files, and Docutils for the rea…
82
83 All output and objects can be removed using `make clean`.
84
85
86
87 .. _mail: mailto:[email protected]
88
89 #vim: set tw=80
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.