numerical analysis 3

advertisement
ECE 208 Numerical Analyses
Homework 3
Student: Deni Troshani
The following code was used to approximate the solution of the IVP-s:
void EulerMethod(double x[], double y[], double
a, double alpha, double b)
{
int i;
double h = (b-a)/SIZE;
x[0] = a;
y[0] = alpha;
for(i=1; i<=SIZE; i++){
x[i] = a + h*i;
y[i] = y[i-1] + h*f(x[i-1],y[i-1]);
}
}
First IVP
The exact solution of this Differential Equation is the following:
The solution approximated from the EULER method is the following:
 n=10
 n=100
 n=500
 n=1000
 n=10000
Second IVP
The exact solution of this Differential Equation is the following:
The solution approximated from the EULER method is the following:
 n=10
 n=100
 n=500
 n=1000
 n=10000
Third IVP
The exact solution of this Differential Equation is the following:
The solution approximated from the EULER method is the following:
 n=10
 n=100
 n=500
 n=1000
 n=10000
Fourth IVP
The exact solution of this Differential Equation is the following:
The solution approximated from the EULER method is the following:
 n=10
 n=100
 n=500
n=1000
 n=10000
Download
Random flashcards
Radiobiology

39 Cards

Pastoralists

20 Cards

Radioactivity

30 Cards

Nomads

17 Cards

Create flashcards