Why summation and integrate give different results? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!What is the difference between @staticmethod and @classmethod?What is the difference between Python's list methods append and extend?Python join: why is it string.join(list) instead of list.join(string)?Difference between __str__ and __repr__?Why does comparing strings using either '==' or 'is' sometimes produce a different result?What's the difference between eval, exec, and compile?Use of *args and **kwargsWhy is reading lines from stdin much slower in C++ than Python?UnicodeEncodeError: 'ascii' codec can't encode character u'xa0' in position 20: ordinal not in range(128)Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?

How long can a nation maintain a technological edge over the rest of the world?

Why aren't road bicycle wheels tiny?

Can gravitational waves pass through a black hole?

Does Prince Arnaud cause someone holding the Princess to lose?

Why does Java have support for time zone offsets with seconds precision?

Does a Draconic Bloodline sorcerer's doubled proficiency bonus for Charisma checks against dragons apply to all dragon types or only the chosen one?

All ASCII characters with a given bit count

Why isPrototypeOf() returns false?

Arriving in Atlanta after US Preclearance in Dublin. Will I go through TSA security in Atlanta to transfer to a connecting flight?

What's parked in Mil Moscow helicopter plant?

Was there ever a LEGO store in Miami International Airport?

Why did Israel vote against lifting the American embargo on Cuba?

Are these square matrices always diagonalisable?

/bin/ls sorts differently than just ls

Are there existing rules/lore for MTG planeswalkers?

Israeli soda type drink

"Working on a knee"

Bright yellow or light yellow?

Array Dynamic resize in heap

Raising a bilingual kid. When should we introduce the majority language?

What is ls Largest Number Formed by only moving two sticks in 508?

What is a 'Key' in computer science?

Why did Europeans not widely domesticate foxes?

Has a Nobel Peace laureate ever been accused of war crimes?



Why summation and integrate give different results?



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!What is the difference between @staticmethod and @classmethod?What is the difference between Python's list methods append and extend?Python join: why is it string.join(list) instead of list.join(string)?Difference between __str__ and __repr__?Why does comparing strings using either '==' or 'is' sometimes produce a different result?What's the difference between eval, exec, and compile?Use of *args and **kwargsWhy is reading lines from stdin much slower in C++ than Python?UnicodeEncodeError: 'ascii' codec can't encode character u'xa0' in position 20: ordinal not in range(128)Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I think I am misunderstanding something. I think that printed results of this code snippet must be equal, but they are not:



import sympy
x = sympy.Symbol('x')
summation = sympy.summation(sympy.exp(-x), (x, 0, sympy.oo))
print(summation) # 1/(-exp(-1) + 1)
integration = sympy.integrate(sympy.exp(-x), (x, 0, sympy.oo))
print(integration) # 1


Can you explain the difference between summation and integrate?










