Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Topis for Term Project

Due: 30/11/2023

˝ Course name : Computational Methods for Engineers


˝ Course code : CPS201
˝ Semester : Fall 2023
˝ Lecturer : Tran Quoc Viet
˝ Email : viet204@gmail.com

Fall 2023
Computational Methods for Engineers Topis for Term Project

Notes:

• Select one of the following topics and choose your partner to make a group to work to-
gether. You have to register your topic and partner in 30/11/2023.

• One group has no more than two members. Group with only one member is appreciated.

• You are encouraged to solve your problem using several methods. You should make more
numerical experiments to convince readers.

• Submit your report (in PDF) and your codes (in Python) to my email before the deadline.
We do not allow you to submit files with other formats.

Topic 01: Case Study 16.1, [Chapra et al., 2010].

1. Read the case study and explain as many details as possible.

2. Perform all its calculations with your Python programs (instead of Excel. You can use
some reliable subroutine from scipy.)

3. Compare your numerical results with each other and with the one of this section. Do
your optimization results satisfy Karush-Kuhn-Tucker conditions? Show it.

4. Suppose that we are not able to calculate gradients exactly. Can you apply some technique
to approximate gradients? Richardson extrapolation method should be a good one to
consider. Repeat your calculations with this gradient approximation.

Topic 02: Solve Problem 16.16, p. 433-434, [Chapra et al., 2010].

1. Explain your solution as much as possible.

2. Perform all calculations with your Python programs. (You can apply some reliable sub-
routine from scipy). Your optimization results should satisfy Karush-Kuhn-Tucker con-
ditions. Verify it.

3. Given the range of diameters and thicknesses as in the problem. Repeat your computa-
tions with several values of compressive load P , e.g.

P “ 1000, 1500, 2500, 3000

4. Suppose that we are not able to calculate gradients exactly. Can you apply some technique
to approximate gradients? Richardson extrapolation method should be a good one to
consider. Repeat your calculations with this gradient approximation.

1
Computational Methods for Engineers Topis for Term Project

Topic 03: Solve Problem 16.33, p. 437, [Chapra et al., 2010].


1. Explain your solution as much as possible.
2. Perform all calculations with your Python programs. (You can apply some reliable sub-
routine from scipy). Your optimization results should satisfy Karush-Kuhn-Tucker con-
ditions. Verify it.
3. Repeat your computations with several values of force F , e.g.
F “ 5000, 10000, 15000, 20000

4. Suppose that we are not able to calculate gradients exactly. Can you apply some technique
to approximate gradients? Richardson extrapolation method should be a good one to
consider. Repeat your calculations with this gradient approximation.

Topic 04: Case Study 16.2, [Chapra et al., 2010].


1. Read the case study and explain as many details as possible.
2. Perform all its calculations with your Python programs (instead of Excel. You can adopt
some reliable subroutine from scipy).
3. Compare your results with the one of this section. Do your optimization results satisfy
Karush-Kuhn-Tucker conditions? Show it.
4. Suppose that we are not able to calculate gradients exactly. Can you apply some technique
to approximate gradients? Richardson extrapolation method should be a good one to
consider. Repeat your calculations with this gradient approximation.

Topic 05: Case Study 20.1, [Chapra et al., 2010].


1. Read the case study and explain as many details as possible.
2. Perform all its calculations using Python. Compare your results with the one of this
section.
3. Solve Problem 20.1.
4. Can you perform the same task (i.e. nonlinear regression) as done in FIGURE 20.4? If
possible, do it and compare your results with those.

Topic 06: Case Study 24.1, [Chapra et al., 2010].


1. Read the case study and explain as many details as possible.
2. Perform all its calculations using your Python programs. Compare your results with the
one of this section.
3. It is clear to see that Eq. (24.2) can be obtained using a second order polynomial
(parabola) regression. Solve Problem 20.59 [Chapra et al., 2010, p. 581] to obtain (em-
pirical) formulas of cp for the materials H2 , CO2 , O2 , N2 . For each of these materials,
compute the heat required to raise 1 kg of the material from 0˝ C to 100˝ C.
(Be careful with conversion of units!)

2
Computational Methods for Engineers Topis for Term Project

Topic 07: Case Study 24.2, [Chapra et al., 2010].

1. Read the case study and explain as many details as possible. You are encouraged to
explain how to obtain Eq. (24.5). What is f pzq?

2. Perform all its calculations using your Python programs. Compare your results with the
one of this section.

3. Can you apply Romberg’s method to calculate the integrals with given tolerance? Repeat
your calculations using this method with the tolerance ϵ “ 10´7 .

Topic 08: Case Study 28.1, [Chapra et al., 2010].

1. Read the case study and explain as many details as possible.

2. Perform all its calculations using your Python programs.

3. You are encouraged to apply other methods to perform the calculations of this case study.
If possible, do it. Assess and compare your results with the one in [Chapra et al., 2010].

Topic 09: Case Study 28.2, [Chapra et al., 2010].

1. Read the case study and explain as many details as possible.

2. Perform all its calculations using your Python programs.

3. You are encouraged to apply other methods to perform the calculations of this case study.
If possible, do it. Assess and compare your results with the one in [Chapra et al., 2010].

Topic 10: Case Study 28.3, [Chapra et al., 2010].

1. Read the case study and explain as many details as possible.

2. Perform all its calculations using your Python programs.

3. You are encouraged to apply other methods to perform the calculations of this case study.
If possible, do it. Assess and compare your results with the one in [Chapra et al., 2010].

