can´t see outputs

Can't see the fail in splines method


#include "mn_aritmeticas.h"
#include "mn_interpolacion.h"

// OPTIMAL POINTS
Array1D< real > mn_puntos_interpolacion_optimos( const int N)
{
if(N<=0) return( Array1D< real >());

Array1D< real > v(N);

for (unsigned int i=0;i<N;i++)
{
v[i] = 0.5*(1+cos((M_PI*(2*i+1)/(2*N))));
}

return(v);
}

// NEWTON
Array1D< real > mn_construir_polinomio_interpolador(
const Array1D< real > &X,
const Array1D< real > &F)
{
if(X.dim()!=F.dim()) return(Array1D< real >());
Array1D< real > A(X.dim());
int N=X.dim()-1;
Array1D< real > B(A.dim());

// MAKE ALU
for(int k=0;k<=N;k++){
B[k]=F[k];
}
A[0]=F[0];
for(int k=1;k<=N;k++){
for(int l=0;l<=(N-k);l++){
if(X[k+l]==X[l]){
return(Array1D< real >());
}
B[l]=(B[l+1]-B[l])/(X[k+l]-X[l]);
}
A[k]=B[0];
}
return(A);
}


// NEWTON IN A POINT
real mn_evaluar_polinomio_interpolador(
const Array1D< real > &A,
const Array1D< real > &X,
const real X0)
{
int N=A.dim()-1;
// MAKE ALU
real E=A[N];
for(int k=N-1;k>=0;k--){
E=E*(X0-X[k])+A[k];
}

return E;
}
closed account (E3h7X9L8)
what are you trying to do ?
what is the exact problem ?
is this the full code ?
Topic archived. No new replies allowed.