1. Homepage
  2. Programming
  3. MTHS2008 Advanced Mathematical Modelling for Process Engineers - COURSEWORK 2: DOUBLE NUMERICAL INTEGRATION AND FINITE

MTHS2008 Advanced Mathematical Modelling for Process Engineers - COURSEWORK 2: DOUBLE NUMERICAL INTEGRATION AND FINITE

Engage in a Conversation
NottinghamMTHS2008Advanced Mathematical Modelling for Process EngineersMathematical ModellingDOUBLE NUMERICAL INTEGRATIONPython

1 MTHS2008 CourseNana.COM


SPRING SEMESTER 2023-2024
ASSESSED COURSEWORK 2 – DOUBLE NUMERICAL INTEGRATION AND FINITE CourseNana.COM

DIFFERENCE METHODS CourseNana.COM

Submission deadline: 5pm, Friday 22 March 2023
This coursework contributes 20% towards the overall grade for the module. CourseNana.COM

Rules: CourseNana.COM

Each student is to submit their own coursework.
You are allowed to work together and discuss in small groups (2 to 4 people), but you must
CourseNana.COM

write all code by yourself. CourseNana.COM

You must submit only the .py files requested in this question paper. Details of the required filenames are given within the questions. You are strongly encouraged to use the Spyder IDE (integrated development environment). Hence you should not write IPython Notebooks (.ipynb), and you should not use Jupyter. CourseNana.COM

You may adapt any code that we developed in class (i.e. you do not have to start from scratch). CourseNana.COM

In each template file, the packages and libraries required to complete the question are listed. You are not permitted to use any libraries or packages beyond those given for each question. CourseNana.COM

MTHS2008 Turn Over CourseNana.COM

Marks breakdown: CourseNana.COM

2 MTHS2008 CourseNana.COM

This coursework is out of 100 marks: • Outputs in Q1a – 20 marks;
Outputs in Q1b – 30 marks;
Outputs in Q2a – 20 marks; CourseNana.COM

Outputs in Q2b – 20 marks;
Commenting and structure – 10 marks. CourseNana.COM

To obtain the maximum marks for commenting and structure: CourseNana.COM

  • Your comments should be helpful to the reader; they should help make your program easier to navigate. Note that having too many comments is potentially as bad as having too few comments! The style of commenting we used in the example programs is what you should aim for. CourseNana.COM

  • Your program structure should be: imports at the top (if any), followed by function definitions, followed by anything else. You ought to remove or comment out any lines of code used to call and test your functions prior to submission; however, you will not be penalised if you leave them in, provided that they are in the correct place (e.g. not sandwiched in-between two function definitions). CourseNana.COM

    Guidelines for submitting the coursework correctly: CourseNana.COM

    For full marks, your functions need to return the correct outputs for particular input arguments. Suggestions for tests you can use to check your code with are given but you are encouraged to test your code using your own examples also. CourseNana.COM

    Please be aware that we will test your functions to check that they work and produce the desired output(s), both with the test given in the question and with different undisclosed data. CourseNana.COM

    If your modules have filenames that differ to what we have explicitly asked for, then you risk losing marks. CourseNana.COM

    • Therefore, please do not add your username or student ID number to your filename. Your functions must have the same inputs and outputs as those specified in the question(s), CourseNana.COM

    and in the same order as specified. CourseNana.COM

MTHS2008 Turn Over CourseNana.COM

3 MTHS2008 1. Question 1a: Plotting region of integration for a double integral CourseNana.COM

Using template_question_1a.py (on Moodle) as a template, write a module containing a function plot_region(a,b,y1,y2,n) to create a figure containing the plot of the region of integration for the double integral CourseNana.COM

𝑏 𝑦2(𝑥) CourseNana.COM

𝑓(𝑥,𝑦)d𝑦d𝑥. 𝑎 𝑦1(𝑥) CourseNana.COM

You function should return the figure as an output. To do so, give the figure a ‘handle’ when you create it, i.e. assign it to a variable. For example CourseNana.COM

fig = plt.figure()
You can then return the figure to the user using the command return fig. CourseNana.COM

Your module file must be named q1a.py and your function should return one output - the figure containing the plot of the region of integration. CourseNana.COM

Test: To test that your code is working as expected, plot the region of integration for the double integral CourseNana.COM

2𝑥
∫ ∫ 𝑥𝑦2d𝑦d𝑥 CourseNana.COM

1 −𝑥
with 𝑛 = 12. You should be able to verify the accuracy of your plot by sketching the region CourseNana.COM

of integration by hand. CourseNana.COM

[20 marks] Using template_question_1b.py (on Moodle) as a template, write a module containing a CourseNana.COM

function double_int_approx(a,b,y1,y2,f,n,m) to approximate the double integral CourseNana.COM

𝑏 𝑦2(𝑥) CourseNana.COM

Question 1b: Approximating a double integral CourseNana.COM

𝑓(𝑥,𝑦)d𝑦d𝑥, 𝑎 𝑦1(𝑥) CourseNana.COM

using the quadrature rule where Simpson’s rule has been applied in both coordinate directions. The quadrature rule was given in the first Python session of Spring semester. CourseNana.COM

