Question
poly_main.c #include #include #include #include polynomial.h int main() { int n = 4; float p[] = {1, 2, 3, 4}; int m = 3; float
poly_main.c
#include
#include
#include
#include "polynomial.h"
int main()
{
int n = 4;
float p[] = {1, 2, 3, 4};
int m = 3;
float x[] = {0,1,10};
// test display and horner functions
int i;
for (i=0; i printf("P(%.2f)=", x[i]); display_polynomial(p, n, x[i]); printf("="); printf("%.2f ", horner(p, n, x[i])); } // test bisection function float a=-2, b=2; float pa = horner(p, n, a); printf("P(%.2f)=%.2f ", a, pa); float pb = horner(p, n, b); printf("P(%.2f)=%.2f ", b, pb); if (pa * pb float root = bisection(p, n, a, b); printf("root=%.2f ", root); printf("P(%.2f)=%.2f ", root, horner(p, n, root)); } else { printf("have the same sign on both sides "); } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started