PHY2027 – Scientific Programming in C T1:09 2020
Project: Option 1
• General comments
The objective of the project is to test your ability to use all the features of C that we have studied
within the module. Remember that you must produce a piece of code that conforms to the general
expectations detailed in the introduction to the module (code structure, indentation, etc).
• Instructions
Write a code that performs numerical integration of polynomial functions. The code must:
• Let the user choose the order and coefficients of the polynomials.
• Let the user choose different integration methods (you may want to explore the trapezoidal
rule and Simpson’s rule to begin with).
• Present a couple of test cases, showing the difference between the exact solution and the
result obtained from your code.
• Optionally, if you have time and the program works, try integrating other types of functions.
Up to 20 marks will be awarded if the code (see general expectations in the introduction to the
module):
1. Has the appropriate structure [5 marks]
2. Has the appropriate indentation [5 marks]
3. Uses variables of the correct type [5 marks]
4. Is properly commented [5 marks]
Note: Due to the large number of programs that we will need to mark, it may be difficult for
us to debug a code and find the exact reason for failure if the code is not written in a clear and
structured way.