Approximating irrational number to rational number$lim_ntoinfty f(2^n)$ for some very slowly increasing function $f(n)$Hermite Interpolation of $e^x$. Strange behaviour when increasing the number of derivatives at interpolating points.Newton's Method, and approximating parameters for Bézier curves.Approximating Logs and Antilogs by handApproximating fractionsExistence of Irrational Number that has same $n$ digits of a given Rational Number.Finding Irrational Approximation for a given Rational Number.Atomic weights: rational or irrational?Does there exist infinitely many $mu$ which satisfy this:Approximating functions with rational functions

Did arcade monitors have same pixel aspect ratio as TV sets?

Create all possible words using a set or letters

GraphicsGrid with a Label for each Column and Row

Why electric field inside a cavity of a non-conducting sphere not zero?

What does routing an IP address mean?

Problem with TransformedDistribution

Redundant comparison & "if" before assignment

If infinitesimal transformations commute why dont the generators of the Lorentz group commute?

What is this called? Old film camera viewer?

WiFi Thermostat, No C Terminal on Furnace

Why did the EU agree to delay the Brexit deadline?

Why did the Mercure fail?

The IT department bottlenecks progress. How should I handle this?

Not using 's' for he/she/it

What was the exact wording from Ivanhoe of this advice on how to free yourself from slavery?

Is this toilet slogan correct usage of the English language?

Why should universal income be universal?

What is the evidence for the "tyranny of the majority problem" in a direct democracy context?

How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?

Creature in Shazam mid-credits scene?

The screen of my macbook suddenly broken down how can I do to recover

C++ debug/print custom type with GDB : the case of nlohmann json library

Count the occurrence of each unique word in the file

How to implement a feedback to keep the DC gain at zero for this conceptual passive filter?



Approximating irrational number to rational number


$lim_ntoinfty f(2^n)$ for some very slowly increasing function $f(n)$Hermite Interpolation of $e^x$. Strange behaviour when increasing the number of derivatives at interpolating points.Newton's Method, and approximating parameters for Bézier curves.Approximating Logs and Antilogs by handApproximating fractionsExistence of Irrational Number that has same $n$ digits of a given Rational Number.Finding Irrational Approximation for a given Rational Number.Atomic weights: rational or irrational?Does there exist infinitely many $mu$ which satisfy this:Approximating functions with rational functions













3












$begingroup$


I'm making a phone game, and I need to approximate $frac log(5/4)log(3/2)$ to a rational number $p/q$.

I wish $p$ and $q$ small enough. For example, I don't want $p$, $qapprox 10^7$; it's way too much for my code.



In the game, there's two way to upgrade ability. Type A gives additional $50%$ increase at once. and type B gives $25%$.

What I want to know is how many times of upgrade $(x,y)$ provides same additional increase. So what I've done is solve $(3/2)^x = (5/4)^y$ respect to $frac xy$.



Can you provide me way to construct sequence $p_n$, $q_n$ which approximate the real number?

Thank you in advance.










share|cite|improve this question











$endgroup$











  • $begingroup$
    I don't understand your game, but your number approximately $0.55034$ and thus $tfrac55034100000$ or $tfrac550310000$. What's wrong with that?
    $endgroup$
    – amsmath
    58 mins ago






  • 1




    $begingroup$
    The continued fraction expansion of your irrational number will produce the best rational approximation subject to a limit on size of the denominator.
    $endgroup$
    – hardmath
    56 mins ago






  • 1




    $begingroup$
    You can take truncations of the continued fraction of that number. The first few of its values start like this.
    $endgroup$
    – user647486
    56 mins ago











  • $begingroup$
    try 82/149 ........
    $endgroup$
    – Will Jagy
    54 mins ago










  • $begingroup$
    Cool, a practical application of continued fractions. :)
    $endgroup$
    – Minus One-Twelfth
    44 mins ago















3












$begingroup$


I'm making a phone game, and I need to approximate $frac log(5/4)log(3/2)$ to a rational number $p/q$.

I wish $p$ and $q$ small enough. For example, I don't want $p$, $qapprox 10^7$; it's way too much for my code.



In the game, there's two way to upgrade ability. Type A gives additional $50%$ increase at once. and type B gives $25%$.

