Compare fractions a/b and b/a












0












$begingroup$


I'm trying to implement a mathematical method for calculation of injustice. The formula depends on two variables $a>=1$ and $b>=1$ and returns a fraction $a/b$.



$a/b=1$ indicates justice. If $a/b<1$ the injustice is to your advantage. If $a/b>1$ the injustice is to your disadvantage.



Now I would like to set aside advantage/disadvantage and only calculate the size of the injustice. I'm having trouble figuring out an easy way to get the same result for $a/b$ as $b/a$.



Anyone have any idea of how I can do this?










share|cite|improve this question









$endgroup$








  • 2




    $begingroup$
    Not entirely sure what you are trying to do, but $Fleft(frac abright)=|log frac ab|=|log a - log b|$ might be what you are after. Easy to see that $Fleft(frac abright)=Fleft(frac baright)$ and $Fleft(frac abright)=1implies a=b$.
    $endgroup$
    – lulu
    Jan 15 at 17:31












  • $begingroup$
    Log seems to be a perfect solution. Thank you @lulu!
    $endgroup$
    – Dough
    Jan 15 at 17:34










  • $begingroup$
    No problem. Note: There's a typo in my comment. I meant to write that $Fleft(frac abright)=0 implies a=b$
    $endgroup$
    – lulu
    Jan 15 at 17:38
















0












$begingroup$


I'm trying to implement a mathematical method for calculation of injustice. The formula depends on two variables $a>=1$ and $b>=1$ and returns a fraction $a/b$.



$a/b=1$ indicates justice. If $a/b<1$ the injustice is to your advantage. If $a/b>1$ the injustice is to your disadvantage.



Now I would like to set aside advantage/disadvantage and only calculate the size of the injustice. I'm having trouble figuring out an easy way to get the same result for $a/b$ as $b/a$.



Anyone have any idea of how I can do this?










share|cite|improve this question









$endgroup$








  • 2




    $begingroup$
    Not entirely sure what you are trying to do, but $Fleft(frac abright)=|log frac ab|=|log a - log b|$ might be what you are after. Easy to see that $Fleft(frac abright)=Fleft(frac baright)$ and $Fleft(frac abright)=1implies a=b$.
    $endgroup$
    – lulu
    Jan 15 at 17:31












  • $begingroup$
    Log seems to be a perfect solution. Thank you @lulu!
    $endgroup$
    – Dough
    Jan 15 at 17:34










  • $begingroup$
    No problem. Note: There's a typo in my comment. I meant to write that $Fleft(frac abright)=0 implies a=b$
    $endgroup$
    – lulu
    Jan 15 at 17:38














0












0








0





$begingroup$


I'm trying to implement a mathematical method for calculation of injustice. The formula depends on two variables $a>=1$ and $b>=1$ and returns a fraction $a/b$.



$a/b=1$ indicates justice. If $a/b<1$ the injustice is to your advantage. If $a/b>1$ the injustice is to your disadvantage.



Now I would like to set aside advantage/disadvantage and only calculate the size of the injustice. I'm having trouble figuring out an easy way to get the same result for $a/b$ as $b/a$.



Anyone have any idea of how I can do this?










share|cite|improve this question









$endgroup$




I'm trying to implement a mathematical method for calculation of injustice. The formula depends on two variables $a>=1$ and $b>=1$ and returns a fraction $a/b$.



$a/b=1$ indicates justice. If $a/b<1$ the injustice is to your advantage. If $a/b>1$ the injustice is to your disadvantage.



Now I would like to set aside advantage/disadvantage and only calculate the size of the injustice. I'm having trouble figuring out an easy way to get the same result for $a/b$ as $b/a$.



Anyone have any idea of how I can do this?







fractions






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Jan 15 at 17:28









DoughDough

31




31








  • 2




    $begingroup$
    Not entirely sure what you are trying to do, but $Fleft(frac abright)=|log frac ab|=|log a - log b|$ might be what you are after. Easy to see that $Fleft(frac abright)=Fleft(frac baright)$ and $Fleft(frac abright)=1implies a=b$.
    $endgroup$
    – lulu
    Jan 15 at 17:31












  • $begingroup$
    Log seems to be a perfect solution. Thank you @lulu!
    $endgroup$
    – Dough
    Jan 15 at 17:34










  • $begingroup$
    No problem. Note: There's a typo in my comment. I meant to write that $Fleft(frac abright)=0 implies a=b$
    $endgroup$
    – lulu
    Jan 15 at 17:38














  • 2




    $begingroup$
    Not entirely sure what you are trying to do, but $Fleft(frac abright)=|log frac ab|=|log a - log b|$ might be what you are after. Easy to see that $Fleft(frac abright)=Fleft(frac baright)$ and $Fleft(frac abright)=1implies a=b$.
    $endgroup$
    – lulu
    Jan 15 at 17:31












  • $begingroup$
    Log seems to be a perfect solution. Thank you @lulu!
    $endgroup$
    – Dough
    Jan 15 at 17:34










  • $begingroup$
    No problem. Note: There's a typo in my comment. I meant to write that $Fleft(frac abright)=0 implies a=b$
    $endgroup$
    – lulu
    Jan 15 at 17:38








2




2




$begingroup$
Not entirely sure what you are trying to do, but $Fleft(frac abright)=|log frac ab|=|log a - log b|$ might be what you are after. Easy to see that $Fleft(frac abright)=Fleft(frac baright)$ and $Fleft(frac abright)=1implies a=b$.
$endgroup$
– lulu
Jan 15 at 17:31






