Introduction to the exercises of chapter 2

On this page it is attempted to provide help with the exercises in chapter 2 of the book. The final goal is the design of a spectral/hp element solver for the (1-D) Helmholtz differential equation in exercise 5. The exercises are constructed in such a way that each exercise builds on the previous ones. Links to my codes are given so that it will be possible to compare your results with mine. A fundamental aspect of my solutions to the exercises was the use of the polylib library which will be explained first, together with some information on how to compile your codes. After that the exercises will be treated, followed by some convergence results and a troubleshooting section.

When I started with exercise 1 I had been trying exercises from the Dutch booklet "C++ zonder stress" which means "C++ without stress" for about two weeks. My previous programming experience was mostly with Matlab, so this means that everyone who puts some effort in it can do them. My codes are officially written in C++ but use virtually none of the features which make C++ different from C, so you can consider them as being plain C. Everything was performed on a Linux computer with access to the Lapack library. For me it was the first time I worked with Linux so if you think the level of explanation is too basic you can just look at the codes. I don't think there are large differences between different editors and for compiling I used a GNU compiler.

It is a fact that when you're programming you'll run into problems every now and then. What helped me a great deal in coping with these problems was Google. Almost every topic is addressed somewhere on the internet so it is only a question of finding it. Anyway, don't be discouraged, if I can do it anybody can, so good luck!