tridiagonal matrix, Lu decomposition, Do Doolittle Decomposition
- 최초 등록일
- 2009.11.20
- 최종 저작일
- 2009.04
- 11페이지/ MS 워드
- 가격 1,000원
소개글
tridiagonal matrix, Lu decomposition, Do Doolittle Decomposition
목차
1. Do P3.35(tridiagonal matrix) – Solve the system.
2. Do P3.36 (LU decomposition) – also find the inverse of [A] and confirm
3. Do Doolittle’s Decomposition on the following matrix.
본문내용
1. Do P3.35(tridiagonal matrix) – Solve the system.
#tridiagonal_matrix.rb - coding by RUBY
require CSV
Matrix_a_size = 10 # 입력 매트릭스 크기
matrix_a = Array.new(Matrix_a_size) #입력 되는 매트릭스 : matrix_a
pFile = CSV.open(`Book1.csv`,`r`) #pFile 파일 포인트, Book1.csv 입력용 csv
Matrix_a_size.times do |count|
matrix_a[count] = pFile.shift
end
matrix_r = pFile.shift
matrix_r.size.times do |count| matrix_r[count] = matrix_r[count].to_f end
pFile.close
a = Array.new(Matrix_a_size - 1) # a 열
d = Array.new(Matrix_a_size) # d 열
b = Array.new(Matrix_a_size - 1) # b 열
##########matirx_a 에서 a b d 추출#####
Matrix_a_size.times do |count|
d[count] = matrix_a[count][count].to_f
end
(Matrix_a_size-1).times do |count|
a[count] = matrix_a[count][count+1].to_f
b[count] = matrix_a[count+1][count].to_f
end
참고 자료
없음