Литература
Савельев И.В. Курс общей физики. - М.: Наука, Т 1,2.
Сивухин Д.В. Курс общей физики. - М.: Наука, Т 1,2.
Ануфриев И.Е., Смирнов А.Б., Смирнова Е.Н. MatLab 7 СПб.: БХВ-Петербург, 2005. 1104 с.
ПРИЛОЖЕНИЕ
A1. Решение системы линейных алгебраических уравнений. Метод Гаусса (BASIC)
CLS
DIM a(10, 10), b(10)
INPUT "n="; n
FOR i = 1 TO n
FOR j = 1 TO n
PRINT "a("; i; ","; j; ")=";
INPUT a(i, j)
NEXT j
PRINT "b("; i; ")=";
INPUT b(i)
NEXT i
PRINT "matrix"
FOR i = 1 TO n
FOR j = 1 TO n
PRINT a(i, j); " ";
NEXT j
PRINT b(i)
NEXT i
FOR i = 1 TO n - 1
FOR j = i + 1 TO n
a(j, i) = -a(j, i) / a(i, i)
FOR k = i + 1 TO n
a(j, k) = a(j, k) + a(j, i) * a(i, k)
NEXT k
b(j) = b(j) + a(j, i) * b(i)
NEXT j
NEXT i
x(n) = b(n) / a(n, n)
FOR i = n - 1 TO 1 STEP -1
h = b(i)
FOR j = i + 1 TO n
h = h - x(j) * a(i, j)
NEXT j
x(i) = h / a(i, i)
NEXT i
FOR i = 1 TO n
PRINT "x("; i; ")="; x(i)
NEXT i
END
Достарыңызбен бөлісу: |