fl(x)=x(1+ϵ) where ∣ϵ∣≤u ∣xfl(x)−x∣=∣ϵ∣≤u is called relative error. Cancellations occur when subtracting nearby number containing roundoff.
_Find cj such that ∑k=0m(v(x∗k)−yk)2=∑∗k=0m(∑∗j=0ncjϕj(xk)−yk)2 is minimised* Conditions: ∂a∂ϕ=0,∂b∂ϕ=0
Linear fit: yk [∑k=0mxk2∑k=0mxk∑k=0mxkm+1][ab] p →[sppm+1][ab] ↔Az =axk+b,k=1,⋯,m=[∑k=0mxkyk∑k=0myk]=k=0∑mxk,q=k=0∑myk,r=k=0∑mxkyk,s=k=0∑mxk2=[rq]=x0x1⋮xm11⋮1[ab]=y0y1⋮ym=f is overdetermined Solving linear system: r ∣∣r∣∣22 Let ϕ(x) Conditions:∂xk∂ϕ 0 →i=1∑maikj=1∑naijxj =b−Ax=i=1∑mri2=i=1∑m(bi−j=1∑naijxj)2=21∥r∥22=21i=1∑m(bi−j=1∑naijxj)2=0,k=1,⋯,n=i=1∑m(bi−j=1∑naijxj)(−aik)=i=1∑maikbi,k=1,⋯,n (equivalent to ATAx=ATb) ATAx If A has a full-column rank, x =ATb is called the normal equationsxmin∥b−Ax∥2 has uniq sol:=(ATA)−1ATb=A+b Adaptive Simpson: find I S1=S(a,b) E1=E(a,b) Q : ∣Q−I∣≤tol=∫abf(x)dx=S(a,b)+E(a,b)=6h[f(a)+4f(2a+b)+f(b)]=−901(2h)5f(4)(ξ),ξ between a and b S= quadSimpson(f,a,b,tol)h=b−a,c=2a+bS1=6h[f(a)+4f(2a+b)+f(b)]S2=12h[f(a)+4f(2a+c)+2f(c)+4f(2c+b)+f(b)]E~2=151(S2−S1)if∣E~2∣≤tol return Q=S2+E~2else Q1=quadSimpson(f,a,c,tol/2) Q2=quadSimpson(f,c,b,tol/2) return Q=Q1+Q2xn+1=xn−f′(xn)f(xn)
Convergence: if f,f′,f′′ are continuous in a neighborhood of a root r of f and f′(r)=0, then ∃δ >0 : ∣r−x0∣≤δ, then ∀xn : :∣r−xn∣≤δ,∣r−xn+1∣≤c(δ)∣r−xn∣2 ∣en+1∣≤c(δ)∣en∣2 (Quadratic convergence, order is 2)
Let c(δ)=21∗min∣r−x∣≤δ∣f′(x)∣max∣r−x∣≤δ∣f′′(x)∣
For linear system: denote x=(x1,x2,⋯,xn)T and F=(f1,f2,⋯,fn), find x∗ such that F(x∗)=0
F(x(k))+F′(x(k))(x(k+1)−x(k)) F′(x(k)) Let s ∴ F′(x(k))s x(k+1) =0is the Jacobian of F at x(k)=x(k+1)−x(k)=−F(x(k))=x(k)+sBackward Euler’s method (implicit): yi+1=yi+hf(ti+1,yi+1)
FE Stability: y′ Exact sol: y(t) FE sol with constant stepsize h: yi+1 To be numerically stable: h BE Stability: y′ ∣yi+1∣ =λy,y(0)=y0=y0eλt=(1+hλ)yi=(1+hλ)i+1y0≤∣λ∣2=λy,y(0)=y0=∣1−hλ∣1∣yi∣≤∣yi∣ ∀ h>0Non-linear, then apply Newton’s methods
A method of order q ifq is the lowest positive int such that any smooth exact sol of y(t):maxi∣di∣=O(hq)
Global error: ei Consider u′ =y(ti)−yi,i=0,1,⋯,N=f(t,u),u(ti−1)=yi−1, local error: li=u(ti) Convergence: imaxei=imax∣y(ti)−yi∣→0 as h→0Stiffness is when the stepsize is restricted by stability rather than accuracy
Classical RK4: based on Simpson’s quadrature rule, O(h4) accuracy
Y1 Y2 Y3 Y4 yi+1 =yi=yi+2hf(ti,Y1)=yi+2hf(ti+2h,Y2)=yi+hf(ti+2h,Y3)=yi+6h[f(ti,Y1)+2f(ti+2h,Y2)+2f(ti+2h,Y3)+f(ti+1,Y4)]