The function should take as its parameters CourseNana.COM

  • 𝑎, 𝑏, 𝑦1(𝑥), 𝑦2(𝑥) as the integral limits that define the region of integration; CourseNana.COM

  • 𝑓 as the integrand; CourseNana.COM

  • 𝑛 and 𝑚 are the number of strips to be used in the Simpson’s approximation in the 𝑥-direction and 𝑦-direction respectively. CourseNana.COM

    Your function should assert that any user gives values of 𝑛, 𝑚 that are even as required by Simpson’s rule. CourseNana.COM

    Your module file must be named q1b.py and your function should return one output - an approximation of the double integral. CourseNana.COM

    Test: To test that your code is working, compare your approximation of 2 𝑥 𝑥𝑦2 d𝑦 d𝑥 CourseNana.COM

to the true value of the double integral: 62. 15 CourseNana.COM

1 −𝑥 CourseNana.COM

MTHS2008 CourseNana.COM

Turn Over CourseNana.COM

[30 marks] CourseNana.COM

CourseNana.COM

4 MTHS2008 2. Question 2a: Poisson’s equation with a Neumann boundary conditions CourseNana.COM

Using template_question_2a.py (on Moodle) as a template, write a module containing a function poisson_neumann_approx(N,a,b,alpha,beta,f) that uses central finite differences to find numerical solutions to the 1D Poisson equation on [𝑎, 𝑏] subject to boundary conditions: CourseNana.COM

𝑑2𝑢 = 𝑓(𝑥), 𝑑2𝑥 CourseNana.COM

Your module file must be named q2a.py and your function should return one output - an array containing approximations 𝑢0, 𝑢1, 𝑢2, , 𝑢𝑁−2, 𝑢𝑁−1, 𝑢𝑁. CourseNana.COM

Test: To test that your code is working as expected, compute approximations for 𝑑2𝑢 = 4𝜋2 cos(2𝜋𝑥), CourseNana.COM

[25 marks] CourseNana.COM

𝑢(𝑏) = 𝛽. CourseNana.COM

𝑢(𝑎) = 𝛼,
The parameter 𝑁 acts as the number of sub-intervals considered in the mesh of [𝑎, 𝑏]. CourseNana.COM

𝑑2𝑥
The true solution to this PDE is 𝑢(𝑥) = cos(2𝜋𝑥). CourseNana.COM

𝑢(0) = 1, CourseNana.COM

𝑢(1) = 0. CourseNana.COM

Question 2b: Time independent advection-diffusion-reaction equation CourseNana.COM

Using template_question_2b.py (on Moodle) as a template, write a module containing a function advection_1d_solver(N,a,b,f) that uses central differencing approximations to find numerical solutions to the 1D time-independent advection-diffusion-reaction equation on [0, 1] with boundary conditions: CourseNana.COM

−𝑎𝑑2𝑢 + 𝑏𝑑𝑢 = 𝑓(𝑥), 𝑑𝑥2 𝑑𝑥 CourseNana.COM

𝑢(0) = 0,
where 𝑎 > 0 and 𝑏 are scalar constants. The parameter 𝑁 acts as the number of sub-intervals CourseNana.COM

𝑢(1) = 0, considered in the mesh of [0, 1]. CourseNana.COM

Your module file must be named q2b.py and your function should return one output - a plot of your solution approximation. CourseNana.COM

Test: To test that your code is working as expected, plot your approximate solution for 𝑑2𝑢 + 2𝑑𝑢 = 1, CourseNana.COM

𝑑2𝑥 𝑑𝑥
𝑢(0) = 0, 𝑢(1) = 0.
CourseNana.COM

ThetruesolutiontothisPDEis𝑢(𝑥)=𝑥+ 2 CourseNana.COM

1 2(𝑒2−1) ( CourseNana.COM

1−𝑒2𝑥 . ) CourseNana.COM

[25 marks]  CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Nottingham代写,MTHS2008代写,Advanced Mathematical Modelling for Process Engineers代写,Mathematical Modelling代写,DOUBLE NUMERICAL INTEGRATION代写,Python代写,Nottingham代编,MTHS2008代编,Advanced Mathematical Modelling for Process Engineers代编,Mathematical Modelling代编,DOUBLE NUMERICAL INTEGRATION代编,Python代编,Nottingham代考,MTHS2008代考,Advanced Mathematical Modelling for Process Engineers代考,Mathematical Modelling代考,DOUBLE NUMERICAL INTEGRATION代考,Python代考,Nottinghamhelp,MTHS2008help,Advanced Mathematical Modelling for Process Engineershelp,Mathematical Modellinghelp,DOUBLE NUMERICAL INTEGRATIONhelp,Pythonhelp,Nottingham作业代写,MTHS2008作业代写,Advanced Mathematical Modelling for Process Engineers作业代写,Mathematical Modelling作业代写,DOUBLE NUMERICAL INTEGRATION作业代写,Python作业代写,Nottingham编程代写,MTHS2008编程代写,Advanced Mathematical Modelling for Process Engineers编程代写,Mathematical Modelling编程代写,DOUBLE NUMERICAL INTEGRATION编程代写,Python编程代写,Nottinghamprogramming help,MTHS2008programming help,Advanced Mathematical Modelling for Process Engineersprogramming help,Mathematical Modellingprogramming help,DOUBLE NUMERICAL INTEGRATIONprogramming help,Pythonprogramming help,Nottinghamassignment help,MTHS2008assignment help,Advanced Mathematical Modelling for Process Engineersassignment help,Mathematical Modellingassignment help,DOUBLE NUMERICAL INTEGRATIONassignment help,Pythonassignment help,Nottinghamsolution,MTHS2008solution,Advanced Mathematical Modelling for Process Engineerssolution,Mathematical Modellingsolution,DOUBLE NUMERICAL INTEGRATIONsolution,Pythonsolution,