Использование численных методов при решении инженерных задач

Автор работы: Пользователь скрыл имя, 04 Декабря 2013 в 18:59, курсовая работа

Описание работы

Задача заключается в аналитическом представлении функциональной зависимости, т.е. в подборе формулы, описывающей результаты эксперимента.
Особенности метода
Наличие случайных ошибок измерения или, как говорят, наличие «шума» в эксперименте делает неразумным подбор такой формулы, которая точно описывала бы все опытные значения. Другими словами, график не должен проходить через все точки, а должен сглаживать «шум».

Содержание работы

1)Геометрические преобразования 3

2)аппроксимация неизвестных функций 5

3)Решение линейных уравнений. Уточнение приближенных корней методом дихотомии 13

4)вычисление определенного интеграла 17

5)Интегрирование. Интерполяционная формула Лагранжа. 23

6) Решение систем линейных алгебраических
уравнений методом Гаусса 27

7)Оптимизация 30

8) основная программа 36

Файлы: 1 файл

Жолобова.doc

— 363.50 Кб (Скачать файл)

LOCATE 3, 19

PRINT "VISHEGO PROFESIONALNOGO OBRAZOVANIA"

LOCATE 4, 15

PRINT "PERMSKII GOSUDARSTVENNII TEHNICHESKII UNIVERSITET"

LOCATE 5, 33

PRINT "KAFEDRA MSI"

LOCATE 10, 17

PRINT "KURSOVAYA RABOTA PO DISZIPLINE INFORMATIKA"

LOCATE 11, 16

PRINT "TEMA:ISPOLZOVANIE CHISLENNIH METODOV PRI RESHENII"

LOCATE 12, 30

PRINT "INGENERNIH ZADACH"

LOCATE 13, 33

PRINT "VARIANT 5"

LOCATE 23, 43

PRINT "RABOTU VIPOLNIL STOODENT GROOPI"

LOCATE 24, 57

PRINT "KPM-10 ZHOLOBOVA D.O"

LOCATE 25, 41

PRINT "PROVERILA ZAVELION ANNA MIHAILOVNA"

LOCATE 30, 35

PRINT "PERM 2011"

SLEEP 15

GOSUB soderzanie

 

 

soderzanie:

CLS

SCREEN 12

LOCATE 2, 30

PRINT "SODERZANIE"

LOCATE 4, 10

PRINT "1) GEOMETRICHESKIE PREOBRAZOVANIA"

LOCATE 6, 10

PRINT "2.1)APRAKSIMIZIA-LINEINAYA REGRESIA"

LOCATE 8, 10

PRINT "2.2)APRAKSIMAZIA-STEPENAYA REGRESIYA"

LOCATE 10, 10

PRINT "2.3)APRAKSIMAZIA-PARABOLICHESKAYA REGRESSIA"

LOCATE 12, 10

PRINT "3)OPREDELENIE KORNEY UROVNENIYA"

LOCATE 14, 10

PRINT "4)INTEGRIROVANIE"

LOCATE 16, 10

PRINT "5)INTERPOLYAZIA"

LOCATE 18, 10

PRINT "6)SISTEMA UROVNENII"

LOCATE 20, 10

PRINT "7)OPTIMIZAZIA"

LOCATE 30, 1

PRINT "PRESS ENTER twise to exit"

 

 

INPUT "vvedite nomer laboratornoi raboti"; LGO

SELECT CASE LGO

CASE 1

GOSUB LAB1

CASE 21

GOSUB LAB2.1

CASE 22

GOSUB LAB2.2

CASE 23

GOSUB LAB2.3

CASE 3

GOSUB LAB3

CASE 4

GOSUB LAB4

CASE 5

GOSUB LAB5

CASE 6

GOSUB LAB6

CASE 7

GOSUB LAB7

 

END SELECT

END

 

 

10 DATA -7, 5,-3, 4,-2, 8,-2, 4, 329, 1,218

20 DATA 2, 4, 6, 8, 10, 12, 14, 16, 18, 20

30 DATA -3.53,-4.17,-5.74,-5.37,-7.17,-10.56,-7.05,-8.20,-13.57,-16.52   6

40 DATA 2, 4, 6, 8, 10, 12, 14, 16, 18, 20

50 DATA  1.67,1.49,1.35,1.43,1.33,1.34,1.30,1.36,1.22,1.26

60 DATA 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

70 DATA 2.5,1.6,0.3,0.0,0.2,0.7,1.9,5.3,7.8,8.4

80 DATA -3,-1, 2, 3

90 DATA -4, 4, 5,-9