$begingroup$
Not entirely sure what you are trying to do, but $Fleft(frac abright)=|log frac ab|=|log a - log b|$ might be what you are after. Easy to see that $Fleft(frac abright)=Fleft(frac baright)$ and $Fleft(frac abright)=1implies a=b$.
$endgroup$
– lulu
Jan 15 at 17:31














$begingroup$
Log seems to be a perfect solution. Thank you @lulu!
$endgroup$
– Dough
Jan 15 at 17:34




$begingroup$
Log seems to be a perfect solution. Thank you @lulu!
$endgroup$
– Dough
Jan 15 at 17:34












$begingroup$
No problem. Note: There's a typo in my comment. I meant to write that $Fleft(frac abright)=0 implies a=b$
$endgroup$
– lulu
Jan 15 at 17:38




$begingroup$
No problem. Note: There's a typo in my comment. I meant to write that $Fleft(frac abright)=0 implies a=b$
$endgroup$
– lulu
Jan 15 at 17:38










2 Answers
2






active

oldest

votes


















2












$begingroup$

As noted in the comments:



The function $$Fleft(frac abright)=|log frac ab|=|log a - log b|$$



gets the job done.



It is easy to see that $$Fleft(frac abright)=Fleft(frac baright)$$ and that $$Fleft(frac abright)=0iff a= b$$ which appear to be the two desired properties.






share|cite|improve this answer









$endgroup$









  • 2




    $begingroup$
    ... and $(log a-log b)^2$ is perhaps smoother (if that is desirable)
    $endgroup$
    – Hagen von Eitzen
    Jan 15 at 17:38



















0












$begingroup$

Perhaps simpler than logarithms would be to define the injustice to be the larger of $a/b$ and $b/a$.






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%2f3074677%2fcompare-fractions-a-b-and-b-a%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












    $begingroup$

    As noted in the comments:



    The function $$Fleft(frac abright)=|log frac ab|=|log a - log b|$$



    gets the job done.



    It is easy to see that $$Fleft(frac abright)=Fleft(frac baright)$$ and that $$Fleft(frac abright)=0iff a= b$$ which appear to be the two desired properties.






    share|cite|improve this answer









    $endgroup$









    • 2




      $begingroup$
      ... and $(log a-log b)^2$ is perhaps smoother (if that is desirable)
      $endgroup$
      – Hagen von Eitzen
      Jan 15 at 17:38
















    2












    $begingroup$

    As noted in the comments:



    The function $$Fleft(frac abright)=|log frac ab|=|log a - log b|$$



    gets the job done.



    It is easy to see that $$Fleft(frac abright)=Fleft(frac baright)$$ and that $$Fleft(frac abright)=0iff a= b$$ which appear to be the two desired properties.






    share|cite|improve this answer









    $endgroup$









    • 2




      $begingroup$
      ... and $(log a-log b)^2$ is perhaps smoother (if that is desirable)
      $endgroup$
      – Hagen von Eitzen
      Jan 15 at 17:38














    2












    2








    2





    $begingroup$

    As noted in the comments:



    The function $$Fleft(frac abright)=|log frac ab|=|log a - log b|$$



    gets the job done.



    It is easy to see that $$Fleft(frac abright)=Fleft(frac baright)$$ and that $$Fleft(frac abright)=0iff a= b$$ which appear to be the two desired properties.






    share|cite|improve this answer









    $endgroup$



    As noted in the comments:



    The function $$Fleft(frac abright)=|log frac ab|=|log a - log b|$$



    gets the job done.



    It is easy to see that $$Fleft(frac abright)=Fleft(frac baright)$$ and that $$Fleft(frac abright)=0iff a= b$$ which appear to be the two desired properties.







    share|cite|improve this answer












    share|cite|improve this answer



    share|cite|improve this answer










    answered Jan 15 at 17:37









    lulululu

    43.3k25080




    43.3k25080








    • 2




      $begingroup$
      ... and $(log a-log b)^2$ is perhaps smoother (if that is desirable)
      $endgroup$
      – Hagen von Eitzen
      Jan 15 at 17:38














    • 2




      $begingroup$
      ... and $(log a-log b)^2$ is perhaps smoother (if that is desirable)
      $endgroup$
      – Hagen von Eitzen
      Jan 15 at 17:38








    2




    2




    $begingroup$
    ... and $(log a-log b)^2$ is perhaps smoother (if that is desirable)
    $endgroup$
    – Hagen von Eitzen
    Jan 15 at 17:38




    $begingroup$
    ... and $(log a-log b)^2$ is perhaps smoother (if that is desirable)
    $endgroup$
    – Hagen von Eitzen
    Jan 15 at 17:38











    0












    $begingroup$

    Perhaps simpler than logarithms would be to define the injustice to be the larger of $a/b$ and $b/a$.






    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      Perhaps simpler than logarithms would be to define the injustice to be the larger of $a/b$ and $b/a$.






      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        Perhaps simpler than logarithms would be to define the injustice to be the larger of $a/b$ and $b/a$.






        share|cite|improve this answer









        $endgroup$



        Perhaps simpler than logarithms would be to define the injustice to be the larger of $a/b$ and $b/a$.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Jan 15 at 20:35









        Andreas BlassAndreas Blass

        50.4k452109




        50.4k452109






























            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%2f3074677%2fcompare-fractions-a-b-and-b-a%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

            Human spaceflight

            Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

            張江高科駅