首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
讲解data留学生编程、辅导Python,Java,c++程序语言 辅导Web开发|讲解留学生Processing
项目预算:
开发周期:
发布时间:
要求地区:
A5 - Jupyter Notebook 2020/11/20, 12:07 PM
Before you turn this problem in, make sure everything runs as expected. First,
restart the kernel (in the menubar, select Kernel Restart) and then run all cells (in
the menubar, select Cell Run All). Or, alternatively, Restart & Run All.
Make sure you fill in any place that says YOUR CODE HERE or "YOUR ANSWER
HERE".
You can always add additional cells to the notebook to experiment, to test your
answers, or to provide additional support for your answers.
You should not need to install new packages to complete an assignment. If you use
any packages not available via the MATH405 Project.toml then your
assignment will likely not be graded correctly.
Submissions are only accepted via CANVAS!
Late submissions: within 24h I will reduce the grade to 70%. I will not accept
submissions after 24h. Please manage your time well and complete the assignments
with plenty of buffer time.
By entering your name below you confirm that you have completed this assignment
on your own and without (direct) help from your colleagues. Plagiarism / copying will
be checked by comparing assignments and by by testing understanding in
workshops and the oral exam (final). I reserve the option to downgrade an
assignment at any point.
→
→
In [ ]:
MATH 405/607
Numerical Methods for Differential
Equations
Assignment 5: Spectral Methods
Notes
Due date: Wed Dec 2, 2020, 1200 noon
This assignment will be worth 10% of the overall grade.
Answer only question 3 or question 4 but not both.
1 NAME = ""
A5 - Jupyter Notebook 2020/11/20, 12:07 PM
http://localhost:8888/notebooks/Desktop/math405_2020W/A5/A5.ipynb#q3 Page 2 of 7
Question 1 : Approximation vs Regularity
Question 2 : Trapezoidal Rule
Question 3 : Fourth order bvp
Question 4 : Advection Problem
Question 5 : Eigenvalue Problem
In [ ]: include("math405.jl")
# Here are the codes you need to construct and evaluate trigonometric interpolants
using FFTW
"construct a real-space grid - use FFT convention"
xgrid(N) = range(0.0, stop=2π-2π/2N, length=2N)
"construct the reciprocal space grid assumed by `fft` - carefully use FFT convention"
kgrid(N) = [0:N; -N+1:-1]
"compute the fourier coefficients of I_N"
fouriercoeffs(f::Function, N) = fouriercoeffs(f.(xgrid(N)))
fouriercoeffs(F::Vector) = fft(F) / length(F)
"evaluate a trigonometric polynomial"
eval_trig(F::Function, N, Z) = eval_trig(fouriercoeffs(F, N), Z)
eval_trig(F̂::Vector, Z) = real(sum( f̂k * exp.((im * k)*Z) for (f̂k
# To evaluate the trigonometric interpolant of a function F
# at several points Zs::AbstractVector use the following function
eval_trig(F::Function, N::Integer, Zs::AbstractVector) = eval_trig
1
A5 - Jupyter Notebook 2020/11/20, 12:07 PM
http://localhost:8888/notebooks/Desktop/math405_2020W/A5/A5.ipynb#q3 Page 3 of 7
Question 1: Approximation vs Regularity [15]
Let be continuous and -periodic and let denote its degree
trigonometric interpolant.
In class we have proven (mostly) that if is analytic and bounded, , in the strip
then
Similarly, the Jackson Theorem(s) state that, if is -periodic, times continuously
differentiable and the th derivative is -Hölder continuous, , i.e.
then
The prototype of an -Hölder continuous function is . A piecewise smooth function
with finitely many singularities is also -H"{o}lder continuous in the sense defined
above.
The factor is a technicality, very difficult to see numerically (if it is indeed sharp),
and should simply be ignored for this Question.
Following the Model solution, produce figures demonstrating the algebraic or exponential
convergence rates stated in the above estimates. As in the model solution in addition to
plotting the convergence, also print your predicted rate of convergence.
A5 - Jupyter Notebook 2020/11/20, 12:07 PM
http://localhost:8888/notebooks/Desktop/math405_2020W/A5/A5.ipynb#q3 Page 4 of 7
Question 2: Periodic Trapezoidal Rule [3 + 5 + 3 + 4]
Let be continuous and -periodic, then we can represent it in terms of its
Fourier series,
We are interested in approximating the integral
by the trapezoidal rule
In the following tasks you may interchange limits freely without rigorous justification, in
particular summation and integration.
(a) Prove that .
(b) Prove that
and use this to deduce that
REMARK: means that for some integer .
(c) Deduce from (a, b) that
(d) Suppose that (i) ; or (ii) . In each case deduce from (c)
a sharp (up to constants) estimate on the error .
HINT: If is non-negative and monotonically decreasing then
otherwise.
YOUR ANSWER HERE
Solve either Q.3 (theoretical) or Q.4 (computational).
A5 - Jupyter Notebook 2020/11/20, 12:07 PM
http://localhost:8888/notebooks/Desktop/math405_2020W/A5/A5.ipynb#q3 Page 5 of 7
Question 3: Fourth-order BVP [5 + 5 + 5]
Consider the periodic boundary value problem for the differential equation
(a) Prove that, if solves the above DE, then
where .
*[HINT: multiply the DE by , then integrate over , integrate by parts, then use the
Cauchy-Schwarz inequality on the right-hand side.]*
(b) Derive the canonical Fourier spectral method for this problem, providing both the realspace
formulation as well as the fully discrete formulation in reciprocal space. Briefly
specify all your terms.
(c) Suppose that is analytic and bounded in the strip , prove that
where denotes the solution to the Fourier-spectral method from (a) and the exact
solution of the DE.
YOUR ANSWER HERE
BONUS [NO CREDIT]
Q3(d) Employing the method of manufactured solutions, confirm your prediction Question
3a-c.
In [ ]:
Question 4: transport equation [5+5+5]
Consider the advector equation with periodic boundary conditions and non-constant
advection speed, which is analytic and -periodic:
(a) Discretise in space using a Fourier spectral method and write down the resulting ODE
for the Fourier coefficients, in terms of the following operators:
: discrete Fourier transform
: inverse discrete Fourier transform
: trigonometric interpolant
1 # YOUR CODE HERE
A5 - Jupyter Notebook 2020/11/20, 12:07 PM
http://localhost:8888/notebooks/Desktop/math405_2020W/A5/A5.ipynb#q3 Page 6 of 7
YOUR ANSWER HERE
(b) Implement a practical scheme (you will need to discretise in time by implementing a
suitable time-stepping yourself or using a suitable solver from OrdinaryDiffEq.jl )
and compute the solution at time to within five digits absolute real-space
accuracy in the max-norm. Store it as
Uhat1 = ...
where Uhat1::Vector should be a vector containing the Fourier coefficients of the
solution at time .
HINT: If you are unsure about the correctness of your implementation, you could try
first. In this case you can compare against an exact solution.
푡 = 1.0
푡 = 1.0
푐 = const
In [ ]:
In [ ]:
In [ ]:
(c) Demonstrate the convergence rate of your scheme by comparing a sequence of
numerical solutions against another numerical solution computed to very high accuracy.
cfun = x -> 3 * (1 + sin(x)^2)
u0fun = x -> 1 + sin(x)
# YOUR CODE HERE
;
# To check correctness of your code you can check the convergence rate in
# part (c) but an addtional consistency check is the following:
# You can modify this code block to create an animatino of your solution
# You can check whether the solution is sensible?
# Note that larger values of c lead to faster advection, while smaller values
# lead to slower advection.
# xp = range(0, 2*pi, length=200)
# c_xp = cfun.(xp) / 3
# @gif for t = 0.0:0.01:1.0
# Û = ... # get the solution at time t
# u = eval_trig.(Ref(Û), xp)
# plot(xp, c_xp, lw=2, c=2, label = "c/3")
# plot!(xp, u, lw=2, c=1, label = "t = $t", size = (400, 250), ylims = (0.0, 4.0))
A5 - Jupyter Notebook 2020/11/20, 12:07 PM
http://localhost:8888/notebooks/Desktop/math405_2020W/A5/A5.ipynb#q3 Page 7 of 7
In [ ]:
Question 5: Eigenvalue problem [10]
Find all eigenpairs , , smooth and -periodic, satisfying
and such that . Plot them in a scatter plot and store them (unordered) in a
variable
Lambda = ...
where Lambda::AbstractVector containing precisely the required set of
eigenvalues.
HINT: The code required to complete this problem is only about 5 lines.
If you wish you may add any additional comments or notes in this box:
In [ ]:
In [ ]:
# YOUR CODE HERE
# YOUR CODE HERE
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!