How does Mathematica determine when to use scientific notation?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












I have code that takes an initial guess for a set of parameters to use in a function that I want to minimize, calculates the function, prints the value, recalculates new parameters via the gradient descent method, recalculates the function, prints it, and so on.



This is what my output looks like:



enter image description here



I don't mind it, I'm just curious as to when Mathematica decides it should use scientific notation and when it thinks regular notation is fine. At first sight, it seems random.



MWE not necessary because this is not a question related to code.



Edit: Sorry for the huge image. I've replaced it with a smaller one.










share|improve this question



















  • 1




    You can use NumberForm with its ScientificNotationThreshold setting if you want more control.
    – J. M. is somewhat okay.♦
    3 hours ago










  • I know I can. As I said, I don't mind which notation Mathematica uses for this; I'm just curious as to how it determines which one to use.
    – Rain
    3 hours ago






  • 1




    I don't have your numbers, so I can only hazard a guess that it's about precision differences. See e.g. 97170., 97170.`5, 97170.`4.
    – J. M. is somewhat okay.♦
    3 hours ago











  • I suspect the message formatting is using the same thresholds as NumberForm.
    – Daniel Lichtblau
    2 hours ago














up vote
4
down vote

favorite












I have code that takes an initial guess for a set of parameters to use in a function that I want to minimize, calculates the function, prints the value, recalculates new parameters via the gradient descent method, recalculates the function, prints it, and so on.



This is what my output looks like:



enter image description here



I don't mind it, I'm just curious as to when Mathematica decides it should use scientific notation and when it thinks regular notation is fine. At first sight, it seems random.



MWE not necessary because this is not a question related to code.



Edit: Sorry for the huge image. I've replaced it with a smaller one.










share|improve this question



















  • 1




    You can use NumberForm with its ScientificNotationThreshold setting if you want more control.
    – J. M. is somewhat okay.♦
    3 hours ago










  • I know I can. As I said, I don't mind which notation Mathematica uses for this; I'm just curious as to how it determines which one to use.
    – Rain
    3 hours ago






  • 1




    I don't have your numbers, so I can only hazard a guess that it's about precision differences. See e.g. 97170., 97170.`5, 97170.`4.
    – J. M. is somewhat okay.♦
    3 hours ago











  • I suspect the message formatting is using the same thresholds as NumberForm.
    – Daniel Lichtblau
    2 hours ago












up vote
4
down vote

favorite









up vote
4
down vote

favorite











I have code that takes an initial guess for a set of parameters to use in a function that I want to minimize, calculates the function, prints the value, recalculates new parameters via the gradient descent method, recalculates the function, prints it, and so on.



This is what my output looks like:



enter image description here



I don't mind it, I'm just curious as to when Mathematica decides it should use scientific notation and when it thinks regular notation is fine. At first sight, it seems random.



MWE not necessary because this is not a question related to code.



Edit: Sorry for the huge image. I've replaced it with a smaller one.










share|improve this question















I have code that takes an initial guess for a set of parameters to use in a function that I want to minimize, calculates the function, prints the value, recalculates new parameters via the gradient descent method, recalculates the function, prints it, and so on.



This is what my output looks like:



enter image description here



I don't mind it, I'm just curious as to when Mathematica decides it should use scientific notation and when it thinks regular notation is fine. At first sight, it seems random.



MWE not necessary because this is not a question related to code.



Edit: Sorry for the huge image. I've replaced it with a smaller one.







output-formatting precision notation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 50 mins ago









Carl Woll

58.8k276150




58.8k276150










asked 3 hours ago









Rain

301110




301110







  • 1




    You can use NumberForm with its ScientificNotationThreshold setting if you want more control.
    – J. M. is somewhat okay.♦
    3 hours ago










  • I know I can. As I said, I don't mind which notation Mathematica uses for this; I'm just curious as to how it determines which one to use.
    – Rain
    3 hours ago






  • 1




    I don't have your numbers, so I can only hazard a guess that it's about precision differences. See e.g. 97170., 97170.`5, 97170.`4.
    – J. M. is somewhat okay.♦
    3 hours ago











  • I suspect the message formatting is using the same thresholds as NumberForm.
    – Daniel Lichtblau
    2 hours ago












  • 1




    You can use NumberForm with its ScientificNotationThreshold setting if you want more control.
    – J. M. is somewhat okay.♦
    3 hours ago










  • I know I can. As I said, I don't mind which notation Mathematica uses for this; I'm just curious as to how it determines which one to use.
    – Rain
    3 hours ago






  • 1




    I don't have your numbers, so I can only hazard a guess that it's about precision differences. See e.g. 97170., 97170.`5, 97170.`4.
    – J. M. is somewhat okay.♦
    3 hours ago











  • I suspect the message formatting is using the same thresholds as NumberForm.
    – Daniel Lichtblau
    2 hours ago







1




1




You can use NumberForm with its ScientificNotationThreshold setting if you want more control.
– J. M. is somewhat okay.♦
3 hours ago




You can use NumberForm with its ScientificNotationThreshold setting if you want more control.
– J. M. is somewhat okay.♦
3 hours ago












I know I can. As I said, I don't mind which notation Mathematica uses for this; I'm just curious as to how it determines which one to use.
– Rain
3 hours ago




I know I can. As I said, I don't mind which notation Mathematica uses for this; I'm just curious as to how it determines which one to use.
– Rain
3 hours ago




1




1




I don't have your numbers, so I can only hazard a guess that it's about precision differences. See e.g. 97170., 97170.`5, 97170.`4.
– J. M. is somewhat okay.♦
3 hours ago





I don't have your numbers, so I can only hazard a guess that it's about precision differences. See e.g. 97170., 97170.`5, 97170.`4.
– J. M. is somewhat okay.♦
3 hours ago













I suspect the message formatting is using the same thresholds as NumberForm.
– Daniel Lichtblau
2 hours ago




I suspect the message formatting is using the same thresholds as NumberForm.
– Daniel Lichtblau
2 hours ago










1 Answer
1






active

oldest

votes

















up vote
6
down vote













Mathematica uses 2 criteria to determine whether to show a number in scientific notation or not.




  1. For both arbitrary precision and machine precision numbers, use scientific notation if the exponent is not between 5 and -5 inclusive:



    123456.
    1234567.



    123456.



    1.23457*10^6




    and:



    1.23456*^-5
    1.23456*^-6



    0.0000123456



    1.23456*10^-6





  2. For arbitrary precision numbers, use scientific notation if the number of digits displayed is more than the precision:



    123400`4
    123400`5
    123400`6



    1.234*10^5



    1.2340*10^5



    123400.








share|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: "387"
    ;
    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: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182705%2fhow-does-mathematica-determine-when-to-use-scientific-notation%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    6
    down vote













    Mathematica uses 2 criteria to determine whether to show a number in scientific notation or not.




    1. For both arbitrary precision and machine precision numbers, use scientific notation if the exponent is not between 5 and -5 inclusive:



      123456.
      1234567.



      123456.



      1.23457*10^6




      and:



      1.23456*^-5
      1.23456*^-6



      0.0000123456



      1.23456*10^-6





    2. For arbitrary precision numbers, use scientific notation if the number of digits displayed is more than the precision:



      123400`4
      123400`5
      123400`6



      1.234*10^5



      1.2340*10^5



      123400.








    share|improve this answer


























      up vote
      6
      down vote













      Mathematica uses 2 criteria to determine whether to show a number in scientific notation or not.




      1. For both arbitrary precision and machine precision numbers, use scientific notation if the exponent is not between 5 and -5 inclusive:



        123456.
        1234567.



        123456.



        1.23457*10^6




        and:



        1.23456*^-5
        1.23456*^-6



        0.0000123456



        1.23456*10^-6





      2. For arbitrary precision numbers, use scientific notation if the number of digits displayed is more than the precision:



        123400`4
        123400`5
        123400`6



        1.234*10^5



        1.2340*10^5



        123400.








      share|improve this answer
























        up vote
        6
        down vote










        up vote
        6
        down vote









        Mathematica uses 2 criteria to determine whether to show a number in scientific notation or not.




        1. For both arbitrary precision and machine precision numbers, use scientific notation if the exponent is not between 5 and -5 inclusive:



          123456.
          1234567.



          123456.



          1.23457*10^6




          and:



          1.23456*^-5
          1.23456*^-6



          0.0000123456



          1.23456*10^-6





        2. For arbitrary precision numbers, use scientific notation if the number of digits displayed is more than the precision:



          123400`4
          123400`5
          123400`6



          1.234*10^5



          1.2340*10^5



          123400.








        share|improve this answer














        Mathematica uses 2 criteria to determine whether to show a number in scientific notation or not.




        1. For both arbitrary precision and machine precision numbers, use scientific notation if the exponent is not between 5 and -5 inclusive:



          123456.
          1234567.



          123456.



          1.23457*10^6




          and:



          1.23456*^-5
          1.23456*^-6



          0.0000123456



          1.23456*10^-6





        2. For arbitrary precision numbers, use scientific notation if the number of digits displayed is more than the precision:



          123400`4
          123400`5
          123400`6



          1.234*10^5



          1.2340*10^5



          123400.









        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 1 hour ago









        xzczd

        24.3k466232




        24.3k466232










        answered 1 hour ago









        Carl Woll

        58.8k276150




        58.8k276150



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182705%2fhow-does-mathematica-determine-when-to-use-scientific-notation%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery