Computational Physics - Department of Physics
6.6 Iterative Methods 189 si(x) = 6 (xi+f 1 i−xi)(xi+ 1 −x)^3 + 6 (xi+fi+ 11 −xi)(x−xi)^3 + (xi+yi 1 +−^1 xi−fi+^1 (xi 6 +^1 −xi ...
190 6 Linear Algebra If the matrixAˆis positive definite or diagonally dominant, one can show that this method will always conve ...
6.6 Iterative Methods 191 which allows us to utilize the preceding solution (forward substitution). This improves nor- mally the ...
192 6 Linear Algebra The choice of relaxation factor is not necessarily easy, anddepends upon the properties of the coefficient ...
6.6 Iterative Methods 193 The coefficients are given by Ax= n ∑ i= 1 αiApi=b. Multiplying withpˆTkfrom the left gives pˆTkAˆxˆ= ...
194 6 Linear Algebra (bˆ−Aˆˆxk)−αkAˆpˆk, which gives rˆk+ 1 =rˆk−Aˆpˆk, If we consider finding the minimum of a functionfusing N ...
6.7 A vector and matrix class 195 mat A = randu<mat>(10,10); mat B = randu<mat>(10,10); // Matrix-matrix multiplicat ...
196 6 Linear Algebra F.print("F:"); return0; } For more examples, please consult the online manual, seehttp://arma.sourceforgene ...
6.7 A vector and matrix class 197 Array<double> matrix(2, 2); // Fill the array: matrix(0,0) = 1; matrix(0,1) = 2; matrix( ...
198 6 Linear Algebra ifndefARRAY_H defineARRAY_H include include include include using namespacestd; template classArray{ privat ...
6.7 A vector and matrix class 199 dx2 = dx1*size[1]; dx3 = dx2*size[2]; dx4 = dx3*size[3]; dx5 = dx4*size[4]; }catch(std::bad_al ...
200 6 Linear Algebra /** *@brief Checks the validity of the indexing. *@param i, an integer for indexing the rows. *@param j, an ...
6.7 A vector and matrix class 201 **/ T*getPtr(); /** *@return A pointer to an array with information on the length of each dime ...
202 6 Linear Algebra /**************************************************************/ /* FRIEND FUNCTIONS */ /****************** ...
6.7 A vector and matrix class 203 template inline constT& Array::operator()(inti,intj)const { ifCHECKBOUNDS_ON indexOk(i,j); ...
204 6 Linear Algebra endif returndata[i + j*dx1]; } template inlineT& Array::operator()(inti,intj,intk){ ifCHECKBOUNDS_ON in ...
6.8 Exercises 205 // inline int Array::dim()const{return ndim;} /**/ / IMPLEMENTATION OF FRIEND FUNCTIONS / /**/ /**/ / (Arithme ...
206 6 Linear Algebra This can be written in matrix form as Ax=w. We specialize here to the following case −x 1 +x 2 − 4 x 3 = 0 ...
6.8 Exercises 207 We are going to solve the one-dimensional Poisson equation with Dirichlet boundary con- ditions by rewriting ...
208 6 Linear Algebra derive the following equation for potentialV d^2 V dx^2 = V√^3 /^2 x , withV( 0 ) = 1. In our case we will ...
«
6
7
8
9
10
11
12
13
14
15
»
Free download pdf