Hola a todos! Tengo una duda tonta de implementación de bucles for.
¿Cómo puedo escribir este código usando bucles?
Código:
double v = (((coeficientes[0]))+
+(coeficientes[1]*(i-A[0][0]))+
+(coeficientes[2]*(i-A[0][0])*(i-A[1][0]))+
+(coeficientes[3]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0]))+
+(coeficientes[4]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0]))+
+(coeficientes[5]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0]))+
+(coeficientes[6]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0]))+
+(coeficientes[7]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0]))+
+(coeficientes[8]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0])*(i-A[7][0]))+
+(coeficientes[9]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0])*(i-A[7][0])*(i-A[8][0]))+
+(coeficientes[10]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0])*(i-A[7][0])*(i-A[8][0])*(i-A[9][0]))+
+(coeficientes[11]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0])*(i-A[7][0])*(i-A[8][0])*(i-A[9][0])*(i-A[10][0]))+
+(coeficientes[12]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0])*(i-A[7][0])*(i-A[8][0])*(i-A[9][0])*(i-A[10][0])*(i-A[11][0]))+
+(coeficientes[13]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0])*(i-A[7][0])*(i-A[8][0])*(i-A[9][0])*(i-A[10][0])*(i-A[11][0])*(i-A[12][0]))+
+(coeficientes[14]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0])*(i-A[7][0])*(i-A[8][0])*(i-A[9][0])*(i-A[10][0])*(i-A[11][0])*(i-A[12][0])*(i-A[13][0]))+
+(coeficientes[15]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0])*(i-A[7][0])*(i-A[8][0])*(i-A[9][0])*(i-A[10][0])*(i-A[11][0])*(i-A[12][0])*(i-A[13][0])*(i-A[14][0]))+
+(coeficientes[16]*(i-A[0][0])*(i-A[1][0])*(i-A[2][0])*(i-A[3][0])*(i-A[4][0])*(i-A[5][0])*(i-A[6][0])*(i-A[7][0])*(i-A[8][0])*(i-A[9][0])*(i-A[10][0])*(i-A[11][0])*(i-A[12][0])*(i-A[13][0])*(i-A[14][0])*(i-A[15][0])));
El parámetro i es una constante.
Muchas gracias por adelantado!!!
Un saludo =)
a_24