dividierten Differenz
Donnerstag, April 26th, 2007Hier der Source Code zur Mathe II Numerik Vorlesung mit dem Problem des "Schema der dividierten Differenz"
#include "stdafx.h"
using namespace std;
int main()
{
int n = 10;
double a[10][2];
// Inizialisirung
for(int i=0; i < n; i++)
{
a[i][0] = i;
a[i][1] = (double)( 1 / (double)( 1 + (i*i) ) ) ;
}
// Funktion
for(; n > 0; n--)
{
for(int i=0; i < n ; i++)
{
if(i < n -1)
{
a[i][1] = (double)((double)( a[i+1][1] - a[i][1] ) / (double)( a[i+1][0] - a[i][0] ));
cout << a[i][1] << " ";
}
if(i > 1)
a[i-1][0] = a[i][0];
//cout << a[i][0] << " ";
}
cout << "\n";
}
return 0;
}