99 DATA -6, 1, 9, 3, 6, 7,-8, 2,-2,-3, 8,-8,-9,-8,-3,-7

98 DATA 365,-402,508,221

 

 

 

LAB1:

CLS

RESTORE 10

READ x1, y1, x2, y2, dx, dy, Mx, My, alfa, t, alfa1

alfa = alfa * 3.14159 / 180

alfa1 = alfa1 * 3.14159 / 180

SCREEN 12

VIEW (80, 0)-(559, 479)

WINDOW (-10, -10)-(10, 10)

LINE (0, 10)-(0, -10)

LINE (-10, 0)-(10, 0)

FOR i = -10 TO 10

LINE (-.1, i)-(.1, i)

LINE (i, -.1)-(i, .1)

NEXT i

LOCATE 1, 39

PRINT "y"

LOCATE 17, 79

PRINT "x"

COLOR 4

PRINT "nachalnie koordinati"

GOSUB 100

COLOR 5

PRINT "koordinati posle priroshenia"

PRINT "na dx="; dx; "dy="; dy

GOSUB 200

GOSUB 100

COLOR 6

PRINT "koordinati posle umnogenia"

PRINT "na Mx"; Mx; "My="; My

GOSUB 300

GOSUB 100

COLOR 11

PRINT "koordinati posle povrota"

PRINT "na ugol alfa="; alfa * 180 / 3.14159

GOSUB 400

GOSUB 100

COLOR 15

PRINT "povorot"

IF t = 1 THEN dx = -x1: dy = -y1 ELSE dx = -x2: dy = -y2

GOSUB 200

alfa = alfa1

GOSUB 400

dx = -dx: dy = -dy

GOSUB 200

GOSUB 100

 

SLEEP 10

SCREEN 1

GOSUB soderzanie

END

 

100 ' vivod koordinat

PRINT "t1("; x1; ","; y1; "),t2("; x2; ","; y2; ")"

LINE (x1, y1)-(x2, y2)

CIRCLE (x1, y1), 1

CIRCLE (x2, y2), 1

RETURN

 

200 ' perenos

x1 = x1 + dx

y1 = y1 + dy

x2 = x2 + dx

y2 = y2 + dy

RETURN

 

300 ' vivod koordinat

x1 = x1 * Mx

y1 = y1 * My

x2 = y2 * Mx

y2 = y2 * My

RETURN

 

400 ' REM

x1n = x1 * COS(alfa) - y1 * SIN(alfa)

y1n = x1 * SIN(alfa) + y1 * COS(alfa)

x2n = x2 * COS(alfa) - y2 * SIN(alfa)

y2n = x2 * SIN(alfa) + y2 * COS(alfa)

x1 = x1n

x2 = x2n

y1 = y1n

y2 = y2n

RETURN

 

 

 

 

LAB2.1:

CLS

DIM x(10), y(10)

RESTORE 20

FOR i = 1 TO 10

READ x(i)

NEXT i

RESTORE 30

FOR i = 1 TO 10

READ y(i)

NEXT i

FOR i = 1 TO 10

a = a + x(i)

b = b + y(i)

c = c + x(i) * y(i)

D = D + (x(i)) ^ 2

NEXT i

DD = D * 10 - a * a

DA = c * 10 - a * b

DB = D * b - c * a

a1 = DA / DD

b1 = DB / DD

SCREEN 12

VIEW (80, 0)-(559, 479)

WINDOW (-50, -50)-(50, 50)

LINE (0, 80)-(0, -80)

LINE (-80, 0)-(80, 0)

FOR i = -79 TO 79

LINE (-.1, i)-(.1, i)

LINE (i, -.1)-(i, .1)

NEXT i

LOCATE 1, 39

PRINT "y"

LOCATE 17, 79

PRINT "x"

FOR i = 1 TO 10

PSET (x(i), y(i))

CIRCLE (x(i), y(i)), .6, 4

NEXT i

FOR k = -50 TO 50 STEP .01

f = a1 * k + b1

PSET (k, f), 9

NEXT k

PRINT "a="; a1, "b="; b1

PRINT "y="; a1; "*x+("; b1; ")"

SLEEP 10

SCREEN 1

GOSUB soderzanie

END

 

LAB2.2:

CLS

DIM x1(10), y1(10)

RESTORE 40

FOR i = 1 TO 10

READ x1(i)

NEXT i

RESTORE 50

FOR i = 1 TO 10

READ y1(i)

NEXT i

FOR i = 1 TO 10

e = e + LOG(x1(i))

m = m + LOG(y1(i))

g = g + LOG(x1(i)) * LOG(y1(i))

h = h + LOG(x1(i)) * LOG(x1(i))

NEXT i

HH = h * 10 - e * e

HE = g * 10 - e * m

HM = h * m - g * e

a2 = HE / HH

b2 = HM / HH

q = EXP(b2)

SCREEN 12

VIEW (80, 0)-(559, 479)

WINDOW (-10, -10)-(50, 50)

LINE (0, 80)-(0, -80)

LINE (-80, 0)-(80, 0)

FOR i = -79 TO 79

LINE (-.1, i)-(.1, i)

LINE (i, -.1)-(i, .1)

NEXT i

LOCATE 1, 39

PRINT "y1"

LOCATE 17, 79

PRINT "x1"

FOR i = 1 TO 10

PSET (x1(i), y1(i))

CIRCLE (x1(i), y1(i)), .6, 4

NEXT i

FOR k = .001 TO 50 STEP .01

f = q * k ^ a2

PSET (k, f), 9

NEXT k

PRINT "a="; a2, "b="; q

PRINT "y="; a2; "*x^("; q; ")"

SLEEP 10

SCREEN 1

GOSUB soderzanie

END

 

 

 

LAB2.3:

CLS

n = 10

DIM x2(10), y2(10)

RESTORE 60

FOR i = 1 TO 10

READ x2(i)

NEXT i

RESTORE 70

FOR i = 1 TO 10

READ y2(i)

NEXT i

FOR i = 1 TO 10

t = t + x2(i)

u = u + y2(i)

v = v + x2(i) ^ 2

w = w + (x2(i)) ^ 3

x = x + (x2(i)) ^ 4

p = p + (x2(i) * y2(i))

z = z + (x2(i) ^ 2 * y2(i))

NEXT i

WW = x * v * n + w * t * v + w * t * v - v ^ 3 - w * w * n - t * t * x

WT = z * v * n + w * t * u + p * t * v - v * v * u - t * t * z - w * p * n

WU = x * p * n + z * t * v + w * u * v - v * v * p - z * w * n - t * u * x

WV = x * v * u + w * p * v + w * t * z - z * v * v - w * w * u - t * p * x

a3 = WT / WW

b3 = WU / WW

c3 = WV / WW

SCREEN 12

VIEW (80, 0)-(559, 479)

WINDOW (-10, -10)-(50, 50)

LINE (0, 80)-(0, -80)

LINE (-80, 0)-(80, 0)

FOR i = -79 TO 79

LINE (-.1, i)-(.1, i)

LINE (i, -.1)-(i, .1)

NEXT i

LOCATE 1, 29

PRINT "y"

LOCATE 26, 69

PRINT "x"

FOR i = 1 TO 10

PSET (x2(i), y2(i))

CIRCLE (x2(i), y2(i)), .6, 4

NEXT i

FOR k = -50 TO 50 STEP .01

f = a3 * k ^ 2 + b3 * k + c3

PSET (k, f), 9

NEXT k

LOCATE 20, 1

PRINT "a="; a3, "b="; b3, "c="; c3

PRINT "y="; a3; "* x ^ 2 + ("; b1; ") * x + ("; c1; ")"

SLEEP 10

SCREEN 1

GOSUB soderzanie

END

 

 

LAB3:

CLS

DEF FNF (x) = x ^ 4 + 25 * x ^ 3 + 4 * x ^ 2 + 6 * x + 44

SCREEN 12

VIEW (80, 0)-(559, 479)

WINDOW (-100, -1000000)-(100, 1000000)

LINE (0, -1000000)-(0, 1000000)

LINE (-100, 0)-(100, 0)

LOCATE 1, 39

PRINT "y"

LOCATE 17, 79

PRINT "x"

FOR x = -100 TO 100 STEP .01

PSET (x, FNF(x)), 11

NEXT x

e = .001

INPUT "kolichestvo korney", k

FOR i = 1 TO k

INPUT "a=", a

INPUT "b=", b

WHILE ABS(b - a) > e

c = (a + b) / 2

IF FNF(a) * FNF(c) > 0 THEN a = c ELSE b = c

WEND

x = (a + b) / 2

PRINT "x"; i; "="; x

NEXT i

SLEEP 10

SCREEN 1

GOSUB soderzanie

END

 

 

 

 

LAB4:

CLS

DEF FNF1 (x) = 15 + 5 * x - 12 * x ^ 2 - 9 * x ^ 3

INPUT a, b, m

h = (b - a) / (2 * m)

FOR i = 1 TO 2 * m - 1 STEP 2

x = a + i * h

S1 = S1 + 4 * FNF1(x)

NEXT i

FOR i = 2 TO 2 * m - 2 STEP 2