Topic 11: Case Study 28.4, [Chapra et al., 2010].

1. Read the case study and explain as many details as possible.

2. Perform all its calculations using your Python programs.

3. You are encouraged to apply other methods to perform the calculations of this case study.
If possible, do it. Assess and compare your results with the one in [Chapra et al., 2010].

3
Computational Methods for Engineers Topis for Term Project

Topic 12: Develop an inhouse Python code to calculate multidimensional constrained opti-
mization problems using augmented Lagrange method with gradient-based search methods.
Hint:
1. For the problem with only equality contraints:
Minimize f pxq, x P RN ,
bj pxq “ 0, j “ 1, 2, . . . , J.
for N, J P N. We use the augmented Lagrange function
J
ÿ ÿ J
Apx, zk , ηk q “ f pxq ` zk,j bj pxq ` ηk b2j pxq (1)
j“1 j“1
looooomooooon
penalty

“ f pxq ` bpxq zk ` ηk bpxqT bpxq,


T

where ηk and zk,j are some parameters, k is index of iterative process.


We have a remark that is
Apx, zk , ηk q “ f pxq ` bpxqT zk ` ηk bpxqT bpxq
ˆ ˙
1 T 1 T 1 T 1 T 1
“ f pxq ` ηk z zk ` 2bpxq zk ` bpxq bpxq ´ z zk
2ηk k 2ηk 2ηk 2ηk k 2ηk
ˆ ˙
1 T 1 1 T T 1 T 1 T
“ f pxq ` ηk zk zk ` zk bpxq ` bpxq zk ` bpxq bpxq ´ z zk
2ηk 2ηk 2ηk 2ηk 4ηk k
„ ˆ ˙ ˆ ˙ȷ
1 T 1 T 1 1
“ f pxq ` ηk zk zk ` bpxq ` bpxq zk ` bpxq ´ }zk }2
2ηk 2ηk 2ηk 4ηk
ˆ ˙T ˆ ˙
1 1 1
“ f pxq ` ηk zk ` bpxq zk ` bpxq ´ }zk }2
2ηk 2ηk 4ηk
› ›2
› 1 › 1
“ f pxq ` ηk ›› zk ` bpxq›› ´ }zk }2 .
2ηk 4ηk
Thus, we can simplify
Apx, zk , ηk q “ f pxq ` ηk }zk {p2ηk q ` bpxq}2
and minimize this new function. Herein the gradient of A (with respect to x) can be
computed directly using gradients of bj .
2. For the problem with only inequality contraints:
Minimize f pxq, x P RN ,
ai pxq ď 0, i “ 1, 2, . . . , I.
for N, I P N. We use the augmented Lagrange function with
I
ÿ I
ÿ
Apx, zk , ηk q “ f pxq ` zk,irbk,i pxq ` ηk rb2 pxq,
k,i
" i“1 * i“1

rbk,i pxq “ max ai pxq, ´ zk,i


,
2ηk

4
Computational Methods for Engineers Topis for Term Project

where ηk and zk,i are some parameters, k is index of iterative process. Or, we have another
form (read the previous item):
› ›2
› 1 ›
Apx, zk , ηk q “ f pxq ` ηk ›› zk ` b r k pxq› ,
2ηk ›
" *
1 zk,i
zk,i ` rbk,i pxq “ max 0, ai pxq ` .
2ηk 2ηk
To compute the gradient of A (with respect to x) we have the following note:
3. For the function
ϕpxq “ pmaxt0, xuqp , p ą 1,
we can see that
ϕ1 pxq “ ppmaxt0, xuqp´1 .
Indeed, by writing
"
p xp , x ě 0,
ϕpxq “ pmaxt0, xuq “ ,
0, x ă 0.
we have
x ą 0, ϕ1 pxq “ pxp´1 ,
x ă 0, ϕ1 pxq “ 0,
x “ 0, ϕ1 p0` q “ 0 “ ϕ1 p0´ q.
Therefore
ϕpbpxqq “ pmaxt0, bpxquqp , p ą 1, ϕ1 pbpxqq “ ppmaxt0, bpxquqp´1 b1 pxq.

Use the above suggestions to develop your code and make as many test cases as possible. Assess
your results.

Topic 13: Example 6.3, [Boyd et al., 2004, Section 6.3, p. 307].

1. Read the example and explain as much as possible. What is the purpose of calculation?
What are input, output of the problem? What are the regularization parameters? Clarify.
2. For the reference signal ydes :
$

’ 0, 0 ď t ă 50
1, 50 ď t ă 100
&
ydes ptq “ , t “ 0, 1, 2, . . . , 200

’ ´1, 100 ď t ă 150
0, t ě 150
%

and the impulse response as in the example, using your Python programs, perform the
calculations as shown in Figure 6.6. Plot your results.
3. Can you propose a better values of the regularization parameters? Explain your calcula-
tions and assess your results.

5
Computational Methods for Engineers Topis for Term Project

Topic 14: You can propose your term project topic. But it should relate to

• Optimization

• Least-Squares Regression

• Interpolation

• Numerical Integration

• Numerical Differentiation

• Ordinary differential equations

In this case, make your proposal to be clear and worth considering, and send it (in PDF format)
to my email before 30/11/2023.

References
[Boyd et al., 2004] Boyd, S., Boyd, S. P., and Vandenberghe, L. (2004). Convex optimization.
Cambridge university press.

[Chapra et al., 2010] Chapra, S. C., Canale, R. P., et al. (2010). Numerical methods for engi-
neers. Boston: McGraw-Hill Higher Education,.

You might also like