elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


  Mostrar Temas
Páginas: [1]
1  Programación / Programación C/C++ / c++ serie de taylor en: 30 Junio 2019, 02:49 am
#include<iostream>
#include<math.h>
using namespace std;

double pot(int a, int b)
{
 double p=1;
 for(int k=1;k<=b;k++)
 {
    p=p*a;
 }
 return (p);
}

int fac (int a)
{
   int s=1;
   for(int k=1;k<=a;k++)
   {
      s=s*k;
   }
   return (s);
}






double seno (double n, double x)
{
   double a,f;
   double b=0;
   for(int i=1;i<=n;i++)
   {
   for(double k=1;k<=2*n-1 ;k=k+2)
       {
      
   for(double v=0; v<n ;v++)
       {
       f=pot((-1),v);
       }
       a=pot(x,k)/fac(k);
       b=b+(a*f);
      
       }
   return(b);
    }   
}




int main()
{
   
   cout<<"  SERIE DE TAYLOR"<<endl;
   cout<<" -----------------"<<endl<<endl;
   
   cout<<seno(2,1)<<endl;
   
}
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines