资源描述:
《Lec05_Gaussian_student.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、18-660:NumericalMethodsforEngineeringDesignandOptimizationXinLiDepartmentofECECarnegieMellonUniversityPittsburgh,PA15213Slide1Overview¢Lecture4:ThermalAnalysis{2-D/3-Dheatequation{FinitedifferenceFinitedifference¢Lecture5:LinearEquationSolver{Gaussia
2、nelimination{Conditionnumber{Full/partialpivotingFull/partialpivotingSlide2LinearEquation¢Ordinarydifferentialequationx&(t)=A⋅x(t)+B⋅u(t)()x0=0BackwardEuler()()(−1[])()()xt=I−Δt⋅A⋅xt+Δt⋅B⋅utxt=0n+1nn+10¢Partialdifferentialequation∂T(x,y,z,t)2ρ⋅C⋅=κ⋅∇
3、T(x,y,z,t)+f(x,y,z,t)p∂tFiniteDifference∂Tκ⋅[T−T]κ⋅[T−T]i,j,ki+1,j,ki,j,ki,j,ki−1,j,kρ⋅C⋅=f+−+pi,j,k22∂t()Δx()Δxκ⋅[T−T]κ⋅[T−T]κ⋅[T−T]κ⋅[T−T]i,j+1,ki,j,ki,j,ki,j−1,ki,j,k+1i,j,ki,j,ki,j,k−1−+−()2()2()2()2ΔyΔyΔzΔzSlide3LinearEquationSolverA⋅X=B¢IthInth
4、eory,XilisequalttoAA−1B¢InpracticeexplicitlyiInpractice,explicitlyinvertingamatrixisneveragoodidea¢Amoreefficientalggporithmshouldbeappplied{E.g.,useX=ABinMATLABSlide4GaussianElimination¢Step1:convertAtoanuppertriangularmatrix⎡⎤⎡⎤⎡⎤⎡⎤⎡⎤⎡⎤⎢A⎥⋅⎢X⎥=⎢B⎥
5、⎢U⎥⋅⎢X⎥=⎢Y⎥⎣⎦⎣⎦⎣⎦⎣⎦⎣⎦⎣⎦¢Step2:solveforXviabackwardsubstitution⎡⎤⎡⎤⎡⎤⎡⎤⎢U⎥⋅⎢X⎥=⎢Y⎥⎢X⎥⎣⎦⎣⎦⎣⎦⎣⎦Slide5GaussianElimination¢Asimpleexample⎡21−1⎤⎡x1⎤⎡8⎤⎢⎥⎢⎥⎢⎥−3−12⋅x=−11⎢⎥⎢2⎥⎢⎥⎢−212⎥⎢x⎥⎢−3⎥⎣⎦⎣3⎦⎣⎦AXBSlide6GaussianElimination¢Step1:convertAtoanuppertriangula
6、rmatrix⎡21−1⎤⎡x1⎤⎡8⎤⎢⎥⎢⎥⎢⎥−3−12⋅x=−11⎢⎥⎢2⎥⎢⎥⎢−212⎥⎢x⎥⎢−3⎥⎣⎦⎣3⎦⎣⎦Slide7GaussianElimination¢Step1:convertAtoanuppertriangularmatrix⎡21−1⎤⎡x1⎤⎡8⎤⎢⎥⎢⎥⎢⎥00.50.5⋅x=1⎢⎥⎢2⎥⎢⎥⎢021⎥⎢x⎥⎢5⎥⎣⎦⎣3⎦⎣⎦Slide8GaussianElimination¢Step2:solveforXviabackwardsubstitution⎡2
7、1−1⎤⎡x1⎤⎡8⎤⎢⎥⎢⎥⎢⎥00.50.5⋅x=1⎢⎥⎢2⎥⎢⎥⎢00−1⎥⎢x⎥⎢1⎥⎣⎦⎣3⎦⎣⎦Slide9GaussianElimination−1¢GaussianeliminationismuchcheaperthancalculatingA⎡⎤⎡⎤⎡⎤Gaussianelimination:solveforX⎢A⎥⋅⎢X⎥=⎢B⎥whereBisanNx1vector⎣⎦⎣⎦⎣⎦⎡A⎤⎡−1⎤⎡⎤Matrixinverse:solveforA−1where⎢⎥⋅⎢A⎥=⎢I⎥
8、IisanNxNidentitymatrix⎣⎦⎣⎦⎣⎦ThedifferencebetweenGaussianeliminationandmatrixinversebecomesmoresignificantforlargematrixSlide10NumericalNoise¢Intheory,GaussianeliminationworkswellifAisnonsingular,i.e.,A⋅X=Bwheredtdet(A)≠0{Aissingularifandonlyifdet(A)=