{"id":4025,"date":"2018-05-01T06:00:55","date_gmt":"2018-05-01T04:00:55","guid":{"rendered":"http:\/\/www.glc.us.es\/~jalonso\/exercitium\/?p=4025"},"modified":"2018-05-08T06:44:19","modified_gmt":"2018-05-08T04:44:19","slug":"polinomio-digital","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/polinomio-digital\/","title":{"rendered":"Polinomio digital"},"content":{"rendered":"<p>Definir la funci\u00f3n<\/p>\n<pre lang=\"text\">\n   polinomioDigital :: Int -> Polinomio Int\n<\/pre>\n<p>tal que (polinomioDigital n) es el polinomio cuyos coeficientes son los d\u00edgitos de n. Por ejemplo,<\/p>\n<pre lang=\"text\">\n   \u03bb> polinomioDigital 5703 \n   5*x^3 + 7*x^2 + 3\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\">\nimport I1M.Pol\n\npolinomioDigital :: Int -> Polinomio Int\npolinomioDigital = creaPolDensa . digitos\n\n-- (digitos n) es la lista de las d\u00edgitos de n. Por ejemplo,        \n--    d\u00edgitos 142857  ==  [1,4,2,8,5,7]\ndigitos :: Int -> [Int]\ndigitos n = [read [x]| x <- show n]\n\n-- (creaPolDensa xs) es el polinomio cuya representaci\u00f3n densa es\n-- xs. Por ejemplo, \n--    creaPolDensa [7,0,0,4,0,3]  ==  7*x^5 + 4*x^2 + 3\ncreaPolDensa :: (Num a, Eq a) => [a] -> Polinomio a\ncreaPolDensa []     = polCero\ncreaPolDensa (x:xs) = consPol (length xs) x (creaPolDensa xs)\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Definir la funci\u00f3n polinomioDigital :: Int -> Polinomio Int tal que (polinomioDigital n) es el polinomio cuyos coeficientes son los d\u00edgitos de n. Por ejemplo, \u03bb> polinomioDigital 5703 5*x^3 + 7*x^2 + 3 Nota: Este ejercicio debe realizarse usando \u00fanicamente las funciones de la librer\u00eda I1M.Pol que se encuentra aqu\u00ed y se describe aqu\u00ed. Soluciones&#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":[8,28,265,95,6,33],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/posts\/4025"}],"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=4025"}],"version-history":[{"count":5,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/posts\/4025\/revisions"}],"predecessor-version":[{"id":4058,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/posts\/4025\/revisions\/4058"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/media?parent=4025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/categories?post=4025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/exercitium\/wp-json\/wp\/v2\/tags?post=4025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}