Complex integral using matlab











up vote
0
down vote

favorite












Let $f(s)$ be a function. I would like to compute the following integral using Matlab



$$
I=int_{c-iinfty}^{c+iinfty}f(s)s^{-s}ds.
$$



How can we use Matlab to evaluate this integral.
Is the following notation convenient :



syms s x
int(f,x,c-iinfty+c,c+iinfty) ?


Thanks










share|cite|improve this question




























    up vote
    0
    down vote

    favorite












    Let $f(s)$ be a function. I would like to compute the following integral using Matlab



    $$
    I=int_{c-iinfty}^{c+iinfty}f(s)s^{-s}ds.
    $$



    How can we use Matlab to evaluate this integral.
    Is the following notation convenient :



    syms s x
    int(f,x,c-iinfty+c,c+iinfty) ?


    Thanks










    share|cite|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Let $f(s)$ be a function. I would like to compute the following integral using Matlab



      $$
      I=int_{c-iinfty}^{c+iinfty}f(s)s^{-s}ds.
      $$



      How can we use Matlab to evaluate this integral.
      Is the following notation convenient :



      syms s x
      int(f,x,c-iinfty+c,c+iinfty) ?


      Thanks










      share|cite|improve this question















      Let $f(s)$ be a function. I would like to compute the following integral using Matlab



      $$
      I=int_{c-iinfty}^{c+iinfty}f(s)s^{-s}ds.
      $$



      How can we use Matlab to evaluate this integral.
      Is the following notation convenient :



      syms s x
      int(f,x,c-iinfty+c,c+iinfty) ?


      Thanks







      matlab






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Nov 16 at 11:01









      Jean Marie

      28.1k41848




      28.1k41848










      asked Sep 30 at 15:39









      Monir

      116




      116






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          You aren't allowed to use $infty$ (which is "inf" with Matlab) in such a case.



          You have to replace it by a large enough number.



          Here is the right way to do it, through an example (which is in fact classical)



          clear all;close all;format long
          a=rand;
          f=@(z)(exp(z.^2));
          I=integral(f,a-i*1000,a+i*1000)
          J=i*sqrt(pi)
          % theoretical result : I = J whatever the value of a
          % practical result : I and J coincide up to the 15th decimal place !





          share|cite|improve this answer























            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "69"
            };
            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',
            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
            },
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2936804%2fcomplex-integral-using-matlab%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            You aren't allowed to use $infty$ (which is "inf" with Matlab) in such a case.



            You have to replace it by a large enough number.



            Here is the right way to do it, through an example (which is in fact classical)



            clear all;close all;format long
            a=rand;
            f=@(z)(exp(z.^2));
            I=integral(f,a-i*1000,a+i*1000)
            J=i*sqrt(pi)
            % theoretical result : I = J whatever the value of a
            % practical result : I and J coincide up to the 15th decimal place !





            share|cite|improve this answer



























              up vote
              0
              down vote













              You aren't allowed to use $infty$ (which is "inf" with Matlab) in such a case.



              You have to replace it by a large enough number.



              Here is the right way to do it, through an example (which is in fact classical)



              clear all;close all;format long
              a=rand;
              f=@(z)(exp(z.^2));
              I=integral(f,a-i*1000,a+i*1000)
              J=i*sqrt(pi)
              % theoretical result : I = J whatever the value of a
              % practical result : I and J coincide up to the 15th decimal place !





              share|cite|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                You aren't allowed to use $infty$ (which is "inf" with Matlab) in such a case.



                You have to replace it by a large enough number.



                Here is the right way to do it, through an example (which is in fact classical)



                clear all;close all;format long
                a=rand;
                f=@(z)(exp(z.^2));
                I=integral(f,a-i*1000,a+i*1000)
                J=i*sqrt(pi)
                % theoretical result : I = J whatever the value of a
                % practical result : I and J coincide up to the 15th decimal place !





                share|cite|improve this answer














                You aren't allowed to use $infty$ (which is "inf" with Matlab) in such a case.



                You have to replace it by a large enough number.



                Here is the right way to do it, through an example (which is in fact classical)



                clear all;close all;format long
                a=rand;
                f=@(z)(exp(z.^2));
                I=integral(f,a-i*1000,a+i*1000)
                J=i*sqrt(pi)
                % theoretical result : I = J whatever the value of a
                % practical result : I and J coincide up to the 15th decimal place !






                share|cite|improve this answer














                share|cite|improve this answer



                share|cite|improve this answer








                edited Nov 16 at 23:11

























                answered Nov 16 at 11:22









                Jean Marie

                28.1k41848




                28.1k41848






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2936804%2fcomplex-integral-using-matlab%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

                    Ellipse (mathématiques)

                    Quarter-circle Tiles

                    Mont Emei