Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

ENG1002: Engineering Mathematics and Scientific Computing

Written Coursework 1

2022

Note: This assignment carries 15% of the module mark. Completed work should be submitted via eBART by 12 noon on Monday 12/12/2022.

Math Part (Questions 1-2):

Answer all questions (marks are indicated in brackets []). Marks are awarded for clear, legible mathematical communication, written on A4 paper.

For full marks, your solutions must include: neatly drawn (with pencil and ruler) labelled diagrams, correct use of mathematical notation, sufficient comments and workings for the markers to easily follow your process. Where relevant, you should show how you have checked your answers.

Python Part (Questions 3-4):

Write your answers in the provided ENG1002_Term_1_Coursework_2022.ipynb file. Your submission for the Python part should consist exclusively of this file. Any files with a different file name or extension will not be considered.

A zip file named ‘ENG1002_Term1_2022.zip’ can be downloaded from the ELE page. This file is useful for you to answer the questions.

File requirement for submission

Once you have completed all questions, you have to create and submit a single .zip file containing a .pdf file with your answers for Questions 1-2 and the provided .ipynb file for Questions 3-4.

Communication & Presentation: [15 marks]

A maximum of 15 marks will be awarded for appropriate communication and presentation of your submitted work. This includes everything we have discussed over the last few weeks in tutorials, of which you can find a summary on ELE.

Question 1: [20 marks]

An engineer is building an electrical circuit and has to decide what type of cables he should use.

One of the cables has the following characteristics: a series resistance per unit length  R=5Ω/m , a shunt conductance G =

2´10-6 S/m, a series inductance L =

0.2´10-3 H/m and a shunt

capacitance C = 1´10-9 F/m. The engineer also knows that w = 3´104 rad.s-1

One of the most important parameters for the circuit design are the characteristic impedance Z0 given by

Z0  =

and the propagation coefficient g given by

g =

where Re(g ) ³ 0 .

a) Find the corresponding value of the characteristic impedance Z0. [8 marks]

b) Find the value of the propagation coefficient g . [6 marks]

c) Find the velocity of propagation given by u w , where

b

b = Im(g ) . [3 marks]



d) Find the wavelength  l  given by l 2p . [3 marks]

b

Question 2: [20 marks]

The pressure vessel of Figure Q2a will be used to store some pressurized fluid and should be manufactured using the minimum amount of material possible, while holding a total volume ���. The amount of material used is proportional to the surface area of the vessel, while the inner radius of the vessel should be equal to one third of the outer radius (���1


= ���).

3

 

Figure Q2a: Pressure vessel dimensions

a) Given that the total volume of the vessel should be constant and equal to ���, compute the total surface area of the vessel, as well as its first and second derivative with respect to ���, as functions of ���, ��� and ���. [10 marks]

b) Derive an expression for the value of ��� that minimises the amount of material used. [7 marks]

c) Using the expressions derived in previous questions, compute the value of ��� that minimises the amount of material used for ���  = 30° and ��� = 1unit. [3 marks]

The following expressions for the lateral surface area (������) and volume (������) of a frustum (truncated cone) can be used in your computations:

������ = ���(��� + ���1)√(��� − ���1)2 + ℎ2

��� = ��� 1 (���2 + ��� ���

+ ���2) .

Figure Q 1b: Frustum geometry.

��� 3 1 1


Question 3: [20 marks]

The Newton-Raphson method is one of the most commonly used methods for finding roots of general functions. Given a function ���(���), whose roots are to be found, and an initial guess ���0, the method can be used to obtain a better approximation of the root as:

���(���0)

���1  = ���0 ���(���  )   .

The process can be repeated as:

���(������)

������+1  =  ������  ���(��� )

until a sufficiently accurate approximation of the root has been obtained.

Write a function, named Newton, implementing the method in Python. Given a function, its derivative and an initial guess for the root, the Newton function should update the solution using the above formula until a root of sufficient accuracy has been obtained or a predefined number of iterations has been performed. To determine whether solutions are sufficiently accurate, the value of the function for each candidate solution should be compared with a predefined tolerance to ensure it is sufficiently close to zero. In order to avoid zero division errors, the function should test whether the values of the function derivative are less than a predefined numerical tolerance and stop the solution if that is the case. Finally, the function should receive/return the following input/output arguments:


Input Arguments

Name

Data Type

Argument type

Default value

Description

x0

float

Positional

-

Initial guess for the root.

f

Python function

Positional

-

Python function, implementing the function whose root is to be computed, it should receive a single numerical input argument and return a single number.

df

Python function

Positional

-

Python function, implementing the derivative of the function whose root is to be computed, it should receive a single numerical input argument and return a single number.

tol

float

Keyword

1e-10

Convergence tolerance, it should be used to determine whether the method has converged.

maxIterations

int

Keyword

20

Maximum allowed number of iterations. It should be used to prevent the method from repeating indefinitely, in case it is not converging.

epsilon

float

Keyword

1e-14

Numerical tolerance used to determine whether the derivative of the function is zero at any given iteration.


Output Arguments

Name

Data Type

Description

xi

float/None

Final solution obtained. In case a zero derivative is encountered, then

None should be returned.

status

str

Status string, containing information about the solution. Based on how the solution progresses, it should contain the following:

In case the solution has converged, it should contain the message: ’Solution converged after n iterations’, where n should be replaced by the number of iterations performed.

In case the solution has not converged to the required accuracy, it should contain the message: ‘Solution not found within the required accuracy, accuracy of current solution: a’, where a is the best accuracy achieved by the method, defined as the absolute value of f at the last iteration performed.

In case a zero derivative is encountered, it should contain the message: ’Solution interrupted after n iterations, zero derivative encountered’ where n should be replaced by the number of the iteration where the zero derivative was encountered.

Question 4: [25 marks]

For the pressure vessel of Question 2:

a) Write a Python function, named vesselArea, to compute the total surface area of the vessel, as derived in Question 2-a). The function should receive the following input arguments:

Input Arguments

Name

Data Type

Argument type

Default value

Description

r

float

Positional

-

Radius of the vessel.

theta

float

Keyword

0

Angle of the truncated cone at the top and bottom of the vessel.

V

float

Keyword

1

Volume of the vessel.

and return the total surface area. [4 marks]

b) Write a program that evaluates the surface area of the vessel for different values of the radius

��� and angle ���, storing the values that result in the minimum area, for ��� = 1 unit. For ���, 10 uniformly distributed values in the interval [0.1, 0.9] should be tested, while for ��� all angles between 0° and 75° at 1° intervals. The following variable names should be used to store the above quantities:

Name

Description

areaMin

Minimum surface of the vessel.

rMin

Radius of the vessel resulting to the minimum surface area.

thetaMin

Angle resulting to the minimum surface area.

[8 marks]

c) Write two Python functions, named vesselAreaDerivative and vesselAreaSecondDerivative, to compute the first and second derivative of the surface area of the vessel, as derived in Question 2-a). The functions should receive the same input arguments as the function of Question 4-a), but the default value for the angle (argument theta) should be equal to the angle thetaMin obtained in Question 4-b). Both functions should return a single numerical output argument with the value of the first and second derivative of the surface area respectively. [5 marks]

d) Using the Newton function of Question 3-a, with the functions of Question 4-c) as the input function and its derivative, and the value of ��� computed in Question 4-b) as an initial guess, find the value of ��� for which the derivative of the total surface area is 0, and therefore the total area is minimised. Store the computed radius in a variable named rOpt and the second argument returned by the Newton function in a variable named status. Once you have obtained the optimal radius, evaluate the area corresponding to this radius and store it in a variable named areaOpt. [8 marks]