In mpmath, what exactly does the maxdegree argument do?












0















A newbie here so please be gentle!



I'm using mpmath.quad to calculate a large number of integrals that are then being placed into a matrix for further calculation. My problem is that the integrands are oscillatory so the default degree of accuracy (maxdegree = 6) set by mpmath isn't enough to converge to an answer with a sensible level of error. I've upped the value of maxdegree to 25 and unless I use very oscillatory integrands then this solves the problem.



My question is: what exactly is this parameter doing? Obviously it's utilising more iterations of whatever algorithm it uses to solve the integral, but if for example I were to set it to maxdegree=1000, should I expect it to reach some kind of limit to the accuracy, or to carry out 1000 iterations for each integral?



This is probably better explained by asking, if I have an integral and the answer at iteration 10 is 1.09758354e-10 with an error of 2e-13, will the algorithm keep going until it hits floating point accuracy and then give up, or just keep calculating another 990 iterations that essentially change nothing?



Thanks! :)










share|improve this question





























    0















    A newbie here so please be gentle!



    I'm using mpmath.quad to calculate a large number of integrals that are then being placed into a matrix for further calculation. My problem is that the integrands are oscillatory so the default degree of accuracy (maxdegree = 6) set by mpmath isn't enough to converge to an answer with a sensible level of error. I've upped the value of maxdegree to 25 and unless I use very oscillatory integrands then this solves the problem.



    My question is: what exactly is this parameter doing? Obviously it's utilising more iterations of whatever algorithm it uses to solve the integral, but if for example I were to set it to maxdegree=1000, should I expect it to reach some kind of limit to the accuracy, or to carry out 1000 iterations for each integral?



    This is probably better explained by asking, if I have an integral and the answer at iteration 10 is 1.09758354e-10 with an error of 2e-13, will the algorithm keep going until it hits floating point accuracy and then give up, or just keep calculating another 990 iterations that essentially change nothing?



    Thanks! :)










    share|improve this question



























      0












      0








      0








      A newbie here so please be gentle!



      I'm using mpmath.quad to calculate a large number of integrals that are then being placed into a matrix for further calculation. My problem is that the integrands are oscillatory so the default degree of accuracy (maxdegree = 6) set by mpmath isn't enough to converge to an answer with a sensible level of error. I've upped the value of maxdegree to 25 and unless I use very oscillatory integrands then this solves the problem.



      My question is: what exactly is this parameter doing? Obviously it's utilising more iterations of whatever algorithm it uses to solve the integral, but if for example I were to set it to maxdegree=1000, should I expect it to reach some kind of limit to the accuracy, or to carry out 1000 iterations for each integral?



      This is probably better explained by asking, if I have an integral and the answer at iteration 10 is 1.09758354e-10 with an error of 2e-13, will the algorithm keep going until it hits floating point accuracy and then give up, or just keep calculating another 990 iterations that essentially change nothing?



      Thanks! :)










      share|improve this question
















      A newbie here so please be gentle!



      I'm using mpmath.quad to calculate a large number of integrals that are then being placed into a matrix for further calculation. My problem is that the integrands are oscillatory so the default degree of accuracy (maxdegree = 6) set by mpmath isn't enough to converge to an answer with a sensible level of error. I've upped the value of maxdegree to 25 and unless I use very oscillatory integrands then this solves the problem.



      My question is: what exactly is this parameter doing? Obviously it's utilising more iterations of whatever algorithm it uses to solve the integral, but if for example I were to set it to maxdegree=1000, should I expect it to reach some kind of limit to the accuracy, or to carry out 1000 iterations for each integral?



      This is probably better explained by asking, if I have an integral and the answer at iteration 10 is 1.09758354e-10 with an error of 2e-13, will the algorithm keep going until it hits floating point accuracy and then give up, or just keep calculating another 990 iterations that essentially change nothing?



      Thanks! :)







      python python-3.x spyder mpmath






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 11:32









      TrebuchetMS

      2,62811023




      2,62811023










      asked Nov 26 '18 at 10:48









      Chris WhiteChris White

      11




      11
























          0






          active

          oldest

          votes











          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%2f53479482%2fin-mpmath-what-exactly-does-the-maxdegree-argument-do%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f53479482%2fin-mpmath-what-exactly-does-the-maxdegree-argument-do%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

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)