        {"id":774,"date":"2021-09-20T05:00:43","date_gmt":"2021-09-20T03:00:43","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=774"},"modified":"2021-09-20T08:04:43","modified_gmt":"2021-09-20T06:04:43","slug":"suma-de-progresion-geometrica","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/suma-de-progresion-geometrica\/","title":{"rendered":"Suma de progresi\u00f3n geom\u00e9trica"},"content":{"rendered":"<p>Demostrar que la suma de los t\u00e9rminos de la progresi\u00f3n geom\u00e9trica<\/p>\n<pre lang=\"text\">\n   a + aq + aq\u00b2 + \u00b7\u00b7\u00b7 + aqn\u207f\n<\/pre>\n<p>es<\/p>\n<pre lang=\"text\">\n     a(1 - q\u207f\u207a\u00b9)\n    -------------\n       1 - q\n<\/pre>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.real.basic\nopen nat\n\nvariable  (n : \u2115)\nvariables (a q : \u211d)\n\ndef sumaPG : \u211d \u2192 \u211d \u2192 \u2115 \u2192 \u211d\n| a q 0       := a\n| a q (n + 1) := sumaPG a q n + (a * q^(n + 1))\n\nexample :\n  (1 - q) * sumaPG a q n = a * (1 - q^(n + 1)) :=\nsorry\n<\/pre>\n<p>[expand title=\u00bbSoluciones con Lean\u00bb]<\/p>\n<pre lang=\"lean\">\r\nimport data.real.basic\r\nopen nat\r\n\r\nvariable  (n : \u2115)\r\nvariables (a q : \u211d)\r\n\r\nset_option pp.structure_projections false\r\n\r\n@[simp]\r\ndef sumaPG : \u211d \u2192 \u211d \u2192 \u2115 \u2192 \u211d\r\n| a q 0       := a\r\n| a q (n + 1) := sumaPG a q n + (a * q^(n + 1))\r\n\r\nexample :\r\n  (1 - q) * sumaPG a q n = a * (1 - q^(n + 1)) :=\r\nbegin\r\n  induction n with n HI,\r\n  { simp,\r\n    ac_refl, },\r\n  { calc (1 - q) * sumaPG a q (succ n)\r\n         = (1 - q) * (sumaPG a q n + (a * q^(n + 1)))\r\n           : rfl\r\n     ... = (1 - q) * sumaPG a q n + (1 - q) * (a * q^(n + 1))\r\n           : by ring_nf\r\n     ... = a * (1 - q ^ (n + 1)) + (1 - q) * (a * q^(n + 1))\r\n           : by {congr ; rw HI}\r\n     ... = a * (1 - q ^ (succ n + 1))\r\n           : by ring_nf },\r\nend\r\n<\/pre>\n<p>Se puede interactuar con la prueba anterior en <a href=\"https:\/\/leanprover-community.github.io\/lean-web-editor\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Calculemus\/main\/src\/Suma_de_progresion_geometrica.lean\" rel=\"noopener noreferrer\" target=\"_blank\">esta sesi\u00f3n con Lean<\/a>.<\/p>\n<p>En los comentarios se pueden escribir otras soluciones, escribiendo el c\u00f3digo entre una l\u00ednea con &#60;pre lang=&quot;lean&quot;&#62; y otra con &#60;\/pre&#62;<br \/>\n[\/expand]<\/p>\n<p>[expand title=\u00bbSoluciones con Isabelle\/HOL\u00bb]<\/p>\n<pre lang=\"isar\">\r\ntheory Suma_de_progresion_geometrica\r\nimports Main HOL.Real\r\nbegin\r\n\r\nfun sumaPG :: \"real \u21d2 real \u21d2 nat \u21d2 real\" where\r\n  \"sumaPG a q 0 = a\"\r\n| \"sumaPG a q (Suc n) = sumaPG a q n + (a * q^(n + 1))\"\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma\r\n  \"(1 - q) * sumaPG a q n = a * (1 - q^(n + 1))\"\r\nproof (induct n)\r\n  show \"(1 - q) * sumaPG a q 0 = a * (1 - q ^ (0 + 1))\"\r\n    by simp\r\nnext\r\n  fix n\r\n  assume HI : \"(1 - q) * sumaPG a q n = a * (1 - q ^ (n + 1))\"\r\n  have \"(1 - q) * sumaPG a q (Suc n) =\r\n        (1 - q) * (sumaPG a q n + (a * q^(n + 1)))\"\r\n    by simp\r\n  also have \"\u2026 = (1 - q) * sumaPG a q n + (1 - q) * a * q^(n + 1)\"\r\n    by (simp add: algebra_simps)\r\n  also have \"\u2026 = a * (1 - q ^ (n + 1)) + (1 - q) * a * q^(n + 1)\"\r\n    using HI by simp\r\n  also have \"\u2026 = a * (1 - q ^ (n + 1) + (1 - q) * q^(n + 1))\"\r\n    by (simp add: algebra_simps)\r\n  also have \"\u2026 = a * (1 - q ^ (n + 1) +  q^(n + 1) - q^(n + 2))\"\r\n    by (simp add: algebra_simps)\r\n  also have \"\u2026 = a * (1 - q^(n + 2))\"\r\n    by simp\r\n  also have \"\u2026 = a * (1 - q ^ (Suc n + 1))\"\r\n    by simp\r\n  finally show \"(1 - q) * sumaPG a q (Suc n) = a * (1 - q ^ (Suc n + 1))\"\r\n    by this\r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma\r\n  \"(1 - q) * sumaPG a q n = a * (1 - q^(n + 1))\"\r\nproof (induct n)\r\n  show \"(1 - q) * sumaPG a q 0 = a * (1 - q ^ (0 + 1))\"\r\n    by simp\r\nnext\r\n  fix n\r\n  assume HI : \"(1 - q) * sumaPG a q n = a * (1 - q ^ (n + 1))\"\r\n  have \"(1 - q) * sumaPG a q (Suc n) =\r\n        (1 - q) * sumaPG a q n + (1 - q) * a * q^(n + 1)\"\r\n    by (simp add: algebra_simps)\r\n  also have \"\u2026 = a * (1 - q ^ (n + 1)) + (1 - q) * a * q^(n + 1)\"\r\n    using HI by simp\r\n  also have \"\u2026 = a * (1 - q ^ (n + 1) +  q^(n + 1) - q^(n + 2))\"\r\n    by (simp add: algebra_simps)\r\n  finally show \"(1 - q) * sumaPG a q (Suc n) = a * (1 - q ^ (Suc n + 1))\"\r\n    by simp\r\nqed\r\n\r\n(* 3\u00aa demostraci\u00f3n *)\r\nlemma\r\n  \"(1 - q) * sumaPG a q n = a * (1 - q^(n + 1))\"\r\n  using power_add\r\n  by (induct n) (auto simp: algebra_simps)\r\n\r\nend\r\n<\/pre>\n<p>En los comentarios se pueden escribir otras soluciones, escribiendo el c\u00f3digo entre una l\u00ednea con &#60;pre lang=&quot;isar&quot;&#62; y otra con &#60;\/pre&#62;<br \/>\n[\/expand]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar que la suma de los t\u00e9rminos de la progresi\u00f3n geom\u00e9trica a + aq + aq\u00b2 + \u00b7\u00b7\u00b7 + aqn\u207f es a(1 &#8211; q\u207f\u207a\u00b9) &#8212;&#8212;&#8212;&#8212;- 1 &#8211; q Para ello, completar la siguiente teor\u00eda de Lean: import data.real.basic open nat variable (n : \u2115) variables (a q : \u211d) def sumaPG : \u211d \u2192 \u211d \u2192 \u2115 \u2192 \u211d | a q 0 := a | a q (n + 1) := sumaPG a q n + (a * q^(n + 1)) example : (1 &#8211; q) * sumaPG a q n = a * (1 &#8211; q^(n + 1)) := sorry [expand title=\u00bbSoluciones con Lean\u00bb] import data.real.basic open nat variable (n : \u2115) variables (a q : \u211d) set_option pp.structure_projections false @[simp] def sumaPG&#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,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[105,280],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/774"}],"collection":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/comments?post=774"}],"version-history":[{"count":3,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/774\/revisions"}],"predecessor-version":[{"id":786,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/774\/revisions\/786"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}