0% found this document useful (0 votes)
66 views3 pages

Raport: Metode Numerice

This lab report summarizes applying numerical integration methods to solve Cauchy problems for differential equations over the interval [a,b] with step size h=0.05. Specifically, the Euler, modified Euler, and Runge-Kutta methods were implemented and their results analyzed. The code integrates the test equation y'= 1+0.5ysin(x)-0.75y^2 and outputs tables comparing the solution values from each method at each step. The conclusion is that the Runge-Kutta and modified Euler methods produced more accurate results than the basic Euler method.

Uploaded by

Ion Mardari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views3 pages

Raport: Metode Numerice

This lab report summarizes applying numerical integration methods to solve Cauchy problems for differential equations over the interval [a,b] with step size h=0.05. Specifically, the Euler, modified Euler, and Runge-Kutta methods were implemented and their results analyzed. The code integrates the test equation y'= 1+0.5ysin(x)-0.75y^2 and outputs tables comparing the solution values from each method at each step. The conclusion is that the Runge-Kutta and modified Euler methods produced more accurate results than the basic Euler method.

Uploaded by

Ion Mardari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ministerul Educatiei al Republicii Moldova

Universitatea Tehnica a Moldovei


Facultatea Calculatoare,Informatica si Microelectronica

Raport
la Lucrarea de laborator nr.4

Disciplina: Metode numerice


Tema: Integrarea numerica a ecuatiilor diferentiale.

A Indeplinit: st.gr.CR-182 Mardari Ion

A Verificat : prof.unive. Istrati Daniela

Chisinau-2019
Tema:Integrarea numerica a ecuatiilor diferentiale.

Scopul lucrării:
1. Sa se determine solutia problemei Cauchy pe segmental indicat [a,b] prin metodele Euler, Euler
modificat si Runge-Kutta cu pasul h=0.05;
2. Sa se efectueze o analiza a rezultatelor obtinute.

Codul sursa al programului :


#include <iostream.h>
#include <iomanip.h>
#include <conio.h>
#include <math.h>
#include <windows.h>
void Color(int couleurDuTexte,int couleurDeFond)
{
HANDLE H = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(H,couleurDeFond*16+couleurDuTexte);
}
void Color(int couleurDuTexte,int couleurDeFond);
double f(double,double);
double Euler(double,double,double);
double EulerModificata(double,double,double,double);
double Runge_Kutta(double,double,double);

void main(void)
{
clrscr();
double a,b,h,x0,y0,y1,y2,y3;
Color(3,0);
cout<<"Dati a si b:\n";
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;
cout<<"Dati pasul h:\n";
cin>>h;
Color(2,0);
cout<<"Dati x0 si y0:\n";
cout<<"x0=";
cin>>x0;
cout<<"y0=";
cin>>y0;
y1=y2=y3=y0;
Color(12,0);
cout<<setw(6)<<"xi"<<" Metoda Metoda Metoda\n";
cout<<" "<<setw(10)<<"Euler"<<" "
<<setw(16)<<"Euler Modificata"<<" "
<<setw(10)<<"Runge_Kutta"<<endl;
for (x0+=h;x0-h<b;x0+=h)
{
y1=Euler(x0,y1,h);
y2=EulerModificata(x0,x0+h,y2,h);
y3=Runge_Kutta(x0,y3,h);
cout<<setw(6)<<x0<<" "<<setw(10)<<y1<<" "
<<setw(13)<<y2<<" "
<<setw(14)<<y3<<endl;
};
getch();
};
Return 1+0,5ysin(x)-0,75y^2;
};

double Euler(double x,double y,double h)


{
return y+h*f(x,y);
};

double EulerModificata(double x,double x1,double y,double h)


{

return y+h*(f(x,y)+f(x1,Euler(x,y,h)))/2;
};

double Runge_Kutta(double x,double y,double h)


{
double k1,k2,k3,k4,delta_y;
k1=h*f(x,y);
k2=h*f(x+h/2,y+k1/2);
k3=h*f(x+h/2,y+k2/2);
return y+(k1+2*k2+2*k3)/6;

Exemplu de rezultate:

Concluzie : In aceasta lucrare de laborator am facut cunostinta cu metodele de


integrare numerica aecuatiilor diferentiale. Analizind rezultatele obtinute am
observat ca metoda Runge-Kutta si metoda Euler modificată dau rezultate mai
bune.

You might also like