rendered paste bodyusing System;
using System.Collections.Generic;
using System.Text;
namespace WindowsFormsApplication1
{
public class Berechnung
{
public static string NewtonBerechnung(double a1, double a2, double b1, double b2, double c1, double c2, double d1, double d2, double e1, double e2, double nährungswert)
{
double temp = -1;
double ergebnis = 0;
string ergebnis_str = "";
while (ergebnis != temp)
{
if (ergebnis != 0)
{
ergebnis_str += ergebnis.ToString() + Environment.NewLine;
}
double hx = (a1 - a2) * Math.Pow(nährungswert, 4) + (b1 - b2) * Math.Pow(nährungswert, 3) + (c1 - c2) * Math.Pow(nährungswert, 2) + (d1 - d2) * Math.Pow(nährungswert, 1) + (e1 - e2) * Math.Pow(nährungswert, 0);
double hStrichx = 4 * (a1 - a2) * Math.Pow(nährungswert, 3) + 3 * (b1 - b2) * Math.Pow(nährungswert, 2) + 2 * (c1 - c2) * Math.Pow(nährungswert, 1) + 1 * (d1 - d2) * Math.Pow(nährungswert, 0);
temp = ergebnis;
ergebnis = nährungswert - (hx / hStrichx);
nährungswert = ergebnis;
}
return ergebnis_str;
}
}
}