Question

Write a program that accepts two polynomials as input and displays the resultant polynomial after multiplication of input polynomials

07 Aug 2023
Answer :
Word Count : 498

# Function to multiply two polynomials
def multiply_polynomials(poly1, poly2):
    result_degree = len(poly1) + len(poly2) - 2  # Degree of the resultant polynomial
    
    # Initialize the coefficients of the resultant polynomial with zeros
    result_coeffs = [0] * (result_degree + 1)
    
    # Multiply the coefficients of the input polynomials
    for deg1, coeff1 in enumerate(poly1):
        for deg2, coeff2 in enumerate(poly2):
            result_coeffs[deg1 + deg2] += coeff1 * coeff2
    
    return result_coeffs

# Function to display a polynomial in a readable format
def display_polynomial(polynomial):
    degree = len(polynomial) - 1
    polynomial_str = ""

    for deg, coeff in enumerate(polynomial):
        if coeff != 0:
            if deg == 0:
                term = f"{coeff}"
           

________ ________ ________ ______ _____ ___ _______ ___ __________ ___.
_______ _____ ______ _______ ___ ____.
_____ _______ _______ ______ ____ _________ _____ ____.
__________ __________ ______ _________ ________ ______ _________.
________ ____ ______ ______ ________ ________ ______ __________ _____.
___ ______ ________ _________ ________ _________ __________.
__________ _____ _______ _________ _________ _____ ___ ___ _________ __________ _________.
_______ __________ ____ _____ _______ ___ ____.
______ _________ ______ _________ _______ ____ ______ ___.
___ __________ _____ _____ __________ ____ __________ ________ _______ _________ _________.
_____ _____ ___ ___ ________ ______ _______ _________ _______ ________.
____ ____ ______ ________ _____.
____ _____ _____ ______ _____.
______ ______ ________ ____ ________ _____ _________ __________ ____.
_________ ____ ____ __________ ______ ____ _________ ________.
_________ ______ _______ _______ __________ ___ ______ ____ ________ _________.
_______ _____ ________ __________ _________ _________ ___ ____ _______ _____.
____ __________ ___ ____ ________ _________.
________ _____ ________ ______ ___ _____.
___ ___ ____ ________ ___ ________ _____ ____ __________.
_________ ______ _______ __________ __________ ___.
___ _______ _______ ____ ___ __________.
______ _____ ___ _________ ______ __________ ______ _________ ___ ________ ________ _______.
________ _________ _________ __________ ______ __________ ____ ________.
__________ _________ __________ _________ ____ __________ _______ _____ _______ _______ ________.
_________ _________ ____ ________ _______ _______ ______ ____.
________ ___ ________ _______ __________ _______ ___ _____ ______ _______.
____ _________ _________ __________ _____ _______.
______ _______ _____ _________ _________ __________ _____ _______ _____.
__________ ____ _____ ________ ____ _____ _____ ____ _________ _____.
_____ ______ ___ __________ ___ ___ _____.
___ __________ _____ _________ ___ ______ ______.
_______ _______ ________ ________ ____ ____ ____ ________ ____.
____ ______ ______ ______ ____.
________ ___ _________ _______ ________ ____ _______ ___.
________ ___ _____ ___ _______ ___ ________ _________ _________ _____.
__________ _____ _________ ________ ______.
____ ____ _________ ________ ____ __________.
__________ _____ ________ _______ _____ __________ ________ _______ __________ ______ __________ ____.
_______ _______.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCS 21 2023 2024 - Write a program that accepts two polynomials as input and displays the | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→