What I want to know is how many times of upgrade $(x,y)$ provides same additional increase. So what I've done is solve $(3/2)^x = (5/4)^y$ respect to $frac xy$.



Can you provide me way to construct sequence $p_n$, $q_n$ which approximate the real number?

Thank you in advance.










share|cite|improve this question











$endgroup$











  • $begingroup$
    I don't understand your game, but your number approximately $0.55034$ and thus $tfrac55034100000$ or $tfrac550310000$. What's wrong with that?
    $endgroup$
    – amsmath
    58 mins ago






  • 1




    $begingroup$
    The continued fraction expansion of your irrational number will produce the best rational approximation subject to a limit on size of the denominator.
    $endgroup$
    – hardmath
    56 mins ago






  • 1




    $begingroup$
    You can take truncations of the continued fraction of that number. The first few of its values start like this.
    $endgroup$
    – user647486
    56 mins ago











  • $begingroup$
    try 82/149 ........
    $endgroup$
    – Will Jagy
    54 mins ago










  • $begingroup$
    Cool, a practical application of continued fractions. :)
    $endgroup$
    – Minus One-Twelfth
    44 mins ago













3












3








3





$begingroup$


I'm making a phone game, and I need to approximate $frac log(5/4)log(3/2)$ to a rational number $p/q$.

I wish $p$ and $q$ small enough. For example, I don't want $p$, $qapprox 10^7$; it's way too much for my code.



In the game, there's two way to upgrade ability. Type A gives additional $50%$ increase at once. and type B gives $25%$.

What I want to know is how many times of upgrade $(x,y)$ provides same additional increase. So what I've done is solve $(3/2)^x = (5/4)^y$ respect to $frac xy$.



Can you provide me way to construct sequence $p_n$, $q_n$ which approximate the real number?

Thank you in advance.










share|cite|improve this question











$endgroup$




I'm making a phone game, and I need to approximate $frac log(5/4)log(3/2)$ to a rational number $p/q$.

I wish $p$ and $q$ small enough. For example, I don't want $p$, $qapprox 10^7$; it's way too much for my code.



In the game, there's two way to upgrade ability. Type A gives additional $50%$ increase at once. and type B gives $25%$.

What I want to know is how many times of upgrade $(x,y)$ provides same additional increase. So what I've done is solve $(3/2)^x = (5/4)^y$ respect to $frac xy$.



Can you provide me way to construct sequence $p_n$, $q_n$ which approximate the real number?

Thank you in advance.







approximation






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited 55 mins ago









Rócherz

2,9863821




2,9863821










asked 1 hour ago









MrTanorusMrTanorus

1928




1928











  • $begingroup$
    I don't understand your game, but your number approximately $0.55034$ and thus $tfrac55034100000$ or $tfrac550310000$. What's wrong with that?
    $endgroup$
    – amsmath
    58 mins ago






  • 1




    $begingroup$
    The continued fraction expansion of your irrational number will produce the best rational approximation subject to a limit on size of the denominator.
    $endgroup$
    – hardmath
    56 mins ago






  • 1




    $begingroup$
    You can take truncations of the continued fraction of that number. The first few of its values start like this.
    $endgroup$
    – user647486
    56 mins ago











  • $begingroup$
    try 82/149 ........
    $endgroup$
    – Will Jagy
    54 mins ago










  • $begingroup$
    Cool, a practical application of continued fractions. :)
    $endgroup$
    – Minus One-Twelfth
    44 mins ago
















  • $begingroup$
    I don't understand your game, but your number approximately $0.55034$ and thus $tfrac55034100000$ or $tfrac550310000$. What's wrong with that?
    $endgroup$
    – amsmath
    58 mins ago






  • 1




    $begingroup$
    The continued fraction expansion of your irrational number will produce the best rational approximation subject to a limit on size of the denominator.
    $endgroup$
    – hardmath
    56 mins ago






  • 1




    $begingroup$
    You can take truncations of the continued fraction of that number. The first few of its values start like this.
    $endgroup$
    – user647486
    56 mins ago











  • $begingroup$
    try 82/149 ........
    $endgroup$
    – Will Jagy
    54 mins ago










  • $begingroup$
    Cool, a practical application of continued fractions. :)
    $endgroup$
    – Minus One-Twelfth
    44 mins ago















$begingroup$
I don't understand your game, but your number approximately $0.55034$ and thus $tfrac55034100000$ or $tfrac550310000$. What's wrong with that?
$endgroup$
– amsmath
58 mins ago




$begingroup$
I don't understand your game, but your number approximately $0.55034$ and thus $tfrac55034100000$ or $tfrac550310000$. What's wrong with that?
$endgroup$
– amsmath
58 mins ago




1




1




$begingroup$
The continued fraction expansion of your irrational number will produce the best rational approximation subject to a limit on size of the denominator.
$endgroup$
– hardmath
56 mins ago




$begingroup$
The continued fraction expansion of your irrational number will produce the best rational approximation subject to a limit on size of the denominator.
$endgroup$
– hardmath
56 mins ago




1




1




$begingroup$
You can take truncations of the continued fraction of that number. The first few of its values start like this.
$endgroup$
– user647486
56 mins ago





$begingroup$
You can take truncations of the continued fraction of that number. The first few of its values start like this.
$endgroup$
– user647486
56 mins ago













$begingroup$
try 82/149 ........
$endgroup$
– Will Jagy
54 mins ago




$begingroup$
try 82/149 ........
$endgroup$
– Will Jagy
54 mins ago












$begingroup$
Cool, a practical application of continued fractions. :)
$endgroup$
– Minus One-Twelfth
44 mins ago




$begingroup$
Cool, a practical application of continued fractions. :)
$endgroup$
– Minus One-Twelfth
44 mins ago










3 Answers
3






active

oldest

votes


















2












$begingroup$

The number you want to approximate is about $0.550339713213$. An excellent approximation is $frac 8911619approx 0.550339715873$. I got that by using the continued fraction. When you see a large value like $143$, truncating before it yields a very good approximation.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    (+1) I wondered where you got $143$ until I actually computed the continued fraction. I'd hoped it was okay to expand upon your answer to show where that number came from. Also to mention that if $frac pq$ is a continued fraction and $c$ is the next term in the conitnued fraction (which I think is called a continuant), then $frac pq$ is closer than $frac1cq^2$ to the value approximated.
    $endgroup$
    – robjohn
    10 mins ago


















2












$begingroup$

The continued fraction for $fraclogleft(frac54right)logleft(frac32right)$ is
$$
0;1,1,4,2,6,1,color#C0010,143,3,dots
$$

The convergents for this continued fraction are
$$
left0,1,frac12,frac59,frac1120,frac71129,frac82149,color#C00frac8911619,frac127495231666,frac383376696617,dotsright
$$

As Ross Millikan mentions, stopping just before a large continuant like $143$ gives a particularly good approximation for the size of the denominator; in this case, the approximation $frac8911619$ is closer than $frac1143cdot1619^2$ to $fraclogleft(frac54right)logleft(frac32right)$.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    Thank you. A good addition to my answer.
    $endgroup$
    – Ross Millikan
    23 mins ago


















1












$begingroup$

Running the extended Euclidean algorithm to find the continued fraction:



$$beginarrayccx&q&a&b\
hline 0.55033971 & & 0 & 1\ 1 & 0 & 1 & 0\ 0.55033971 & 1 & 0 & 1\ 0.44966029 & 1 & 1 & -1 \ 0.10067943 & 4 & -1 & 2\ 0.04694258 & 2 & 5 & -9\ 0.00679426 & 6 & -11 & 20 \ 0.00617700 & 1 & 71 & -129 \ 0.00061727 & 10 & -82 & 149\ 4.31cdot 10^-6 & 143 & 891 & -1619 \
1.25cdot 10^-6 & 3 & -127495 & 231666endarray$$

The $q$ column are the quotients, that go into the continued fraction. The $a$ and $b$ columns track a linear combination of the original two that's equal to $x_n$; for example, $-11cdot 1 + 20cdot fraclog(5/4)log(3/2)approx 0.00679426$. The fraction $left|fraclog(5/4)log(3/2)right|$ is approximated by $fracb_n$, with increasing accuracy.