share|improve this question




























    1















    I think I am misunderstanding something. I think that printed results of this code snippet must be equal, but they are not:



    import sympy
    x = sympy.Symbol('x')
    summation = sympy.summation(sympy.exp(-x), (x, 0, sympy.oo))
    print(summation) # 1/(-exp(-1) + 1)
    integration = sympy.integrate(sympy.exp(-x), (x, 0, sympy.oo))
    print(integration) # 1


    Can you explain the difference between summation and integrate?










    share|improve this question
























      1












      1








      1








      I think I am misunderstanding something. I think that printed results of this code snippet must be equal, but they are not:



      import sympy
      x = sympy.Symbol('x')
      summation = sympy.summation(sympy.exp(-x), (x, 0, sympy.oo))
      print(summation) # 1/(-exp(-1) + 1)
      integration = sympy.integrate(sympy.exp(-x), (x, 0, sympy.oo))
      print(integration) # 1


      Can you explain the difference between summation and integrate?










      share|improve this question














      I think I am misunderstanding something. I think that printed results of this code snippet must be equal, but they are not:



      import sympy
      x = sympy.Symbol('x')
      summation = sympy.summation(sympy.exp(-x), (x, 0, sympy.oo))
      print(summation) # 1/(-exp(-1) + 1)
      integration = sympy.integrate(sympy.exp(-x), (x, 0, sympy.oo))
      print(integration) # 1


      Can you explain the difference between summation and integrate?







      python sympy






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 15:07









      SanyashSanyash

      2,96821229




      2,96821229






















          2 Answers
          2






          active

          oldest

          votes


















          2














          SymPy's summation function sums the expression with the integers in the given range replacing the variable:



          summation(sympy.exp(-x), (x, 0, sympy.oo))


          Is equivalent to



          exp(0) + exp(-1) + exp(-2) + ...


          Which is approximately equal to:



          1 + 0.37 + 0.14 + ...


          Integration is a different function, which can be interpreted as calculating the area bounded by the curve generated by the function and the x axis (shaded in orange here):



          enter image description here






          share|improve this answer

























          • Oh, I forgot that summation goes over integers only... Thank you.

            – Sanyash
            Mar 22 at 15:27


















          2














          Nothing wrong.



          If you notice the summation is a sum of geometric sequence, you will find it to be different to integration.



          Summation:



          sum exp(-x)
          = sum exp(-1)^x
          = exp(-1)^0 / (1 - exp(-1))
          = 1 / (1 - exp(-1))


          Integration:



          int exp(-x) dx
          = - [ exp(-x) ]
          = - [ exp(-infinity) - exp(0) ]
          = - [ 0 - 1 ]
          = 1


          Sorry. StackOverflow do not do LaTeX.






          share|improve this answer

























          • Hmmm, I don't know what is sum of geometric sequence, can you explain this?

            – Sanyash
            Mar 22 at 15:13











          • added algebraic derivation

            – adrtam
            Mar 22 at 15:14











          • Still can't understand the part where you describe summation derivation... Why sum exp(-1)^x turns to exp(-1)^0 / (1 - exp(-1))?

            – Sanyash
            Mar 22 at 15:22











          • en.wikipedia.org/wiki/Geometric_series formula section, the paragraph starts with "As n goes to infinity"

            – adrtam
            Mar 22 at 15:27











          • Thank you very much for explanation. Hope you don't worry about accepting another answer, because it points for the root of the problem: I forgot that summation goes over integers only, that's why I thought the results must be equal.

            – Sanyash
            Mar 22 at 15:31











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55302579%2fwhy-summation-and-integrate-give-different-results%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          SymPy's summation function sums the expression with the integers in the given range replacing the variable:



          summation(sympy.exp(-x), (x, 0, sympy.oo))


          Is equivalent to



          exp(0) + exp(-1) + exp(-2) + ...


          Which is approximately equal to:



          1 + 0.37 + 0.14 + ...


          Integration is a different function, which can be interpreted as calculating the area bounded by the curve generated by the function and the x axis (shaded in orange here):



          enter image description here






          share|improve this answer

























          • Oh, I forgot that summation goes over integers only... Thank you.

            – Sanyash
            Mar 22 at 15:27















          2














          SymPy's summation function sums the expression with the integers in the given range replacing the variable:



          summation(sympy.exp(-x), (x, 0, sympy.oo))


          Is equivalent to



          exp(0) + exp(-1) + exp(-2) + ...


          Which is approximately equal to:



          1 + 0.37 + 0.14 + ...


          Integration is a different function, which can be interpreted as calculating the area bounded by the curve generated by the function and the x axis (shaded in orange here):



          enter image description here






          share|improve this answer

























          • Oh, I forgot that summation goes over integers only... Thank you.

            – Sanyash
            Mar 22 at 15:27













          2












          2








          2







          SymPy's summation function sums the expression with the integers in the given range replacing the variable:



          summation(sympy.exp(-x), (x, 0, sympy.oo))


          Is equivalent to



          exp(0) + exp(-1) + exp(-2) + ...


          Which is approximately equal to:



          1 + 0.37 + 0.14 + ...


          Integration is a different function, which can be interpreted as calculating the area bounded by the curve generated by the function and the x axis (shaded in orange here):



          enter image description here






          share|improve this answer















          SymPy's summation function sums the expression with the integers in the given range replacing the variable:



          summation(sympy.exp(-x), (x, 0, sympy.oo))


          Is equivalent to



          exp(0) + exp(-1) + exp(-2) + ...


          Which is approximately equal to:



          1 + 0.37 + 0.14 + ...


          Integration is a different function, which can be interpreted as calculating the area bounded by the curve generated by the function and the x axis (shaded in orange here):



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 22 at 15:27

























          answered Mar 22 at 15:24









          ukemiukemi

          3,2303728




          3,2303728












          • Oh, I forgot that summation goes over integers only... Thank you.

            – Sanyash
            Mar 22 at 15:27

















          • Oh, I forgot that summation goes over integers only... Thank you.

            – Sanyash
            Mar 22 at 15:27
















          Oh, I forgot that summation goes over integers only... Thank you.

          – Sanyash
          Mar 22 at 15:27





          Oh, I forgot that summation goes over integers only... Thank you.

          – Sanyash
          Mar 22 at 15:27













          2














          Nothing wrong.



          If you notice the summation is a sum of geometric sequence, you will find it to be different to integration.



          Summation:



          sum exp(-x)
          = sum exp(-1)^x
          = exp(-1)^0 / (1 - exp(-1))
          = 1 / (1 - exp(-1))


          Integration:



          int exp(-x) dx
          = - [ exp(-x) ]
          = - [ exp(-infinity) - exp(0) ]
          = - [ 0 - 1 ]
          = 1


          Sorry. StackOverflow do not do LaTeX.






          share|improve this answer

























          • Hmmm, I don't know what is sum of geometric sequence, can you explain this?

            – Sanyash
            Mar 22 at 15:13











          • added algebraic derivation

            – adrtam
            Mar 22 at 15:14











          • Still can't understand the part where you describe summation derivation... Why sum exp(-1)^x turns to exp(-1)^0 / (1 - exp(-1))?

            – Sanyash
            Mar 22 at 15:22











          • en.wikipedia.org/wiki/Geometric_series formula section, the paragraph starts with "As n goes to infinity"

            – adrtam
            Mar 22 at 15:27











          • Thank you very much for explanation. Hope you don't worry about accepting another answer, because it points for the root of the problem: I forgot that summation goes over integers only, that's why I thought the results must be equal.

            – Sanyash
            Mar 22 at 15:31















          2














          Nothing wrong.



          If you notice the summation is a sum of geometric sequence, you will find it to be different to integration.



          Summation:



          sum exp(-x)
          = sum exp(-1)^x
          = exp(-1)^0 / (1 - exp(-1))
          = 1 / (1 - exp(-1))


          Integration:



          int exp(-x) dx
          = - [ exp(-x) ]
          = - [ exp(-infinity) - exp(0) ]
          = - [ 0 - 1 ]
          = 1


          Sorry. StackOverflow do not do LaTeX.






          share|improve this answer

























          • Hmmm, I don't know what is sum of geometric sequence, can you explain this?

            – Sanyash
            Mar 22 at 15:13











          • added algebraic derivation

            – adrtam
            Mar 22 at 15:14











          • Still can't understand the part where you describe summation derivation... Why sum exp(-1)^x turns to exp(-1)^0 / (1 - exp(-1))?

            – Sanyash
            Mar 22 at 15:22











          • en.wikipedia.org/wiki/Geometric_series formula section, the paragraph starts with "As n goes to infinity"

            – adrtam
            Mar 22 at 15:27











          • Thank you very much for explanation. Hope you don't worry about accepting another answer, because it points for the root of the problem: I forgot that summation goes over integers only, that's why I thought the results must be equal.

            – Sanyash
            Mar 22 at 15:31













          2












          2








          2







          Nothing wrong.



          If you notice the summation is a sum of geometric sequence, you will find it to be different to integration.



          Summation:



          sum exp(-x)
          = sum exp(-1)^x
          = exp(-1)^0 / (1 - exp(-1))
          = 1 / (1 - exp(-1))


          Integration:



          int exp(-x) dx
          = - [ exp(-x) ]
          = - [ exp(-infinity) - exp(0) ]
          = - [ 0 - 1 ]
          = 1


          Sorry. StackOverflow do not do LaTeX.






          share|improve this answer















          Nothing wrong.



          If you notice the summation is a sum of geometric sequence, you will find it to be different to integration.



          Summation:



          sum exp(-x)
          = sum exp(-1)^x
          = exp(-1)^0 / (1 - exp(-1))
          = 1 / (1 - exp(-1))


          Integration:



          int exp(-x) dx
          = - [ exp(-x) ]
          = - [ exp(-infinity) - exp(0) ]
          = - [ 0 - 1 ]
          = 1


          Sorry. StackOverflow do not do LaTeX.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 22 at 15:13

























          answered Mar 22 at 15:11









          adrtamadrtam

          3,4601321




          3,4601321












          • Hmmm, I don't know what is sum of geometric sequence, can you explain this?

            – Sanyash
            Mar 22 at 15:13











          • added algebraic derivation

            – adrtam
            Mar 22 at 15:14











          • Still can't understand the part where you describe summation derivation... Why sum exp(-1)^x turns to exp(-1)^0 / (1 - exp(-1))?

            – Sanyash
            Mar 22 at 15:22











          • en.wikipedia.org/wiki/Geometric_series formula section, the paragraph starts with "As n goes to infinity"

            – adrtam
            Mar 22 at 15:27











          • Thank you very much for explanation. Hope you don't worry about accepting another answer, because it points for the root of the problem: I forgot that summation goes over integers only, that's why I thought the results must be equal.

            – Sanyash
            Mar 22 at 15:31

















          • Hmmm, I don't know what is sum of geometric sequence, can you explain this?

            – Sanyash
            Mar 22 at 15:13











          • added algebraic derivation

            – adrtam
            Mar 22 at 15:14











          • Still can't understand the part where you describe summation derivation... Why sum exp(-1)^x turns to exp(-1)^0 / (1 - exp(-1))?

            – Sanyash
            Mar 22 at 15:22











          • en.wikipedia.org/wiki/Geometric_series formula section, the paragraph starts with "As n goes to infinity"

            – adrtam
            Mar 22 at 15:27











          • Thank you very much for explanation. Hope you don't worry about accepting another answer, because it points for the root of the problem: I forgot that summation goes over integers only, that's why I thought the results must be equal.

            – Sanyash
            Mar 22 at 15:31
















          Hmmm, I don't know what is sum of geometric sequence, can you explain this?

          – Sanyash
          Mar 22 at 15:13





          Hmmm, I don't know what is sum of geometric sequence, can you explain this?

          – Sanyash
          Mar 22 at 15:13













          added algebraic derivation

          – adrtam
          Mar 22 at 15:14





          added algebraic derivation

          – adrtam
          Mar 22 at 15:14













          Still can't understand the part where you describe summation derivation... Why sum exp(-1)^x turns to exp(-1)^0 / (1 - exp(-1))?

          – Sanyash
          Mar 22 at 15:22





          Still can't understand the part where you describe summation derivation... Why sum exp(-1)^x turns to exp(-1)^0 / (1 - exp(-1))?

          – Sanyash
          Mar 22 at 15:22













          en.wikipedia.org/wiki/Geometric_series formula section, the paragraph starts with "As n goes to infinity"

          – adrtam
          Mar 22 at 15:27





          en.wikipedia.org/wiki/Geometric_series formula section, the paragraph starts with "As n goes to infinity"

          – adrtam
          Mar 22 at 15:27













          Thank you very much for explanation. Hope you don't worry about accepting another answer, because it points for the root of the problem: I forgot that summation goes over integers only, that's why I thought the results must be equal.

          – Sanyash
          Mar 22 at 15:31





          Thank you very much for explanation. Hope you don't worry about accepting another answer, because it points for the root of the problem: I forgot that summation goes over integers only, that's why I thought the results must be equal.

          – Sanyash
          Mar 22 at 15:31

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55302579%2fwhy-summation-and-integrate-give-different-results%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현