Commit e72af714 authored by Dakror's avatar Dakror

ass 2 done

parent 2f7fb6a5
......@@ -83,7 +83,25 @@ public class Konvergenzordnung {
* @return Ordnung p
*/
public double order(Einschrittverfahren verfahren, double h) {
// TODO: diese Methode ist zu implementieren
return 0.0;
double fac = 2;
double[] y_h = integrate(verfahren, h);
double[] y_h2 = integrate(verfahren, h / fac);
double e_h = 0;
double e_h2 = 0;
for (int i = 0; i < y_h.length; i++) {
y_h[i] -= ystar[i];
y_h2[i] -= ystar[i];
e_h += y_h[i] * y_h[i];
e_h2 += y_h2[i] * y_h2[i];
}
e_h = Math.sqrt(e_h);
e_h2 = Math.sqrt(e_h2);
return Math.log(e_h / e_h2) / Math.log(h / (h / fac));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment