Find the “region of interest” of an unknown function












0












$begingroup$


Given an unknown function $f:mathbb{R} rightarrow mathbb{R}$, is it possible to find it's region of interest? By that I mean either





  1. the range in which $f$ does not converge or diverge, e.g. $f(x)=(5x)^2-x^3$

    For this function the range is approx. $[-5..20]$. I'm looking for an algorithm that can



    1.1 determine if a function diverges or converges at some point (I prefer speed over accuracy), and



    1.2 where those points are.




  2. the length of one period if the function is periodic, e.g $f(x)=sin(x)$

    For this function the length would be $2pi$. I know that a function is periodic if $f(x+c)=f(x)$ is satisfied for the entire input set. However, I need to find $c$ in a reasonable time. So I'm rather looking for an algorithm that can



    2.1 determine if a function is likely to be periodic (I prefer speed over accuracy), and



    2.2 approximate the length of that period.




Note, since this is rather a computational question, elements of $mathbb{R}$ are represented by 64bit floating point numbers. This means that (in this case) $mathbb{R}$ is finite and elements of $mathbb{R}$ have limited precision.



A more informal version



Given an unknown function, I'm trying to find the input range for which the function looks interesting if it's plotted. For example, if a function is periodic I don't want to see the period beeing plotted 10 times. Or, if the function converges I'm not interested in seeing the part where it converges to a certain value, but rather where the function is "unpredictable".



The reason behind all of this is that I'm writing a plotting library and I want to implement some sort of auto focus that automatically determines which region of a function should be plotted.










share|cite|improve this question









$endgroup$












  • $begingroup$
    "I'm looking for an algorithm that can determine if a function diverges or converges at some point". What do you mean by "a function converges"? Do you mean the limit of that function at that point? Then your first example is wrong; the limit for that function always converges everywhere on $mathbb R$.
    $endgroup$
    – YiFan
    Dec 10 '18 at 0:09


















0












$begingroup$


Given an unknown function $f:mathbb{R} rightarrow mathbb{R}$, is it possible to find it's region of interest? By that I mean either





  1. the range in which $f$ does not converge or diverge, e.g. $f(x)=(5x)^2-x^3$

    For this function the range is approx. $[-5..20]$. I'm looking for an algorithm that can



    1.1 determine if a function diverges or converges at some point (I prefer speed over accuracy), and



    1.2 where those points are.




  2. the length of one period if the function is periodic, e.g $f(x)=sin(x)$

    For this function the length would be $2pi$. I know that a function is periodic if $f(x+c)=f(x)$ is satisfied for the entire input set. However, I need to find $c$ in a reasonable time. So I'm rather looking for an algorithm that can



    2.1 determine if a function is likely to be periodic (I prefer speed over accuracy), and



    2.2 approximate the length of that period.




Note, since this is rather a computational question, elements of $mathbb{R}$ are represented by 64bit floating point numbers. This means that (in this case) $mathbb{R}$ is finite and elements of $mathbb{R}$ have limited precision.



A more informal version



Given an unknown function, I'm trying to find the input range for which the function looks interesting if it's plotted. For example, if a function is periodic I don't want to see the period beeing plotted 10 times. Or, if the function converges I'm not interested in seeing the part where it converges to a certain value, but rather where the function is "unpredictable".



The reason behind all of this is that I'm writing a plotting library and I want to implement some sort of auto focus that automatically determines which region of a function should be plotted.










share|cite|improve this question









$endgroup$












  • $begingroup$
    "I'm looking for an algorithm that can determine if a function diverges or converges at some point". What do you mean by "a function converges"? Do you mean the limit of that function at that point? Then your first example is wrong; the limit for that function always converges everywhere on $mathbb R$.
    $endgroup$
    – YiFan
    Dec 10 '18 at 0:09
















0












0








0





$begingroup$


Given an unknown function $f:mathbb{R} rightarrow mathbb{R}$, is it possible to find it's region of interest? By that I mean either





  1. the range in which $f$ does not converge or diverge, e.g. $f(x)=(5x)^2-x^3$

    For this function the range is approx. $[-5..20]$. I'm looking for an algorithm that can



    1.1 determine if a function diverges or converges at some point (I prefer speed over accuracy), and



    1.2 where those points are.




  2. the length of one period if the function is periodic, e.g $f(x)=sin(x)$

    For this function the length would be $2pi$. I know that a function is periodic if $f(x+c)=f(x)$ is satisfied for the entire input set. However, I need to find $c$ in a reasonable time. So I'm rather looking for an algorithm that can



    2.1 determine if a function is likely to be periodic (I prefer speed over accuracy), and



    2.2 approximate the length of that period.




Note, since this is rather a computational question, elements of $mathbb{R}$ are represented by 64bit floating point numbers. This means that (in this case) $mathbb{R}$ is finite and elements of $mathbb{R}$ have limited precision.



A more informal version



Given an unknown function, I'm trying to find the input range for which the function looks interesting if it's plotted. For example, if a function is periodic I don't want to see the period beeing plotted 10 times. Or, if the function converges I'm not interested in seeing the part where it converges to a certain value, but rather where the function is "unpredictable".



The reason behind all of this is that I'm writing a plotting library and I want to implement some sort of auto focus that automatically determines which region of a function should be plotted.










share|cite|improve this question









$endgroup$




Given an unknown function $f:mathbb{R} rightarrow mathbb{R}$, is it possible to find it's region of interest? By that I mean either





  1. the range in which $f$ does not converge or diverge, e.g. $f(x)=(5x)^2-x^3$

    For this function the range is approx. $[-5..20]$. I'm looking for an algorithm that can



    1.1 determine if a function diverges or converges at some point (I prefer speed over accuracy), and



    1.2 where those points are.




  2. the length of one period if the function is periodic, e.g $f(x)=sin(x)$

    For this function the length would be $2pi$. I know that a function is periodic if $f(x+c)=f(x)$ is satisfied for the entire input set. However, I need to find $c$ in a reasonable time. So I'm rather looking for an algorithm that can



    2.1 determine if a function is likely to be periodic (I prefer speed over accuracy), and



    2.2 approximate the length of that period.




Note, since this is rather a computational question, elements of $mathbb{R}$ are represented by 64bit floating point numbers. This means that (in this case) $mathbb{R}$ is finite and elements of $mathbb{R}$ have limited precision.



A more informal version



Given an unknown function, I'm trying to find the input range for which the function looks interesting if it's plotted. For example, if a function is periodic I don't want to see the period beeing plotted 10 times. Or, if the function converges I'm not interested in seeing the part where it converges to a certain value, but rather where the function is "unpredictable".



The reason behind all of this is that I'm writing a plotting library and I want to implement some sort of auto focus that automatically determines which region of a function should be plotted.







convergence computational-mathematics periodic-functions divergence






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Dec 10 '18 at 0:00









TimoTimo

1085




1085












  • $begingroup$
    "I'm looking for an algorithm that can determine if a function diverges or converges at some point". What do you mean by "a function converges"? Do you mean the limit of that function at that point? Then your first example is wrong; the limit for that function always converges everywhere on $mathbb R$.
    $endgroup$
    – YiFan
    Dec 10 '18 at 0:09




















  • $begingroup$
    "I'm looking for an algorithm that can determine if a function diverges or converges at some point". What do you mean by "a function converges"? Do you mean the limit of that function at that point? Then your first example is wrong; the limit for that function always converges everywhere on $mathbb R$.
    $endgroup$
    – YiFan
    Dec 10 '18 at 0:09


















$begingroup$
"I'm looking for an algorithm that can determine if a function diverges or converges at some point". What do you mean by "a function converges"? Do you mean the limit of that function at that point? Then your first example is wrong; the limit for that function always converges everywhere on $mathbb R$.
$endgroup$
– YiFan
Dec 10 '18 at 0:09






$begingroup$
"I'm looking for an algorithm that can determine if a function diverges or converges at some point". What do you mean by "a function converges"? Do you mean the limit of that function at that point? Then your first example is wrong; the limit for that function always converges everywhere on $mathbb R$.
$endgroup$
– YiFan
Dec 10 '18 at 0:09












1 Answer
1






active

oldest

votes


















1












$begingroup$

The Answer to your Questions depends heavily on the nature of the functions you want to plot. You can for example do a lot more with functions, where you know that they are continuous or better yet differentiable.



But ether way, you need to understand, that there can‘t be an algorithm, which can tell you with 100% certainty that the function in question is for example periodic based solely on finitely many function evaluations, even if you know that its analytic. This is due to the fact that one can construct a polynomial of degree n through any n+1 different points and corresponding values. Therefore Even if you would evaluate something like the sinus, it could always be that you just got bad luck and got those values where the function coincides with the sinus.



But since you only what to present the user with a first expression, I could imagine a number of ways how you could get a „feeling“ for the function. In all of those methods I will generally assume that the function is arbitrarily smooth/at least differentiable.



For the periodicity you could start by look at the zero points of the function. You could find those using Newtons method, or any other method you like. Then you could check whether the difference between those two is indeed a candidate for periodicity by checking the function value one (or more) periods outside of the already checked range. Then you could try to look for smaller periods by starting the newton method in the middle. Keep in mind, that this way, you might get something smaller then the Periode. You will have to check at least one nonzero function value as well... for those extremal points (which can be found quite easily with a slightly modified algorithm) are good candidates.



For the „region of interest“ I have bad news for you. There is nothing that really defines this in any mathematical way. It could be the range between the extremal points which lie furthest apart as in your example. on the other hand for functions like $x*sin(x)$ that range would be all of the Real line. Neither is that function periodic. From my perspective the area from -1 to 1 would be of the most interest.... but how would you classify that. This example rules out other criteria’s as well. For example curvature could be an indicator of how fast a function changes values, which could be a point of interest. But on the other hand a plateau in the function, or any unregularity could be of interest.



If I would be tasked with writing this algorithm I might try something like minimizing the average distance of the function from the upper and lower border of the image while at the same time maximizing the area that is on display. But that is only a guess that could work (in some cases at least. As I mentioned before, for any algorithm you write, I can construct a counter example)



I hope I was able to help you at least a little bit. Don‘t be discouraged that there is no perfect algorithm... Even though it might not be perfect, it could always be helpful.






share|cite|improve this answer









$endgroup$













    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',
    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
    },
    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%2f3033216%2ffind-the-region-of-interest-of-an-unknown-function%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









    1












    $begingroup$

    The Answer to your Questions depends heavily on the nature of the functions you want to plot. You can for example do a lot more with functions, where you know that they are continuous or better yet differentiable.



    But ether way, you need to understand, that there can‘t be an algorithm, which can tell you with 100% certainty that the function in question is for example periodic based solely on finitely many function evaluations, even if you know that its analytic. This is due to the fact that one can construct a polynomial of degree n through any n+1 different points and corresponding values. Therefore Even if you would evaluate something like the sinus, it could always be that you just got bad luck and got those values where the function coincides with the sinus.



    But since you only what to present the user with a first expression, I could imagine a number of ways how you could get a „feeling“ for the function. In all of those methods I will generally assume that the function is arbitrarily smooth/at least differentiable.



    For the periodicity you could start by look at the zero points of the function. You could find those using Newtons method, or any other method you like. Then you could check whether the difference between those two is indeed a candidate for periodicity by checking the function value one (or more) periods outside of the already checked range. Then you could try to look for smaller periods by starting the newton method in the middle. Keep in mind, that this way, you might get something smaller then the Periode. You will have to check at least one nonzero function value as well... for those extremal points (which can be found quite easily with a slightly modified algorithm) are good candidates.



    For the „region of interest“ I have bad news for you. There is nothing that really defines this in any mathematical way. It could be the range between the extremal points which lie furthest apart as in your example. on the other hand for functions like $x*sin(x)$ that range would be all of the Real line. Neither is that function periodic. From my perspective the area from -1 to 1 would be of the most interest.... but how would you classify that. This example rules out other criteria’s as well. For example curvature could be an indicator of how fast a function changes values, which could be a point of interest. But on the other hand a plateau in the function, or any unregularity could be of interest.



    If I would be tasked with writing this algorithm I might try something like minimizing the average distance of the function from the upper and lower border of the image while at the same time maximizing the area that is on display. But that is only a guess that could work (in some cases at least. As I mentioned before, for any algorithm you write, I can construct a counter example)



    I hope I was able to help you at least a little bit. Don‘t be discouraged that there is no perfect algorithm... Even though it might not be perfect, it could always be helpful.






    share|cite|improve this answer









    $endgroup$


















      1












      $begingroup$

      The Answer to your Questions depends heavily on the nature of the functions you want to plot. You can for example do a lot more with functions, where you know that they are continuous or better yet differentiable.



      But ether way, you need to understand, that there can‘t be an algorithm, which can tell you with 100% certainty that the function in question is for example periodic based solely on finitely many function evaluations, even if you know that its analytic. This is due to the fact that one can construct a polynomial of degree n through any n+1 different points and corresponding values. Therefore Even if you would evaluate something like the sinus, it could always be that you just got bad luck and got those values where the function coincides with the sinus.



      But since you only what to present the user with a first expression, I could imagine a number of ways how you could get a „feeling“ for the function. In all of those methods I will generally assume that the function is arbitrarily smooth/at least differentiable.



      For the periodicity you could start by look at the zero points of the function. You could find those using Newtons method, or any other method you like. Then you could check whether the difference between those two is indeed a candidate for periodicity by checking the function value one (or more) periods outside of the already checked range. Then you could try to look for smaller periods by starting the newton method in the middle. Keep in mind, that this way, you might get something smaller then the Periode. You will have to check at least one nonzero function value as well... for those extremal points (which can be found quite easily with a slightly modified algorithm) are good candidates.



      For the „region of interest“ I have bad news for you. There is nothing that really defines this in any mathematical way. It could be the range between the extremal points which lie furthest apart as in your example. on the other hand for functions like $x*sin(x)$ that range would be all of the Real line. Neither is that function periodic. From my perspective the area from -1 to 1 would be of the most interest.... but how would you classify that. This example rules out other criteria’s as well. For example curvature could be an indicator of how fast a function changes values, which could be a point of interest. But on the other hand a plateau in the function, or any unregularity could be of interest.



      If I would be tasked with writing this algorithm I might try something like minimizing the average distance of the function from the upper and lower border of the image while at the same time maximizing the area that is on display. But that is only a guess that could work (in some cases at least. As I mentioned before, for any algorithm you write, I can construct a counter example)



      I hope I was able to help you at least a little bit. Don‘t be discouraged that there is no perfect algorithm... Even though it might not be perfect, it could always be helpful.






      share|cite|improve this answer









      $endgroup$
















        1












        1








        1





        $begingroup$

        The Answer to your Questions depends heavily on the nature of the functions you want to plot. You can for example do a lot more with functions, where you know that they are continuous or better yet differentiable.



        But ether way, you need to understand, that there can‘t be an algorithm, which can tell you with 100% certainty that the function in question is for example periodic based solely on finitely many function evaluations, even if you know that its analytic. This is due to the fact that one can construct a polynomial of degree n through any n+1 different points and corresponding values. Therefore Even if you would evaluate something like the sinus, it could always be that you just got bad luck and got those values where the function coincides with the sinus.



        But since you only what to present the user with a first expression, I could imagine a number of ways how you could get a „feeling“ for the function. In all of those methods I will generally assume that the function is arbitrarily smooth/at least differentiable.



        For the periodicity you could start by look at the zero points of the function. You could find those using Newtons method, or any other method you like. Then you could check whether the difference between those two is indeed a candidate for periodicity by checking the function value one (or more) periods outside of the already checked range. Then you could try to look for smaller periods by starting the newton method in the middle. Keep in mind, that this way, you might get something smaller then the Periode. You will have to check at least one nonzero function value as well... for those extremal points (which can be found quite easily with a slightly modified algorithm) are good candidates.



        For the „region of interest“ I have bad news for you. There is nothing that really defines this in any mathematical way. It could be the range between the extremal points which lie furthest apart as in your example. on the other hand for functions like $x*sin(x)$ that range would be all of the Real line. Neither is that function periodic. From my perspective the area from -1 to 1 would be of the most interest.... but how would you classify that. This example rules out other criteria’s as well. For example curvature could be an indicator of how fast a function changes values, which could be a point of interest. But on the other hand a plateau in the function, or any unregularity could be of interest.



        If I would be tasked with writing this algorithm I might try something like minimizing the average distance of the function from the upper and lower border of the image while at the same time maximizing the area that is on display. But that is only a guess that could work (in some cases at least. As I mentioned before, for any algorithm you write, I can construct a counter example)



        I hope I was able to help you at least a little bit. Don‘t be discouraged that there is no perfect algorithm... Even though it might not be perfect, it could always be helpful.






        share|cite|improve this answer









        $endgroup$



        The Answer to your Questions depends heavily on the nature of the functions you want to plot. You can for example do a lot more with functions, where you know that they are continuous or better yet differentiable.



        But ether way, you need to understand, that there can‘t be an algorithm, which can tell you with 100% certainty that the function in question is for example periodic based solely on finitely many function evaluations, even if you know that its analytic. This is due to the fact that one can construct a polynomial of degree n through any n+1 different points and corresponding values. Therefore Even if you would evaluate something like the sinus, it could always be that you just got bad luck and got those values where the function coincides with the sinus.



        But since you only what to present the user with a first expression, I could imagine a number of ways how you could get a „feeling“ for the function. In all of those methods I will generally assume that the function is arbitrarily smooth/at least differentiable.



        For the periodicity you could start by look at the zero points of the function. You could find those using Newtons method, or any other method you like. Then you could check whether the difference between those two is indeed a candidate for periodicity by checking the function value one (or more) periods outside of the already checked range. Then you could try to look for smaller periods by starting the newton method in the middle. Keep in mind, that this way, you might get something smaller then the Periode. You will have to check at least one nonzero function value as well... for those extremal points (which can be found quite easily with a slightly modified algorithm) are good candidates.



        For the „region of interest“ I have bad news for you. There is nothing that really defines this in any mathematical way. It could be the range between the extremal points which lie furthest apart as in your example. on the other hand for functions like $x*sin(x)$ that range would be all of the Real line. Neither is that function periodic. From my perspective the area from -1 to 1 would be of the most interest.... but how would you classify that. This example rules out other criteria’s as well. For example curvature could be an indicator of how fast a function changes values, which could be a point of interest. But on the other hand a plateau in the function, or any unregularity could be of interest.



        If I would be tasked with writing this algorithm I might try something like minimizing the average distance of the function from the upper and lower border of the image while at the same time maximizing the area that is on display. But that is only a guess that could work (in some cases at least. As I mentioned before, for any algorithm you write, I can construct a counter example)



        I hope I was able to help you at least a little bit. Don‘t be discouraged that there is no perfect algorithm... Even though it might not be perfect, it could always be helpful.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Dec 10 '18 at 0:45









        BörgeBörge

        1,047415




        1,047415






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • 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.


            Use MathJax to format equations. MathJax reference.


            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%2fmath.stackexchange.com%2fquestions%2f3033216%2ffind-the-region-of-interest-of-an-unknown-function%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

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?