Курсовая на тему Нахождение корней уравнений различными методами
Работа добавлена на сайт bukvasha.net: 2014-07-21Поможем написать учебную работу
Если у вас возникли сложности с курсовой, контрольной, дипломной, рефератом, отчетом по практике, научно-исследовательской и любой другой работой - мы готовы помочь.

Предоплата всего
от 25%

Подписываем
договор
Министерство Образования Российской Федерации
Иркутский Государственный Технический Университет.
Кафедра АПП.
Курсовая работа по программированию
и основам алгоритмизации.
Выполнил студент гр.АТП-04-1
Чечев И.С.
Проверила: Пешкова Л.И
Иркутск
2005 г
Вариант 31
Задание 1
1. Проверить условие сходимости и записать расчетные формулы для нахождения корня уравнения 
с точностью 
= 
методом половинного деления, интервал существования корня [1;2].
Составить блок-схему алгоритма и программу решения задачи. В программе предусмотреть подсчет и вывод на печать числа итерации, за которое удается найти значение корня с заданной точностью. Отладить и выполнить программу на машине.
Блок-схема алгоритма.
Общая:

Программа.
Program delenie;
uses crt;
const
e=0.0001
var x,a,b,t:real;
n:integer;
function f(x::real):real;
begin
t:=sqrt(1+exp(2*x));
F:=exp(x)+t-2;
end;
begin
readln(a,b);
n:=0;
if F(a)*F(b)>0 then begin writeln(‘kornei net’); end;
while ABS(a-b)>e do
Begin
n:=n+1;
x:=(a+b)/2
if F(a)*F(x)<0 then b:=x else a:=x;
end;
writeln(‘koren: ‘,x);
writeln(‘chislo iterazii: ‘,n);
end.
Задание 2.
Записать расчетные формулы, составить блок-схему алгоритма и программу для вычисления определенного интеграла 
методом Симпсона, разбивая отрезок интегрирования [0;1] на 78 частей. Предусмотреть в программе вычисление точного значения определенного интеграла через первообразную 
.
Решение.
Вытекает из формулы Симпсона 
Блок-схема алгоритма.
Function p(x:real):real SHAPE \* MERGEFORMAT
Function y(x:real):real;
Основная блок-схема:

























Программа.
Program Simpson;
var x,s,h,z,a,b:real;
n,c:integer;
i,k:integer;
function p(x:real):real;
begin
p:=1/sqr(3*sin(x)+2*cos(x));
end;
function y(x:real):real;
begin
y:=3/36-(3*cos(x)-2*sin(x))/(13*(2*cos(x)+3*sin(x)));
end;
begin
writeln(‘vvod’,a,b,n)
readln(a,b,n);
h:=(b-a)/(2*n);
c:=-1;
x:=a;
for i:=1 to 2*n-1 do
begin
x:=x+h;
k:=3+c;
s:=s+k*y(x);
c:=-c;
end;
s:=s+y(a)+y(b);
s:=s*(h/3);
z:=p(b)-p(a);
writeln(‘vivod’,z);
end.
Задание 3.
Построить график функции.
Y=1/sqr(3sin(x)+2cos(x)).
Программа.
Program grafik;
uses Graph;
var x0,y0:Word;
сrdr,crm:integer;
x,y:real;
i,j:word;
begin
СrDr:=Detect;
InitGraph(GrDr,Grm,’C:\paskal\BGI’);
if GraphResult <> grok then
begin writeln(‘error graf’);Halt end;
x0:=40;
y0:=GetMaxy;
setbkcolor(1);
y0:=GetMaxy;
setbkcolor(1);
setcolor(15);
Line (x0,0,x0,y0);
Line (x0,y0,getmaxx,y0);
MoveTo(x0,y0);
for i:=1 to getymaxx-40 do
begin
x:=1/(3*sin(x)+2*cos(x)*(3*sin(x)+2*cos(x)));
LineTo(x0+i,y0-round(y*40));
setcolor(15);
Line (x0,0,x0,y0);
Line (x0,y0,getmaxx,y0);
MoveTo(x0,y0);
for i:=1 to getymaxx-40 do
begin
x:=1/(3*sin(x)+2*cos(x)*(3*sin(x)+2*cos(x)));
z:=78*sin(x)+44*cos(x)* 78*sin(x)+2*cos(x);
e:=cos(x)
LineTo(x0+i,y0-round(y*40));
end;
readln;
CloseGraph;
end.
Иркутский Государственный Технический Университет.
Кафедра АПП.
Курсовая работа по программированию
и основам алгоритмизации.
Выполнил студент гр.АТП-04-1
Чечев И.С.
Проверила: Пешкова Л.И
Иркутск
Вариант 31
Задание 1
1. Проверить условие сходимости и записать расчетные формулы для нахождения корня уравнения
Составить блок-схему алгоритма и программу решения задачи. В программе предусмотреть подсчет и вывод на печать числа итерации, за которое удается найти значение корня с заданной точностью. Отладить и выполнить программу на машине.
|
Function f(x: real):real
t:=sqrt(1+exp(2*x)); f:=sqrtexp(x)+t-2 |
конец |
начало |
n,x,a,b |
n:=0 |
F(a)*F(b)>0 |
Корней нет |
ABS(a-b)>e |
n:=n+1 x:=a+b/2 |
F(a)*F(x)<0 |
b:x |
a:x |
конец |
Программа.
Program delenie;
uses crt;
const
e=0.0001
var x,a,b,t:real;
n:integer;
function f(x::real):real;
begin
t:=sqrt(1+exp(2*x));
F:=exp(x)+t-2;
end;
begin
readln(a,b);
n:=0;
if F(a)*F(b)>0 then begin writeln(‘kornei net’); end;
while ABS(a-b)>e do
Begin
n:=n+1;
x:=(a+b)/2
if F(a)*F(x)<0 then b:=x else a:=x;
end;
writeln(‘koren: ‘,x);
writeln(‘chislo iterazii: ‘,n);
end.
Задание 2.
Записать расчетные формулы, составить блок-схему алгоритма и программу для вычисления определенного интеграла
Решение.
Вытекает из формулы Симпсона
Блок-схема алгоритма.
Function p(x:real):real SHAPE \* MERGEFORMAT
начало |
конец |
Y:=3/36-(3*cos(x)-2*sin(x))/(13*(2*cos(x)+3*sin(x))) |
| |||
конец |
Основная блок-схема:
Начало |
x,s,h,z,a,b,n,c,I,k |
h=(b-a)/2*n |
Конец |
z |
|
s |
|
|
|
|
|
|
i=1,2*n-1 |
|
Программа.
Program Simpson;
var x,s,h,z,a,b:real;
n,c:integer;
i,k:integer;
function p(x:real):real;
begin
p:=1/sqr(3*sin(x)+2*cos(x));
end;
function y(x:real):real;
begin
y:=3/36-(3*cos(x)-2*sin(x))/(13*(2*cos(x)+3*sin(x)));
end;
begin
writeln(‘vvod’,a,b,n)
readln(a,b,n);
h:=(b-a)/(2*n);
c:=-1;
x:=a;
for i:=1 to 2*n-1 do
begin
x:=x+h;
k:=3+c;
s:=s+k*y(x);
c:=-c;
end;
s:=s+y(a)+y(b);
s:=s*(h/3);
z:=p(b)-p(a);
writeln(‘vivod’,z);
end.
Задание 3.
Построить график функции.
Y=1/sqr(3sin(x)+2cos(x)).
Программа.
Program grafik;
uses Graph;
var x0,y0:Word;
сrdr,crm:integer;
x,y:real;
i,j:word;
begin
СrDr:=Detect;
InitGraph(GrDr,Grm,’C:\paskal\BGI’);
if GraphResult <> grok then
begin writeln(‘error graf’);Halt end;
x0:=40;
y0:=GetMaxy;
setbkcolor(1);
y0:=GetMaxy;
setbkcolor(1);
setcolor(15);
Line (x0,0,x0,y0);
Line (x0,y0,getmaxx,y0);
MoveTo(x0,y0);
for i:=1 to getymaxx-40 do
begin
x:=1/(3*sin(x)+2*cos(x)*(3*sin(x)+2*cos(x)));
LineTo(x0+i,y0-round(y*40));
setcolor(15);
Line (x0,0,x0,y0);
Line (x0,y0,getmaxx,y0);
MoveTo(x0,y0);
for i:=1 to getymaxx-40 do
begin
x:=1/(3*sin(x)+2*cos(x)*(3*sin(x)+2*cos(x)));
z:=78*sin(x)+44*cos(x)* 78*sin(x)+2*cos(x);
e:=cos(x)
LineTo(x0+i,y0-round(y*40));
end;
readln;
CloseGraph;
end.