x = a + i * h

S1 = S1 + 2 * FNF1(x)

NEXT i

S1 = S1 + FNF1(a) + FNF1(b)

S1 = S1 * (h / 3)

PRINT "METOD SIMPSONA"

PRINT S1

S1 = 0

h = (b - a) / m

FOR i = 0 TO m - 1

x = a + i * h

S1 = S1 + FNF1(x)

NEXT i

S1 = S1 * h

PRINT "METOD PRIMOUGOLNIKOV SLEVA"

PRINT S1

S1 = 0

h = (b - a) / m

FOR i = 1 TO m

x = a + i * h

S1 = S1 + FNF1(x)

NEXT i

S1 = S1 * h

PRINT "METOD PRIMOUGOLNIKOV SPRAVA"

PRINT S1

S1 = 0

h = (b - a) / m

FOR i = 1 TO m - 1

x = a + i * h

S1 = S1 + FNF1(x)

NEXT i

S1 = S1 + FNF1(a) / 2 + FNF1(b) / 2

S1 = S1 * h

PRINT "METOD TRAPEZII"

PRINT S1

SLEEP 10

SCREEN 1

GOSUB soderzanie

END

 

 

LAB5:

CLS

n = 4

RESTORE 80

FOR i = 1 TO n

READ x(i)

NEXT i

RESTORE 90

FOR i = 1 TO n

READ y(i)

NEXT i

SCREEN 12

VIEW (80, 0)-(559, 479)

WINDOW (-10, -10)-(10, 10)

LINE (0, 10)-(0, 10)

LINE (-10, 0)-(10, 0)

FOR i = -9 TO 9

LINE (-.1, i)-(.1, i)

LINE (i, -.1)-(i, .1)

NEXT i

LOCATE 1, 39

PRINT "y"

LOCATE 17, 79

PRINT "x"

FOR i = 1 TO n

PSET (x(i), y(i))

CIRCLE (x(i), y(i)), .3

NEXT i

FOR xM = -5 TO 5 STEP .125

yM = 0

FOR i = 1 TO n

PV = 1: PN = 1

FOR j = 1 TO n

IF i = j THEN GOTO 5

PV = PV * (xM - x(j))

PN = PN * (x(i) - x(j))

5 NEXT j

yM = yM + (PV / PN) * y(i)

NEXT i

IF xM = -2 OR xM = 0 OR xM = 1 THEN PRINT "pri x="; xM; "f(x)="; yM

PSET (xM, yM)

NEXT xM

SLEEP 10

SCREEN 1

GOSUB soderzanie

END

 

 

 

 

LAB6:

CLS

INPUT "chislo urovnenii"; n

RESTORE 99

FOR i = 1 TO n

FOR j = 1 TO n

READ a(i, j)

NEXT j

NEXT i

RESTORE 98

FOR i = 1 TO n

READ 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

PRINT "korni urovneniya"

FOR i = 1 TO n

PRINT "x"; i; "="; x(i)

NEXT i

SLEEP 10

SCREEN 1

GOSUB soderzanie

END

 

LAB7:

CLS

DEF FNF2 (x) = 18 - 454 * x + 7 * x ^ 2

e = .01

INPUT "a="; a

INPUT "b="; b

FOR x = a TO b STEP e

IF FNF2(x) < FNF2(x + e) THEN EXIT FOR

NEXT x

PRINT " metod ravnomernogo poiska"

PRINT "xmin="; x; "f(x)="; FNF2(x)

WHILE ABS(b - a) > 2 * e

x1 = (a + b - e) / 2

x2 = (a + b + e) / 2

IF FNF2(x1) > FNF2(x2) THEN a = x1

IF FNF2(x1) < FNF2(x2) THEN b = x2

IF FNF2(x1) = FNF2(x2) THEN a = x1: b = x2

WEND

min = (b + a) / 2

PRINT "metod dihot."

PRINT "xmin="; min; "f(x min=)"; FNF2(min)

k = (SQR(5) - 1) / 2

WHILE ABS(b - a) > 2 * e

x1 = a + (1 - k) * (b - a)

x2 = a + k * (b - a)

IF FNF2(x1) >= FNF2(x2) THEN a = x1: x1 = x2

IF FNF2(x1) < FNF2(x2) THEN b = x2: x2 = x1

WEND

x3 = (b + a) / 2

PRINT "metod zolotogo sechenia"

PRINT "min="; x3; "f(min)="; FNF2(x3)

SLEEP 10

SCREEN 1

GOSUB soderzanie

END

 

 

 


Информация о работе Использование численных методов при решении инженерных задач