Please help with creating the code as follows: Task 3: Write a function MultiplyPoly() to compute the polynomial resulting from the product oftwo input polynomials.Input: Input will be two files, each containing the coefficients of one of the two polynomials.Output: The program should output the coefficients of the resultant polynomial multiplication.Example: The input consists of polynomial a(x) = 1 + 2x + 3x2, represented in coefficient form as a =(1.000, 2.000, 3.000) and the polynomial b(x) = 4 + 5x, represented in coefficient form as b = (4.000, 5.000).The output is the resultant polynomial c(x) = a(x)b(x) = 4+13x+22x2 +15x3, represented in coefficient formas c = (4.000 − 0.000i, 13.000 + 0.000i, 22.000 − 0.000i, 15.000 + 0.000i, 0.000 + 0.000i, 0.000 + 0.000i, 0.000 −0.000i, 0.000 + 0.000i) The part below is meant ot help you with what I am looking for when you create the code Example Task 3: Polynomial Multiplication MultiplyPoly <input_file1.txt> <input_file2.txt> <output.txt> where input_file1.txt contains the coefficients of the first polynomial, and input_file2.txt containsthe coefficients of the second polynomial. This query should read the coefficients from both files,compute the coefficients of the polynomial resulting from the multiplication, and output the resultto output_file.txt.Example:task3_input1.txt1.0002.0003.000task3_input2.txt4.0005.000MultiplyPoly task3_input1.txt task3_input2.txt task3_output.txttask3_output.txt4.000 -0.00013.000 0.00022.000 -0.00015.000 0.0000.000 0.0000.000 0.0000.000 -0.0000.000 0.000
Please help with creating the code as follows:
Task 3: Write a function MultiplyPoly() to compute the polynomial resulting from the product of
two input polynomials.
Input: Input will be two files, each containing the coefficients of one of the two polynomials.
Output: The program should output the coefficients of the resultant polynomial multiplication.
Example: The input consists of polynomial a(x) = 1 + 2x + 3x2, represented in coefficient form as a =
(1.000, 2.000, 3.000) and the polynomial b(x) = 4 + 5x, represented in coefficient form as b = (4.000, 5.000).
The output is the resultant polynomial c(x) = a(x)b(x) = 4+13x+22x2 +15x3, represented in coefficient form
as c = (4.000 − 0.000i, 13.000 + 0.000i, 22.000 − 0.000i, 15.000 + 0.000i, 0.000 + 0.000i, 0.000 + 0.000i, 0.000 −
0.000i, 0.000 + 0.000i)
The part below is meant ot help you with what I am looking for when you create the code
MultiplyPoly <input_file1.txt> <input_file2.txt> <output.txt>
the coefficients of the second polynomial. This query should read the coefficients from both files,
compute the coefficients of the polynomial resulting from the multiplication, and output the result
to output_file.txt.
Example:
task3_input1.txt
1.000
2.000
3.000
task3_input2.txt
4.000
5.000
MultiplyPoly task3_input1.txt task3_input2.txt task3_output.txt
task3_output.txt
4.000 -0.000
13.000 0.000
22.000 -0.000
15.000 0.000
0.000 0.000
0.000 0.000
0.000 -0.000
0.000 0.000
Unlock instant AI solutions
Tap the button
to generate a solution