Dont display elements with coefficient=0 sign "+" should be showned for coefficients bigger than 0, coefficients 1 & -1, if they are not constant terms, not showned, for -1 only "-" should be displayed, you can display "^" for marking powers of variable x, so polynomial should be showned W(x) = 2 x^4 - x^3 + x^2 -6. in certain case, when all coefficients/all coefficients except constant term are equal 0, you have to display only constant term, for example for array {-1, 0. 0, 0, 0} displayed polynomial is W(x)=-1 2. Create a function, which adds two polynomials (in the same power) and coefficients of received polynomial are saved in 3rd array. 3. Create a function, which subtracts two polynomials (in the same power) and coefficients of received polynomial are saved in 3rd array. 4. Create a function, which multiplies two polynomials (in the same power k) and coefficients of received polynomial are saved in 3rd array. Polynomial which is the result of multiplying should be saved in the array in the size: 2*k+1. 5. In main() declare two static arrays, both in the same size. Initalize them randomly with numbers from interval [-5, 5]. Declare also array for total, difference, and product of polynomials. needed in the program: #include #include #include #define M 10 void totalpolynomials(int * tab1, int * tab2, int *wynik, int n) // n is the size of every array { //score[0] = tab1[0] + tab2[0]; // example of instruction which adds constant terms int main() { srand(time(NULL)); return 0; }
Dont display elements with coefficient=0
sign "+" should be showned for coefficients bigger than 0, coefficients 1 & -1, if they are not constant terms, not showned, for -1 only "-" should be displayed, you can display "^" for marking powers of variable x, so polynomial should be showned W(x) = 2 x^4 - x^3 + x^2 -6.
in certain case, when all coefficients/all coefficients except constant term are equal 0, you have to display only constant term, for example for array {-1, 0. 0, 0, 0} displayed polynomial is W(x)=-1
2. Create a function, which adds two polynomials (in the same power) and coefficients of received polynomial are saved in 3rd array.
3. Create a function, which subtracts two polynomials (in the same power) and coefficients of received polynomial are saved in 3rd array.
4. Create a function, which multiplies two polynomials (in the same power k) and coefficients of received polynomial are saved in 3rd array. Polynomial which is the result of multiplying should be saved in the array in the size: 2*k+1.
5. In main() declare two static arrays, both in the same size. Initalize them randomly with numbers from interval [-5, 5]. Declare also array for total, difference, and product of polynomials.
needed in the program:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define M 10
void totalpolynomials(int * tab1, int * tab2, int *wynik, int n) // n is the size of every array
{
//score[0] = tab1[0] + tab2[0]; // example of instruction which adds constant terms
int main()
{
srand(time(NULL));
return 0;
}
Step by step
Solved in 2 steps with 1 images