Doubts about normalization of polynomials

0

Define the function normalizes that given a polynomial, it returns the corresponding polynomial, after being normalized.

Example:

normaliza [(1,2),(3,4),(3,2)]

[(4,1),(3,4)]

type Polinomio = [Monomio]

type Monomio = (Float,Int)

normaliza :: Polinomio -> Polinomio

normaliza [(x,y)] = [(x,y)]

normaliza ((x,y): t) = (map (+) coeficientes (selgrau y  (x,y):t)) ((x,y) : t)

coeficientes :: [(Float,Int)] -> [Float]

coeficientes [(x,y)] = [x]

coeficientes (h:t) = fst h : coeficientes t

selgrau :: Int -> Polinomio -> Polinomio  

selgrau n [] = []

selgrau n l = filter f l   

            where f (c,e) = e == n 

Can you help me :)

    
asked by anonymous 17.12.2017 / 11:46

0 answers