Approximate $log(7)+cos(1)$ with an error of less than $10^-4$

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











up vote
1
down vote

favorite
1












Evaluate $log(7)+cos(1)$ with an error of less than $10^-4$



Obviously the aim is to use Taylor's expansion with Lagrange's remainder, but where to center it? I was thinking in $e^2$, which seems to me a bit too large.







share|cite|improve this question
















  • 1




    If you are free in the method, I would suggest to solve $e^x=7$ with newton's method rather than use the taylor-expansion of $ln(x)$.
    – Peter
    Aug 13 at 10:09










  • @Peter I have never used it in an exercise. Can you show me how to use it? Thank you
    – F.inc
    Aug 13 at 10:23






  • 2




    By writing $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+2cos^2tfrac12-1 $$ we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$.
    – Jack D'Aurizio♦
    Aug 13 at 10:27











  • In order to solve $e^x=7$ through Newton's method you still need to compute exponentials, so the problem is pretty much the same.
    – Jack D'Aurizio♦
    Aug 13 at 10:30






  • 1




    @Peter: $7=8/ frac87 = 2^3/left(1+frac17right) = left(1-frac12right)^-3left(1+frac17right)^-1$.
    – Jack D'Aurizio♦
    Aug 13 at 10:59














up vote
1
down vote

favorite
1












Evaluate $log(7)+cos(1)$ with an error of less than $10^-4$



Obviously the aim is to use Taylor's expansion with Lagrange's remainder, but where to center it? I was thinking in $e^2$, which seems to me a bit too large.







share|cite|improve this question
















  • 1




    If you are free in the method, I would suggest to solve $e^x=7$ with newton's method rather than use the taylor-expansion of $ln(x)$.
    – Peter
    Aug 13 at 10:09










  • @Peter I have never used it in an exercise. Can you show me how to use it? Thank you
    – F.inc
    Aug 13 at 10:23






  • 2




    By writing $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+2cos^2tfrac12-1 $$ we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$.
    – Jack D'Aurizio♦
    Aug 13 at 10:27











  • In order to solve $e^x=7$ through Newton's method you still need to compute exponentials, so the problem is pretty much the same.
    – Jack D'Aurizio♦
    Aug 13 at 10:30






  • 1




    @Peter: $7=8/ frac87 = 2^3/left(1+frac17right) = left(1-frac12right)^-3left(1+frac17right)^-1$.
    – Jack D'Aurizio♦
    Aug 13 at 10:59












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





Evaluate $log(7)+cos(1)$ with an error of less than $10^-4$



Obviously the aim is to use Taylor's expansion with Lagrange's remainder, but where to center it? I was thinking in $e^2$, which seems to me a bit too large.







share|cite|improve this question












Evaluate $log(7)+cos(1)$ with an error of less than $10^-4$



Obviously the aim is to use Taylor's expansion with Lagrange's remainder, but where to center it? I was thinking in $e^2$, which seems to me a bit too large.









share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Aug 13 at 9:58









F.inc

3158




3158







  • 1




    If you are free in the method, I would suggest to solve $e^x=7$ with newton's method rather than use the taylor-expansion of $ln(x)$.
    – Peter
    Aug 13 at 10:09










  • @Peter I have never used it in an exercise. Can you show me how to use it? Thank you
    – F.inc
    Aug 13 at 10:23






  • 2




    By writing $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+2cos^2tfrac12-1 $$ we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$.
    – Jack D'Aurizio♦
    Aug 13 at 10:27











  • In order to solve $e^x=7$ through Newton's method you still need to compute exponentials, so the problem is pretty much the same.
    – Jack D'Aurizio♦
    Aug 13 at 10:30






  • 1




    @Peter: $7=8/ frac87 = 2^3/left(1+frac17right) = left(1-frac12right)^-3left(1+frac17right)^-1$.
    – Jack D'Aurizio♦
    Aug 13 at 10:59












  • 1




    If you are free in the method, I would suggest to solve $e^x=7$ with newton's method rather than use the taylor-expansion of $ln(x)$.
    – Peter
    Aug 13 at 10:09










  • @Peter I have never used it in an exercise. Can you show me how to use it? Thank you
    – F.inc
    Aug 13 at 10:23






  • 2




    By writing $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+2cos^2tfrac12-1 $$ we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$.
    – Jack D'Aurizio♦
    Aug 13 at 10:27











  • In order to solve $e^x=7$ through Newton's method you still need to compute exponentials, so the problem is pretty much the same.
    – Jack D'Aurizio♦
    Aug 13 at 10:30






  • 1




    @Peter: $7=8/ frac87 = 2^3/left(1+frac17right) = left(1-frac12right)^-3left(1+frac17right)^-1$.
    – Jack D'Aurizio♦
    Aug 13 at 10:59







1




1




If you are free in the method, I would suggest to solve $e^x=7$ with newton's method rather than use the taylor-expansion of $ln(x)$.
– Peter
Aug 13 at 10:09




If you are free in the method, I would suggest to solve $e^x=7$ with newton's method rather than use the taylor-expansion of $ln(x)$.
– Peter
Aug 13 at 10:09












@Peter I have never used it in an exercise. Can you show me how to use it? Thank you
– F.inc
Aug 13 at 10:23




@Peter I have never used it in an exercise. Can you show me how to use it? Thank you
– F.inc
Aug 13 at 10:23




2




2




By writing $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+2cos^2tfrac12-1 $$ we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$.
– Jack D'Aurizio♦
Aug 13 at 10:27





By writing $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+2cos^2tfrac12-1 $$ we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$.
– Jack D'Aurizio♦
Aug 13 at 10:27













In order to solve $e^x=7$ through Newton's method you still need to compute exponentials, so the problem is pretty much the same.
– Jack D'Aurizio♦
Aug 13 at 10:30




In order to solve $e^x=7$ through Newton's method you still need to compute exponentials, so the problem is pretty much the same.
– Jack D'Aurizio♦
Aug 13 at 10:30




1




1




@Peter: $7=8/ frac87 = 2^3/left(1+frac17right) = left(1-frac12right)^-3left(1+frac17right)^-1$.
– Jack D'Aurizio♦
Aug 13 at 10:59




@Peter: $7=8/ frac87 = 2^3/left(1+frac17right) = left(1-frac12right)^-3left(1+frac17right)^-1$.
– Jack D'Aurizio♦
Aug 13 at 10:59










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










By writing



$$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+cos(1) $$
we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$. We have



$$ cos(1)=sum_n=0^8frac(-1)^n(2n)!+E_1 = frac1130463162168120922789888000+E_1 $$
with $|E_1|leq frac110!$. Similarly
$$ logleft(1+frac17right) = sum_n=1^6frac(-1)^n+1n 7^n+E_2 = frac9425897058940+E_2 $$
with $|E_2|leq frac18cdot 10^5$ and
$$ log(2) = sum_n=1^15frac1n 2^n+E_3 = frac3197207946126080+E_3 $$
with $|E_3|leq frac210^5$. In particular



$$frac1130463162168120922789888000-frac9425897058940+3cdot frac3197207946126080=colorgreen2.4862071ldots $$
is an approximation (a lower bound) of $log(7)+cos(1)$ within the required accuracy.
An improved approach is to write
$$ log(7)+cos(1) = 3log(2)+logleft(1-frac18right)+cos(1), $$
approximate $cos(1)$ and $logleft(1-frac18right)$ via Maclaurin series and approximate $log(2)$ via $0leq int_0^1fracx^n(1-x)^n1+x,dxleqfrac14^n$. With $n=5$ we already get $log(2)approx frac23293360$ with an error $leq 8cdot 10^-6$.






