{"id":1474,"date":"2015-05-20T06:00:59","date_gmt":"2015-05-20T04:00:59","guid":{"rendered":"http:\/\/www.glc.us.es\/~jalonso\/exercitium\/?p=1474"},"modified":"2015-06-13T16:30:30","modified_gmt":"2015-06-13T14:30:30","slug":"parte-par-de-un-polinomio","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/parte-par-de-un-polinomio\/","title":{"rendered":"Parte par de un polinomio"},"content":{"rendered":"<p>La parte par de un polinomio de coeficientes enteros es el polinomio formado por sus monomios cuyos coeficientes son n\u00fameros pares. Por ejemplo, la parte par de 4x^3+x^2-7x+6 es 4x^3+6.<\/p>\n<p>Definir la funci\u00f3n<\/p>\n<pre lang=\"text\">\n   partePar :: Integral a => Polinomio a -> Polinomio a\n<\/pre>\n<p>tal que (partePar p) es la parte par de p. Por ejemplo,<\/p>\n<pre lang=\"text\">\n   ghci> partePar (consPol 3 4 (consPol 2 1 (consPol 0 6 polCero)))\n   4*x^3 + 6\n<\/pre>\n<p><strong>Nota<\/strong>: Este ejercicio debe realizarse usando \u00fanicamente las funciones de la librer\u00eda I1M.Pol que se encuentra <a href=\"http:\/\/bit.ly\/1AKmUQB\">aqu\u00ed<\/a> y se describe <a href=\"http:\/\/bit.ly\/1EpvBPd\">aqu\u00ed<\/a>.<\/p>\n<h4>Soluciones<\/h4>\n<pre lang=\"haskell\">\npartePar :: Integral a => Polinomio a -> Polinomio a\npartePar p\n    | esPolCero p = polCero\n    | even b      = consPol n b (partePar r)\n    | otherwise   = partePar r\n    where n = grado p\n          b = coefLider p\n          r = restoPol p\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>La parte par de un polinomio de coeficientes enteros es el polinomio formado por sus monomios cuyos coeficientes son n\u00fameros pares. Por ejemplo, la parte par de 4x^3+x^2-7x+6 es 4x^3+6. Definir la funci\u00f3n partePar :: Integral a => Polinomio a -> Polinomio a tal que (partePar p) es la parte par de p. Por ejemplo,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[5],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/posts\/1474"}],"collection":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/comments?post=1474"}],"version-history":[{"count":3,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/posts\/1474\/revisions"}],"predecessor-version":[{"id":1516,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/posts\/1474\/revisions\/1516"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/media?parent=1474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/categories?post=1474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/tags?post=1474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}