Professional Documents
Culture Documents
Ha-Ninh NGUYEN
2021/07/09
Objective
2
Weekly report by Ha-Ninh NGUYEN
Table of content
I. Numerical Methods in Engineering with Python 3
3
Weekly report by Ha-Ninh NGUYEN
4
Weekly report by Ha-Ninh NGUYEN
The second solution vector is computed next, also using back substitution:
Therefore,
5
Weekly report by Ha-Ninh NGUYEN
where v is a vector. Use the function gaussElimin to compute the solution of Ax = b, where A is
the 6 × 6 Vandermode matrix generated from the vector
And
Also evaluate the accuracy of the solution (Vandermode matrices tend to be ill conditioned).
6
Weekly report by Ha-Ninh NGUYEN
x=
[ 416.66666667 -3125.00000004 9250.00000012 -13500.00000017 9709.33333345 -
2751.00000003]
det = -1.13246207999e-006
Check result: [a]{x} – b =
[0.00000000e+00 3.63797881e-12 0.00000000e+00 1.45519152e-11 0.00000000e+00
5.82076609e-11]
As the determinant is quite small relative to the elements of A, we expect a detectable roundoff
error. Inspection of x leads us to suspect that the exact solution is
x = [1250/3 −3125 9250 −13500 29128/3 −2751]T
in which case the numerical solution would be accurate to about 10 decimal places. Another
way to gauge the accuracy of the solution is to compute Ax – b (the result should be 0). The
printout indicates that the solution is indeed accurate to at least 10 decimal places.
b) L U decomposition
L U decomposition of a matrix is the factorization of a given square matrix into two triangular
matrices, one upper triangular matrix and one lower triangular matrix, such that the product of
these two matrices gives the original matrix.
7
Weekly report by Ha-Ninh NGUYEN
8
Weekly report by Ha-Ninh NGUYEN
9
Weekly report by Ha-Ninh NGUYEN
where
Assume that we have observed u(0.5)=1, we want to estimate b. In this case, the true value
should be b=1.
Solution
In this example, I would like to demonstrate a programing code which is applied the command
of “using LinearAlgebra” in order to solve the problem.
Using LinearAlgebra
using ADCME
loss = (ue-1.0)^2
# Optimization
sess = Session(); init(sess)
BFGS!(sess, loss)
Expected output
10
Weekly report by Ha-Ninh NGUYEN
III. Conclusion
In the Numerical Methods in Engineering with Python 3 book, the author introduces a lot of
way to solve the problem by using Python3 to code. The problem also is various which I can list
such as “Linear Algebraic Equations” which is very common, “Interpolation” to solve
mathematical geometry which also included many other methods. The goal of learning this
numerical method is trying to understand Python code. From then, I could deploy the same
code so as to solve other complex problems in future.
In term of ACDME progress, I reached to Parameter Inverse Problem part and been studying
some basic problem by using “LinearAlgebra” command. The main ideal is finding the
parameter by talking the value of the output. In the next week, I would achieve some more
various example.
11