share|cite|improve this answer





























    up vote
    3
    down vote













    Consider
    $$
    log(1+x)=x-fracx^22+fracx^33-dotsb=sum_nge1(-1)^n-1fracx^nn
    $$
    and
    $$
    log(1-x)=-x-fracx^22-fracx^33-dotsb=-sum_nge1fracx^nn
    $$
    which holds for $-1<x<1$. Subtracting the second from the first yields
    $$
    logfrac1+x1-x=2sum_nge0fracx^2n+12n+1
    $$
    The equation
    $$
    frac1+x1-x=7
    $$
    yields $x=3/4$.



    Now use the Lagrange remainder formula to ensure that the errors in the Taylor polynomial for $logfrac1+x1-x$ for $x=3/4$ is less than $10^-4/2$ and the in the Taylor polynomial for $cos x$ for $x=1$ is again less than $10^-4/2$.






    share|cite|improve this answer




















      Your Answer




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

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "69"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      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%2f2881202%2fapproximate-log7-cos1-with-an-error-of-less-than-10-4%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      By writing



      $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+cos(1) $$
      we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$. We have



      $$ cos(1)=sum_n=0^8frac(-1)^n(2n)!+E_1 = frac1130463162168120922789888000+E_1 $$
      with $|E_1|leq frac110!$. Similarly
      $$ logleft(1+frac17right) = sum_n=1^6frac(-1)^n+1n 7^n+E_2 = frac9425897058940+E_2 $$
      with $|E_2|leq frac18cdot 10^5$ and
      $$ log(2) = sum_n=1^15frac1n 2^n+E_3 = frac3197207946126080+E_3 $$
      with $|E_3|leq frac210^5$. In particular



      $$frac1130463162168120922789888000-frac9425897058940+3cdot frac3197207946126080=colorgreen2.4862071ldots $$
      is an approximation (a lower bound) of $log(7)+cos(1)$ within the required accuracy.
      An improved approach is to write
      $$ log(7)+cos(1) = 3log(2)+logleft(1-frac18right)+cos(1), $$
      approximate $cos(1)$ and $logleft(1-frac18right)$ via Maclaurin series and approximate $log(2)$ via $0leq int_0^1fracx^n(1-x)^n1+x,dxleqfrac14^n$. With $n=5$ we already get $log(2)approx frac23293360$ with an error $leq 8cdot 10^-6$.






      share|cite|improve this answer


























        up vote
        2
        down vote



        accepted










        By writing



        $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+cos(1) $$
        we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$. We have



        $$ cos(1)=sum_n=0^8frac(-1)^n(2n)!+E_1 = frac1130463162168120922789888000+E_1 $$
        with $|E_1|leq frac110!$. Similarly
        $$ logleft(1+frac17right) = sum_n=1^6frac(-1)^n+1n 7^n+E_2 = frac9425897058940+E_2 $$
        with $|E_2|leq frac18cdot 10^5$ and
        $$ log(2) = sum_n=1^15frac1n 2^n+E_3 = frac3197207946126080+E_3 $$
        with $|E_3|leq frac210^5$. In particular



        $$frac1130463162168120922789888000-frac9425897058940+3cdot frac3197207946126080=colorgreen2.4862071ldots $$
        is an approximation (a lower bound) of $log(7)+cos(1)$ within the required accuracy.
        An improved approach is to write
        $$ log(7)+cos(1) = 3log(2)+logleft(1-frac18right)+cos(1), $$
        approximate $cos(1)$ and $logleft(1-frac18right)$ via Maclaurin series and approximate $log(2)$ via $0leq int_0^1fracx^n(1-x)^n1+x,dxleqfrac14^n$. With $n=5$ we already get $log(2)approx frac23293360$ with an error $leq 8cdot 10^-6$.






        share|cite|improve this answer
























          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          By writing



          $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+cos(1) $$
          we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$. We have



          $$ cos(1)=sum_n=0^8frac(-1)^n(2n)!+E_1 = frac1130463162168120922789888000+E_1 $$
          with $|E_1|leq frac110!$. Similarly
          $$ logleft(1+frac17right) = sum_n=1^6frac(-1)^n+1n 7^n+E_2 = frac9425897058940+E_2 $$
          with $|E_2|leq frac18cdot 10^5$ and
          $$ log(2) = sum_n=1^15frac1n 2^n+E_3 = frac3197207946126080+E_3 $$
          with $|E_3|leq frac210^5$. In particular



          $$frac1130463162168120922789888000-frac9425897058940+3cdot frac3197207946126080=colorgreen2.4862071ldots $$
          is an approximation (a lower bound) of $log(7)+cos(1)$ within the required accuracy.
          An improved approach is to write
          $$ log(7)+cos(1) = 3log(2)+logleft(1-frac18right)+cos(1), $$
          approximate $cos(1)$ and $logleft(1-frac18right)$ via Maclaurin series and approximate $log(2)$ via $0leq int_0^1fracx^n(1-x)^n1+x,dxleqfrac14^n$. With $n=5$ we already get $log(2)approx frac23293360$ with an error $leq 8cdot 10^-6$.






          share|cite|improve this answer














          By writing



          $$ log(7)+cos(1) = -logleft(1+tfrac17right)-3logleft(1-tfrac12right)+cos(1) $$
          we may easily use few terms of the Maclaurin series of $log(1pm x)$ and $cos x$. We have



          $$ cos(1)=sum_n=0^8frac(-1)^n(2n)!+E_1 = frac1130463162168120922789888000+E_1 $$
          with $|E_1|leq frac110!$. Similarly
          $$ logleft(1+frac17right) = sum_n=1^6frac(-1)^n+1n 7^n+E_2 = frac9425897058940+E_2 $$
          with $|E_2|leq frac18cdot 10^5$ and
          $$ log(2) = sum_n=1^15frac1n 2^n+E_3 = frac3197207946126080+E_3 $$
          with $|E_3|leq frac210^5$. In particular



          $$frac1130463162168120922789888000-frac9425897058940+3cdot frac3197207946126080=colorgreen2.4862071ldots $$
          is an approximation (a lower bound) of $log(7)+cos(1)$ within the required accuracy.
          An improved approach is to write
          $$ log(7)+cos(1) = 3log(2)+logleft(1-frac18right)+cos(1), $$
          approximate $cos(1)$ and $logleft(1-frac18right)$ via Maclaurin series and approximate $log(2)$ via $0leq int_0^1fracx^n(1-x)^n1+x,dxleqfrac14^n$. With $n=5$ we already get $log(2)approx frac23293360$ with an error $leq 8cdot 10^-6$.







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Aug 13 at 11:14

























          answered Aug 13 at 10:56









          Jack D'Aurizio♦

          271k31266632




          271k31266632




















              up vote
              3
              down vote













              Consider
              $$
              log(1+x)=x-fracx^22+fracx^33-dotsb=sum_nge1(-1)^n-1fracx^nn
              $$
              and
              $$
              log(1-x)=-x-fracx^22-fracx^33-dotsb=-sum_nge1fracx^nn
              $$
              which holds for $-1<x<1$. Subtracting the second from the first yields
              $$
              logfrac1+x1-x=2sum_nge0fracx^2n+12n+1
              $$
              The equation
              $$
              frac1+x1-x=7
              $$
              yields $x=3/4$.



              Now use the Lagrange remainder formula to ensure that the errors in the Taylor polynomial for $logfrac1+x1-x$ for $x=3/4$ is less than $10^-4/2$ and the in the Taylor polynomial for $cos x$ for $x=1$ is again less than $10^-4/2$.






              share|cite|improve this answer
























                up vote
                3
                down vote













                Consider
                $$
                log(1+x)=x-fracx^22+fracx^33-dotsb=sum_nge1(-1)^n-1fracx^nn
                $$
                and
                $$
                log(1-x)=-x-fracx^22-fracx^33-dotsb=-sum_nge1fracx^nn
                $$
                which holds for $-1<x<1$. Subtracting the second from the first yields
                $$
                logfrac1+x1-x=2sum_nge0fracx^2n+12n+1
                $$
                The equation
                $$
                frac1+x1-x=7
                $$
                yields $x=3/4$.



                Now use the Lagrange remainder formula to ensure that the errors in the Taylor polynomial for $logfrac1+x1-x$ for $x=3/4$ is less than $10^-4/2$ and the in the Taylor polynomial for $cos x$ for $x=1$ is again less than $10^-4/2$.






                share|cite|improve this answer






















                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  Consider
                  $$
                  log(1+x)=x-fracx^22+fracx^33-dotsb=sum_nge1(-1)^n-1fracx^nn
                  $$
                  and
                  $$
                  log(1-x)=-x-fracx^22-fracx^33-dotsb=-sum_nge1fracx^nn
                  $$
                  which holds for $-1<x<1$. Subtracting the second from the first yields
                  $$
                  logfrac1+x1-x=2sum_nge0fracx^2n+12n+1
                  $$
                  The equation
                  $$
                  frac1+x1-x=7
                  $$
                  yields $x=3/4$.



                  Now use the Lagrange remainder formula to ensure that the errors in the Taylor polynomial for $logfrac1+x1-x$ for $x=3/4$ is less than $10^-4/2$ and the in the Taylor polynomial for $cos x$ for $x=1$ is again less than $10^-4/2$.






                  share|cite|improve this answer












                  Consider
                  $$
                  log(1+x)=x-fracx^22+fracx^33-dotsb=sum_nge1(-1)^n-1fracx^nn
                  $$
                  and
                  $$
                  log(1-x)=-x-fracx^22-fracx^33-dotsb=-sum_nge1fracx^nn
                  $$
                  which holds for $-1<x<1$. Subtracting the second from the first yields
                  $$
                  logfrac1+x1-x=2sum_nge0fracx^2n+12n+1
                  $$
                  The equation
                  $$
                  frac1+x1-x=7
                  $$
                  yields $x=3/4$.



                  Now use the Lagrange remainder formula to ensure that the errors in the Taylor polynomial for $logfrac1+x1-x$ for $x=3/4$ is less than $10^-4/2$ and the in the Taylor polynomial for $cos x$ for $x=1$ is again less than $10^-4/2$.







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Aug 13 at 10:30









                  egreg

                  165k1180187




                  165k1180187






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2881202%2fapproximate-log7-cos1-with-an-error-of-less-than-10-4%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      這個網誌中的熱門文章

                      How to combine Bézier curves to a surface?

                      Mutual Information Always Non-negative

                      Why am i infinitely getting the same tweet with the Twitter Search API?