#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    Programming C work about polynomials


    i have to do this work about polynomials, and i have to do some multiplications between two polynomials .
    My problem is i have to put the formula of the polynomial after i multiplicate . and it has to be something like this :
    " 1 + 2 x**2 + 3x**5"
    I have to do some printf i guess, because it is not supposed to know the value of x and the values with 0 should not appear nor their x**n.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Just to let you know, C and C++ don't have a ** operator. The equivalent for this is the pow() function.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,837
    Rep Power
    480
    I take it you need to multiply the polynomials rather than evaluate them.

    How are the coefficients entered?
    What does the output need to look like?

    Please show your programming effort, if by chance you can't make it work, and you'll get some advice.

    Code:
                  2      3
    y(x) = 1 + 4 x  - 3 x
    
    1+4x**2-3x**3
    
    although the latter would paste functionally directly into python and many other languages.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo