Курсовая работа: Программа вычисления минимума заданной функции
LOCATE 5, 18
INPUT "Vvedite k,a,b,x1,x2,E"; k, a, b, x1, x2, E
DIM x(0 TO k) AS SINGLE
DIM y(0 TO k) AS SINGLE
DATA 0,0.1, 0.2,0.3,0.4,0.5,0.6 FOR i = 0 TO k READ x(i) NEXT i
DATA 1.858652,1.851659,1.851401,1.848081,1.841914,1.833125,1.821948 FOR i = 0 TO k READ y(i) NEXT i
LX1 = LX(k, x(), y(), x1)
LX2 = LX(k, x(), y(), x2)
PRINT TAB(10); "Znacheniya polinoma Lagranzha v x1,x2"
PRINT TAB(15); "L(x1)="; LX1; "L(x2)="; LX2
PRINT TAB(10); "Poisk minimuma F(x)"
xmin = dihotom(a, b, E, LX1, LX2)
PRINT TAB(10); "Minimum F(x): xmin="; xmin; "F(xmin)="; F(xmin, LX1, LX2)
END
FUNCTION dihotom (a, b, E, LX1, LX2)
PRINT TAB(10); "Promezhutochnie rezul`tati"
PRINT " a b x1 x2 f(x1) f(x2) b-a" DO x1 = (a + b - E / 1.3) / 2 x2 = (a + b + E / 1.3) / 2 PRINT USING " ##.###### #.##### #.##### #.##### #.##### #.##### #.#####"; a; b; x1; x2; F(x1, LX1, LX2); F(x2, LX1, LX2); b - a IF F(x1, LX1, LX2) > F(x2, LX1, LX2) THEN a = x1 ELSE b = x2 LOOP UNTIL b - a <= E
dihotom = (a + b) / 2
END FUNCTION
FUNCTION F (x, LX1, LX2)
F = LX1 * x ^ 2 - 2.5 * LX2 * x - 3
END FUNCTION
FUNCTION LX (k, x(), y(), xl)
l = 0 FOR i = 0 TO k L1 = y(i) FOR j = 0 TO k IF i <> j THEN L1 = L1 * (xl - x(j)) / (x(i) - x(j)) NEXT j l = l + L1 NEXT i
LX = l
ENDFUNCTION
8. Полученные результаты