ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Series de taylor analisis numerico


Enviado por   •  29 de Septiembre de 2015  •  Tareas  •  1.470 Palabras (6 Páginas)  •  175 Visitas

Página 1 de 6

#include <cstdlib>

#include <iostream>

#include <math.h>

using namespace std;

#define F 10

#define G 50

#define H 2

#define C 8

#define L 8

void portada();

int funa(int,int,int);

int funb(int,int,int);

int factorial(int);

int main()

{

int x,y,z;

cout<<"Series de Taylor y McLaurin"<<endl<<endl;

cout<<"Funciones:"<<endl;

cout<<"1) f(x)=x^1/2"<<endl;

cout<<"2) f(x)=x^5+4x^2+3x+1"<<endl<<endl;

cout<<"Elige la función que desea trabajar: ";

cin>>x;

cout<<"Dame el grado de expansión de la serie: ";

cin>>y;

cout<<"Dame el punto x, donde se evaluará: ";

cin>>z;

cout<<endl;

system("pause");

system("cls");

if(x==1)

{

if(y<=50)

{

funa(x,y,z);

}

else

{

cout<<"No se puede efectuar, el grado es muy grande"<<endl<<endl;

}

}

else

{

if(x==2)

{

if(y<=5)

{

funb(x,y,z);

}

else

{

cout<<"El grado máximo de la función es 5"<<endl<<endl;

}

}

else

{

cout<<"Número de función inválido"<<endl;

}

}

cout<<endl<<endl;

system("pause");

return 0;

}

int funa(int x,int y, int z)

{

int xi,i,j,h;

double R[G][H],S[H],T[G];

double sum,real,error;

S[0]=1;

S[1]=0.5;

//POLINOMIO DE TAYLOR GRADO N

cout<<"Polinomio de Taylor de grado n:";

cout<<endl<<"f0(x): ";

for(i=1,j=1;j<=2;j++)

{

R[i][j]=S[j-1];

cout<<R[i][j]<<"x^";

}

cout<<endl;

int cont=1;

for(i=2;i<=y+1;i++)

{

cout<<"f"<<i-1<<"(x): ";

for(j=1;j<=2;j++)

{

if(j%2==0)

{

R[i][j]=R[i-1][j]-1;

}

else

{

R[i][j]=R[i-1][j]*R[i-1][j+1];

}

if((j%2)==0)

cout<<"x^";

cout<<R[i][j];

}

cont++;

cout<<endl;

}

cout<<endl<<endl;

system("pause");

system("cls");

for(j=1,i=1;i<=y+1;i++)

{

T[i-1]=R[i][j];

...

Descargar como (para miembros actualizados)  txt (4.4 Kb)   pdf (49.7 Kb)   docx (13.9 Kb)  
Leer 5 páginas más »
Disponible sólo en Clubensayos.com