The formulas for building this table: $q_n = leftlfloor frac x_n-1x_nrightrfloor$, $x_n+1=x_n-1-q_nx_n$, $a_n+1=a_n-1-q_na_n$, $b_n+1=b_n-1-q_nb_n$. Initialize with $x_0=1$, $x_-1$ the quantity we're trying to estimate, $a_-1=b_0=0$, $a_0=b_-1=1$.

If you run the table much large than this, watch for floating-point accuracy issues; once the $x_n$ get down close to the accuracy limit for floating point numbers near zero, you can't trust the quotients anymore.



Now, how that accuracy increases is irregular. Large quotients go with particularly good approximations - see how that quotient of $143$ means that we have to go to six-digit numerator and denominator to do better than that $frac8911619$ approximation.



It is of course a tradeoff between accuracy and how deep you go. For your purposes in costing the two upgrades, I'd probably go with that $frac1120$ approximation.






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%2f3160023%2fapproximating-irrational-number-to-rational-number%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2












    $begingroup$

    The number you want to approximate is about $0.550339713213$. An excellent approximation is $frac 8911619approx 0.550339715873$. I got that by using the continued fraction. When you see a large value like $143$, truncating before it yields a very good approximation.






    share|cite|improve this answer









    $endgroup$












    • $begingroup$
      (+1) I wondered where you got $143$ until I actually computed the continued fraction. I'd hoped it was okay to expand upon your answer to show where that number came from. Also to mention that if $frac pq$ is a continued fraction and $c$ is the next term in the conitnued fraction (which I think is called a continuant), then $frac pq$ is closer than $frac1cq^2$ to the value approximated.
      $endgroup$
      – robjohn
      10 mins ago















    2












    $begingroup$

    The number you want to approximate is about $0.550339713213$. An excellent approximation is $frac 8911619approx 0.550339715873$. I got that by using the continued fraction. When you see a large value like $143$, truncating before it yields a very good approximation.






    share|cite|improve this answer









    $endgroup$












    • $begingroup$
      (+1) I wondered where you got $143$ until I actually computed the continued fraction. I'd hoped it was okay to expand upon your answer to show where that number came from. Also to mention that if $frac pq$ is a continued fraction and $c$ is the next term in the conitnued fraction (which I think is called a continuant), then $frac pq$ is closer than $frac1cq^2$ to the value approximated.
      $endgroup$
      – robjohn
      10 mins ago













    2












    2








    2





    $begingroup$

    The number you want to approximate is about $0.550339713213$. An excellent approximation is $frac 8911619approx 0.550339715873$. I got that by using the continued fraction. When you see a large value like $143$, truncating before it yields a very good approximation.






    share|cite|improve this answer









    $endgroup$



    The number you want to approximate is about $0.550339713213$. An excellent approximation is $frac 8911619approx 0.550339715873$. I got that by using the continued fraction. When you see a large value like $143$, truncating before it yields a very good approximation.







    share|cite|improve this answer












    share|cite|improve this answer



    share|cite|improve this answer










    answered 50 mins ago









    Ross MillikanRoss Millikan

    300k24200374




    300k24200374











    • $begingroup$
      (+1) I wondered where you got $143$ until I actually computed the continued fraction. I'd hoped it was okay to expand upon your answer to show where that number came from. Also to mention that if $frac pq$ is a continued fraction and $c$ is the next term in the conitnued fraction (which I think is called a continuant), then $frac pq$ is closer than $frac1cq^2$ to the value approximated.
      $endgroup$
      – robjohn
      10 mins ago
















    • $begingroup$
      (+1) I wondered where you got $143$ until I actually computed the continued fraction. I'd hoped it was okay to expand upon your answer to show where that number came from. Also to mention that if $frac pq$ is a continued fraction and $c$ is the next term in the conitnued fraction (which I think is called a continuant), then $frac pq$ is closer than $frac1cq^2$ to the value approximated.
      $endgroup$
      – robjohn
      10 mins ago















    $begingroup$
    (+1) I wondered where you got $143$ until I actually computed the continued fraction. I'd hoped it was okay to expand upon your answer to show where that number came from. Also to mention that if $frac pq$ is a continued fraction and $c$ is the next term in the conitnued fraction (which I think is called a continuant), then $frac pq$ is closer than $frac1cq^2$ to the value approximated.
    $endgroup$
    – robjohn
    10 mins ago




    $begingroup$
    (+1) I wondered where you got $143$ until I actually computed the continued fraction. I'd hoped it was okay to expand upon your answer to show where that number came from. Also to mention that if $frac pq$ is a continued fraction and $c$ is the next term in the conitnued fraction (which I think is called a continuant), then $frac pq$ is closer than $frac1cq^2$ to the value approximated.
    $endgroup$
    – robjohn
    10 mins ago











    2












    $begingroup$

    The continued fraction for $fraclogleft(frac54right)logleft(frac32right)$ is
    $$
    0;1,1,4,2,6,1,color#C0010,143,3,dots
    $$

    The convergents for this continued fraction are
    $$
    left0,1,frac12,frac59,frac1120,frac71129,frac82149,color#C00frac8911619,frac127495231666,frac383376696617,dotsright
    $$

    As Ross Millikan mentions, stopping just before a large continuant like $143$ gives a particularly good approximation for the size of the denominator; in this case, the approximation $frac8911619$ is closer than $frac1143cdot1619^2$ to $fraclogleft(frac54right)logleft(frac32right)$.






    share|cite|improve this answer









    $endgroup$












    • $begingroup$
      Thank you. A good addition to my answer.
      $endgroup$
      – Ross Millikan
      23 mins ago















    2












    $begingroup$

    The continued fraction for $fraclogleft(frac54right)logleft(frac32right)$ is
    $$
    0;1,1,4,2,6,1,color#C0010,143,3,dots
    $$

    The convergents for this continued fraction are
    $$
    left0,1,frac12,frac59,frac1120,frac71129,frac82149,color#C00frac8911619,frac127495231666,frac383376696617,dotsright
    $$

    As Ross Millikan mentions, stopping just before a large continuant like $143$ gives a particularly good approximation for the size of the denominator; in this case, the approximation $frac8911619$ is closer than $frac1143cdot1619^2$ to $fraclogleft(frac54right)logleft(frac32right)$.






    share|cite|improve this answer









    $endgroup$












    • $begingroup$
      Thank you. A good addition to my answer.
      $endgroup$
      – Ross Millikan
      23 mins ago













    2












    2








    2





    $begingroup$

    The continued fraction for $fraclogleft(frac54right)logleft(frac32right)$ is
    $$
    0;1,1,4,2,6,1,color#C0010,143,3,dots
    $$

    The convergents for this continued fraction are
    $$
    left0,1,frac12,frac59,frac1120,frac71129,frac82149,color#C00frac8911619,frac127495231666,frac383376696617,dotsright
    $$

    As Ross Millikan mentions, stopping just before a large continuant like $143$ gives a particularly good approximation for the size of the denominator; in this case, the approximation $frac8911619$ is closer than $frac1143cdot1619^2$ to $fraclogleft(frac54right)logleft(frac32right)$.






    share|cite|improve this answer









    $endgroup$



    The continued fraction for $fraclogleft(frac54right)logleft(frac32right)$ is
    $$
    0;1,1,4,2,6,1,color#C0010,143,3,dots
    $$

    The convergents for this continued fraction are
    $$
    left0,1,frac12,frac59,frac1120,frac71129,frac82149,color#C00frac8911619,frac127495231666,frac383376696617,dotsright
    $$

    As Ross Millikan mentions, stopping just before a large continuant like $143$ gives a particularly good approximation for the size of the denominator; in this case, the approximation $frac8911619$ is closer than $frac1143cdot1619^2$ to $fraclogleft(frac54right)logleft(frac32right)$.







    share|cite|improve this answer












    share|cite|improve this answer



    share|cite|improve this answer










    answered 35 mins ago









    robjohnrobjohn

    269k27311638




    269k27311638











    • $begingroup$
      Thank you. A good addition to my answer.
      $endgroup$
      – Ross Millikan
      23 mins ago
















    • $begingroup$
      Thank you. A good addition to my answer.
      $endgroup$
      – Ross Millikan
      23 mins ago















    $begingroup$
    Thank you. A good addition to my answer.
    $endgroup$
    – Ross Millikan
    23 mins ago




    $begingroup$
    Thank you. A good addition to my answer.
    $endgroup$
    – Ross Millikan
    23 mins ago











    1












    $begingroup$

    Running the extended Euclidean algorithm to find the continued fraction:



    $$beginarrayccx&q&a&b\
    hline 0.55033971 & & 0 & 1\ 1 & 0 & 1 & 0\ 0.55033971 & 1 & 0 & 1\ 0.44966029 & 1 & 1 & -1 \ 0.10067943 & 4 & -1 & 2\ 0.04694258 & 2 & 5 & -9\ 0.00679426 & 6 & -11 & 20 \ 0.00617700 & 1 & 71 & -129 \ 0.00061727 & 10 & -82 & 149\ 4.31cdot 10^-6 & 143 & 891 & -1619 \
    1.25cdot 10^-6 & 3 & -127495 & 231666endarray$$

    The $q$ column are the quotients, that go into the continued fraction. The $a$ and $b$ columns track a linear combination of the original two that's equal to $x_n$; for example, $-11cdot 1 + 20cdot fraclog(5/4)log(3/2)approx 0.00679426$. The fraction $left|fraclog(5/4)log(3/2)right|$ is approximated by $fracb_n$, with increasing accuracy.



    The formulas for building this table: $q_n = leftlfloor frac x_n-1x_nrightrfloor$, $x_n+1=x_n-1-q_nx_n$, $a_n+1=a_n-1-q_na_n$, $b_n+1=b_n-1-q_nb_n$. Initialize with $x_0=1$, $x_-1$ the quantity we're trying to estimate, $a_-1=b_0=0$, $a_0=b_-1=1$.

    If you run the table much large than this, watch for floating-point accuracy issues; once the $x_n$ get down close to the accuracy limit for floating point numbers near zero, you can't trust the quotients anymore.



    Now, how that accuracy increases is irregular. Large quotients go with particularly good approximations - see how that quotient of $143$ means that we have to go to six-digit numerator and denominator to do better than that $frac8911619$ approximation.



    It is of course a tradeoff between accuracy and how deep you go. For your purposes in costing the two upgrades, I'd probably go with that $frac1120$ approximation.






    share|cite|improve this answer









    $endgroup$

















      1












      $begingroup$

      Running the extended Euclidean algorithm to find the continued fraction:



      $$beginarrayccx&q&a&b\
      hline 0.55033971 & & 0 & 1\ 1 & 0 & 1 & 0\ 0.55033971 & 1 & 0 & 1\ 0.44966029 & 1 & 1 & -1 \ 0.10067943 & 4 & -1 & 2\ 0.04694258 & 2 & 5 & -9\ 0.00679426 & 6 & -11 & 20 \ 0.00617700 & 1 & 71 & -129 \ 0.00061727 & 10 & -82 & 149\ 4.31cdot 10^-6 & 143 & 891 & -1619 \
      1.25cdot 10^-6 & 3 & -127495 & 231666endarray$$

      The $q$ column are the quotients, that go into the continued fraction. The $a$ and $b$ columns track a linear combination of the original two that's equal to $x_n$; for example, $-11cdot 1 + 20cdot fraclog(5/4)log(3/2)approx 0.00679426$. The fraction $left|fraclog(5/4)log(3/2)right|$ is approximated by $fracb_n$, with increasing accuracy.



      The formulas for building this table: $q_n = leftlfloor frac x_n-1x_nrightrfloor$, $x_n+1=x_n-1-q_nx_n$, $a_n+1=a_n-1-q_na_n$, $b_n+1=b_n-1-q_nb_n$. Initialize with $x_0=1$, $x_-1$ the quantity we're trying to estimate, $a_-1=b_0=0$, $a_0=b_-1=1$.

      If you run the table much large than this, watch for floating-point accuracy issues; once the $x_n$ get down close to the accuracy limit for floating point numbers near zero, you can't trust the quotients anymore.



      Now, how that accuracy increases is irregular. Large quotients go with particularly good approximations - see how that quotient of $143$ means that we have to go to six-digit numerator and denominator to do better than that $frac8911619$ approximation.



      It is of course a tradeoff between accuracy and how deep you go. For your purposes in costing the two upgrades, I'd probably go with that $frac1120$ approximation.






      share|cite|improve this answer









      $endgroup$















        1












        1








        1





        $begingroup$

        Running the extended Euclidean algorithm to find the continued fraction:



        $$beginarrayccx&q&a&b\
        hline 0.55033971 & & 0 & 1\ 1 & 0 & 1 & 0\ 0.55033971 & 1 & 0 & 1\ 0.44966029 & 1 & 1 & -1 \ 0.10067943 & 4 & -1 & 2\ 0.04694258 & 2 & 5 & -9\ 0.00679426 & 6 & -11 & 20 \ 0.00617700 & 1 & 71 & -129 \ 0.00061727 & 10 & -82 & 149\ 4.31cdot 10^-6 & 143 & 891 & -1619 \
        1.25cdot 10^-6 & 3 & -127495 & 231666endarray$$

        The $q$ column are the quotients, that go into the continued fraction. The $a$ and $b$ columns track a linear combination of the original two that's equal to $x_n$; for example, $-11cdot 1 + 20cdot fraclog(5/4)log(3/2)approx 0.00679426$. The fraction $left|fraclog(5/4)log(3/2)right|$ is approximated by $fracb_n$, with increasing accuracy.



        The formulas for building this table: $q_n = leftlfloor frac x_n-1x_nrightrfloor$, $x_n+1=x_n-1-q_nx_n$, $a_n+1=a_n-1-q_na_n$, $b_n+1=b_n-1-q_nb_n$. Initialize with $x_0=1$, $x_-1$ the quantity we're trying to estimate, $a_-1=b_0=0$, $a_0=b_-1=1$.

        If you run the table much large than this, watch for floating-point accuracy issues; once the $x_n$ get down close to the accuracy limit for floating point numbers near zero, you can't trust the quotients anymore.



        Now, how that accuracy increases is irregular. Large quotients go with particularly good approximations - see how that quotient of $143$ means that we have to go to six-digit numerator and denominator to do better than that $frac8911619$ approximation.



        It is of course a tradeoff between accuracy and how deep you go. For your purposes in costing the two upgrades, I'd probably go with that $frac1120$ approximation.






        share|cite|improve this answer









        $endgroup$



        Running the extended Euclidean algorithm to find the continued fraction:



        $$beginarrayccx&q&a&b\
        hline 0.55033971 & & 0 & 1\ 1 & 0 & 1 & 0\ 0.55033971 & 1 & 0 & 1\ 0.44966029 & 1 & 1 & -1 \ 0.10067943 & 4 & -1 & 2\ 0.04694258 & 2 & 5 & -9\ 0.00679426 & 6 & -11 & 20 \ 0.00617700 & 1 & 71 & -129 \ 0.00061727 & 10 & -82 & 149\ 4.31cdot 10^-6 & 143 & 891 & -1619 \
        1.25cdot 10^-6 & 3 & -127495 & 231666endarray$$

        The $q$ column are the quotients, that go into the continued fraction. The $a$ and $b$ columns track a linear combination of the original two that's equal to $x_n$; for example, $-11cdot 1 + 20cdot fraclog(5/4)log(3/2)approx 0.00679426$. The fraction $left|fraclog(5/4)log(3/2)right|$ is approximated by $fracb_n$, with increasing accuracy.



        The formulas for building this table: $q_n = leftlfloor frac x_n-1x_nrightrfloor$, $x_n+1=x_n-1-q_nx_n$, $a_n+1=a_n-1-q_na_n$, $b_n+1=b_n-1-q_nb_n$. Initialize with $x_0=1$, $x_-1$ the quantity we're trying to estimate, $a_-1=b_0=0$, $a_0=b_-1=1$.

        If you run the table much large than this, watch for floating-point accuracy issues; once the $x_n$ get down close to the accuracy limit for floating point numbers near zero, you can't trust the quotients anymore.



        Now, how that accuracy increases is irregular. Large quotients go with particularly good approximations - see how that quotient of $143$ means that we have to go to six-digit numerator and denominator to do better than that $frac8911619$ approximation.



        It is of course a tradeoff between accuracy and how deep you go. For your purposes in costing the two upgrades, I'd probably go with that $frac1120$ approximation.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered 24 mins ago









        jmerryjmerry

        15.8k1632




        15.8k1632



























            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%2f3160023%2fapproximating-irrational-number-to-rational-number%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

            Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

            Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

            How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2