Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help C programming code the Lagrange portion of the problem, specifically

ID: 3779649 • Letter: I

Question


I need help C programming code the Lagrange portion of the problem, specifically finding the polynomial.

nte 12 24 36 35 Eraph uing any plat pragrams polynomials to the datautingkagrange interpalation 30 kse Direct Search Method to find the root of fol o between the range of mom 2 to 4 Your c code must contain the following feature: afaraws, une of poimers. ase of structure, l4) use of ution Sluie of functions and function calls. formatted Dutput of scree and msaving of the same output on a file resort on the praject and the report needs Nou need to submit a written to follow the format below.

Explanation / Answer

#include<stdio.h>
#include<conio.h>
#define MaxN 90

int main()
{
float x_array[MaxN+1], y_array[MaxN+1], numr, denom, x, y=0;
int i, j, n;

printf("Enter value of n: ");
scanf("%d", &n);
printf("Enter values of x and y: ");
for(i=0; i<=n; i++)
scanf("%f%f", &x_array[i], &y_array[i]);
printf("Enter x at which value of y is to be calculated: ");
scanf("%f", &x);
for (i=0; i<=n; i++)
{
numr=1;
denom=1;
for (j=0; j<=n; j++)
if(j!=i)
{
numr *= x-x_array[j];
denom *= x_array[i]-x_array[j];
}
y+=(numr/denom)*y_array[i];
}
printf("When x=%4.1f y=%7.1f ",x,y);
getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote