Realizamos un programa en c en donde introducimos unos valores la función era así:
a = f (a)
a + n = f (a + n)
a + (n - 1) h = f (a + n (n - 1) h)
b = f (b)
luego proponíamos un polinomio para evaluarlo en los valores que tomaba a, b y h, y observamos el resultado.
# include <conio.h>
# include <stdio.h>
# include <iostream.h>
# include <math.h>
void funcion ();
void main ()
{
funcion ();
getch ();
}
void funcion ()
{
float a, b, h, x[100], y [100];
int n;
cout << "introduce el valor de a" << endl;
cin >> a;
cout << "introduce el valor de b" << endl;
cin >> b;
cout << "introduce el valor de h" << endl;
cin >> h;
cout << "iteratividad?" << endl;
cin >> n;
x[n]= a;
y[n] = 3 * pow (x,3)- 5 * pow (x,2)+5 * x;
for (int i=n; i<=2; n--)
{
x[i-1] = a+n * h;
y[i-1] = 3 * (x * x * x) - 5 * (x * x) + 5 * x;
}
x[1]= a;
y[1] = 3 * (x * x * x) - 5 *(x * x)+ 5 * x;
for (int j=n; j<=0; n--)
{
cout << " " << x[i] << " " << y[i] << endl;
}
}
No hay comentarios:
Publicar un comentario