{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Tema11 - Matlab solution to Prob 11.11(ii a=[1 4 9 16;4 9...

This preview shows pages 1–7. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Matlab solution to Prob. 11.11 (ii): a=[1 4 9 16;4 9 16 25;9 16 25 36;16 25 36 49] a = 1 4 9 16 4 9 16 25 9 16 25 36 16 25 36 49 b=[30 54 86 126] b = 30 54 86 126 b=b' b = 30 54 86 126 x=a\b Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.092682e-018. x = 1.1053 0.6842 1.3158 0.8947 x=inv(a)*b Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.092682e-018. x = 0 0 0 0 cond(a) ans = 4.0221e+017

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
11.12 Program Linsimp Use IMSL Implicit None Integer::ipath,lda,n,ldfac Parameter(ipath=1,lda=3,ldfac=3,n=3) Integer::ipvt(n),i,j Real::A(lda,lda),Rcond,Res(n) Real::Rj(n),B(n),X(n) Data A/1.0,0.5,0.3333333,0.5,0.3333333,0.25,0.3333333,0.25,0.2/ Data B/1.833333,1.083333,0.783333/ Call linsol(n,A,B,X,Rcond) Print *, 'Condition number = ', 1.0E0/Rcond Print * Print *, 'Solution:' Do I = 1,n Print *, X(i) End Do End Program Subroutine linsol(n,A,B,X,Rcond) Implicit none Integer::n, ipvt(3) Real::A(n,n), fac(n,n), Rcond, res(n) Real::B(n), X(n) Call lfcrg(n,A,3,fac,3,ipvt,Rcond) Call lfirg(n,A,3,fac,3,ipvt,B,1,X,res) End 11.13 Option Explicit Sub TestChol() Dim i As Integer, j As Integer Dim n As Integer Dim a(10, 10) As Single n = 3 a(1, 1) = 6: a(1, 2) = 15: a(1, 3) = 55 a(2, 1) = 15: a(2, 2) = 55: a(2, 3) = 225 a(3, 1) = 55: a(3, 2) = 225: a(3, 3) = 979 Call Cholesky(a(), n) 'output results to worksheet Sheets("Sheet1").Select Range("a3").Select For i = 1 To n For j = 1 To n ActiveCell.Value = a(i, j) ActiveCell.Offset(0, 1).Select Next j ActiveCell.Offset(1, -n).Select Next i Range("a3").Select End Sub Sub Cholesky(a, n) Dim i As Integer, j As Integer, k As Integer Dim sum As Single
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern