Calculating a function value with Taylor series












1














Given a function $f(x)$, how do I calculate it's value with given error range?



For example, how do I calculate $g(-0.1)$ with an error $< 0.001$ when:



$$g(x)=sin(x)+cos(x)$$










share|cite|improve this question
























  • So you want to know until what order you need to take the Tayor series?
    – WarreG
    10 hours ago
















1














Given a function $f(x)$, how do I calculate it's value with given error range?



For example, how do I calculate $g(-0.1)$ with an error $< 0.001$ when:



$$g(x)=sin(x)+cos(x)$$










share|cite|improve this question
























  • So you want to know until what order you need to take the Tayor series?
    – WarreG
    10 hours ago














1












1








1







Given a function $f(x)$, how do I calculate it's value with given error range?



For example, how do I calculate $g(-0.1)$ with an error $< 0.001$ when:



$$g(x)=sin(x)+cos(x)$$










share|cite|improve this question















Given a function $f(x)$, how do I calculate it's value with given error range?



For example, how do I calculate $g(-0.1)$ with an error $< 0.001$ when:



$$g(x)=sin(x)+cos(x)$$







calculus taylor-expansion






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited 7 hours ago









PM.

3,3732825




3,3732825










asked 13 hours ago









Igor

315




315












  • So you want to know until what order you need to take the Tayor series?
    – WarreG
    10 hours ago


















  • So you want to know until what order you need to take the Tayor series?
    – WarreG
    10 hours ago
















So you want to know until what order you need to take the Tayor series?
– WarreG
10 hours ago




So you want to know until what order you need to take the Tayor series?
– WarreG
10 hours ago










2 Answers
2






active

oldest

votes


















3














With
$$
f(x)=f(0)+frac{f^{(1)}(0)}{1!}x+cdots+frac{f^{(n)}(0)}{n!}x^n+R_n(x)
$$



Use the Lagrange form for the remainder
$$
R_n(x)=frac{f^{(n+1)}(c)}{(n+1)!}x^{(n+1)}
$$

where $c$ is between $x$ and $0$.



The derivatives of $g(x)$ are always $pmsin(x)pm cos(x)$ and so
$$
| f^{(n+1)}(c) | le 2
$$

for any $c$.



Then considering the magnitude of the error, find n such that
$$
2 frac{(0.1)^{(n+1)}}{(n+1)!} lt 0.001
$$






share|cite|improve this answer































    0














    The Taylor series of $g(x) = sin(x) + cos(x)$ is
    $$
    1+x-frac{x^2}{2!}-frac{x^3}{3!}+frac{x^4}{4!}+frac{x^5}{5!}- ...
    $$

    You want to evaluate the function $g(-0.1)$ such that it's error is smaller than $0.001$.
    From the Taylor series you can see that the third term $frac{x^3}{3!}$ will be of that order, because $frac{-0.1^3}{6} sim 0.001$. The next term in the series will always be an order smaller so the error will be of the order of $0.0001$ or $mathcal{O}(x^4).$



    What you are left with is
    $$
    g(x) approx 1+x-frac{x^2}{2!}-frac{x^3}{3!}.
    $$

    Now you just fill in $-0.1$ to retrieve the value of the function in that point.






    share|cite|improve this answer

















    • 2




      Sorry, but your answer is at least misleading. "The next term" is NOT the same as "the remainder (the sum of all remaining terms)". That's true for series satisfying the Alternating Series Test, and often true for rapidly convergent series, but it's not true in general. So your statement that The next term in the series will always be an order smaller so the error will be... is false.
      – zipirovich
      9 hours ago












    • I'm saying for this example the next term will be an order smaller. I'm not stating anything general here.
      – WarreG
      8 hours ago










    • Yes, the next term will be smaller. But technically speaking, in general that's irrelevant to the question: the error is given by the remainder, not by the next term. If you claim that in this series the error $=$ the remainder can be bounded by the next term, you have to justify this claim. Otherwise, it's wrong.
      – zipirovich
      8 hours ago












    • You are right. But in this case, because $-1 < x <1$ the value will converge very rapidly to the exact value. Because each following term is guaranteed to be smaller you can approximately guess what order you have to use for the Taylor series, where the question actually is about. I leave it to you then to write an answer with the total remainder.
      – WarreG
      8 hours ago











    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%2f3061499%2fcalculating-a-function-value-with-taylor-series%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









    3














    With
    $$
    f(x)=f(0)+frac{f^{(1)}(0)}{1!}x+cdots+frac{f^{(n)}(0)}{n!}x^n+R_n(x)
    $$



    Use the Lagrange form for the remainder
    $$
    R_n(x)=frac{f^{(n+1)}(c)}{(n+1)!}x^{(n+1)}
    $$

    where $c$ is between $x$ and $0$.



    The derivatives of $g(x)$ are always $pmsin(x)pm cos(x)$ and so
    $$
    | f^{(n+1)}(c) | le 2
    $$

    for any $c$.



    Then considering the magnitude of the error, find n such that
    $$
    2 frac{(0.1)^{(n+1)}}{(n+1)!} lt 0.001
    $$






    share|cite|improve this answer




























      3














      With
      $$
      f(x)=f(0)+frac{f^{(1)}(0)}{1!}x+cdots+frac{f^{(n)}(0)}{n!}x^n+R_n(x)
      $$



      Use the Lagrange form for the remainder
      $$
      R_n(x)=frac{f^{(n+1)}(c)}{(n+1)!}x^{(n+1)}
      $$

      where $c$ is between $x$ and $0$.



      The derivatives of $g(x)$ are always $pmsin(x)pm cos(x)$ and so
      $$
      | f^{(n+1)}(c) | le 2
      $$

      for any $c$.



      Then considering the magnitude of the error, find n such that
      $$
      2 frac{(0.1)^{(n+1)}}{(n+1)!} lt 0.001
      $$






      share|cite|improve this answer


























        3












        3








        3






        With
        $$
        f(x)=f(0)+frac{f^{(1)}(0)}{1!}x+cdots+frac{f^{(n)}(0)}{n!}x^n+R_n(x)
        $$



        Use the Lagrange form for the remainder
        $$
        R_n(x)=frac{f^{(n+1)}(c)}{(n+1)!}x^{(n+1)}
        $$

        where $c$ is between $x$ and $0$.



        The derivatives of $g(x)$ are always $pmsin(x)pm cos(x)$ and so
        $$
        | f^{(n+1)}(c) | le 2
        $$

        for any $c$.



        Then considering the magnitude of the error, find n such that
        $$
        2 frac{(0.1)^{(n+1)}}{(n+1)!} lt 0.001
        $$






        share|cite|improve this answer














        With
        $$
        f(x)=f(0)+frac{f^{(1)}(0)}{1!}x+cdots+frac{f^{(n)}(0)}{n!}x^n+R_n(x)
        $$



        Use the Lagrange form for the remainder
        $$
        R_n(x)=frac{f^{(n+1)}(c)}{(n+1)!}x^{(n+1)}
        $$

        where $c$ is between $x$ and $0$.



        The derivatives of $g(x)$ are always $pmsin(x)pm cos(x)$ and so
        $$
        | f^{(n+1)}(c) | le 2
        $$

        for any $c$.



        Then considering the magnitude of the error, find n such that
        $$
        2 frac{(0.1)^{(n+1)}}{(n+1)!} lt 0.001
        $$







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited 7 hours ago

























        answered 7 hours ago









        PM.

        3,3732825




        3,3732825























            0














            The Taylor series of $g(x) = sin(x) + cos(x)$ is
            $$
            1+x-frac{x^2}{2!}-frac{x^3}{3!}+frac{x^4}{4!}+frac{x^5}{5!}- ...
            $$

            You want to evaluate the function $g(-0.1)$ such that it's error is smaller than $0.001$.
            From the Taylor series you can see that the third term $frac{x^3}{3!}$ will be of that order, because $frac{-0.1^3}{6} sim 0.001$. The next term in the series will always be an order smaller so the error will be of the order of $0.0001$ or $mathcal{O}(x^4).$



            What you are left with is
            $$
            g(x) approx 1+x-frac{x^2}{2!}-frac{x^3}{3!}.
            $$

            Now you just fill in $-0.1$ to retrieve the value of the function in that point.






            share|cite|improve this answer

















            • 2




              Sorry, but your answer is at least misleading. "The next term" is NOT the same as "the remainder (the sum of all remaining terms)". That's true for series satisfying the Alternating Series Test, and often true for rapidly convergent series, but it's not true in general. So your statement that The next term in the series will always be an order smaller so the error will be... is false.
              – zipirovich
              9 hours ago












            • I'm saying for this example the next term will be an order smaller. I'm not stating anything general here.
              – WarreG
              8 hours ago










            • Yes, the next term will be smaller. But technically speaking, in general that's irrelevant to the question: the error is given by the remainder, not by the next term. If you claim that in this series the error $=$ the remainder can be bounded by the next term, you have to justify this claim. Otherwise, it's wrong.
              – zipirovich
              8 hours ago












            • You are right. But in this case, because $-1 < x <1$ the value will converge very rapidly to the exact value. Because each following term is guaranteed to be smaller you can approximately guess what order you have to use for the Taylor series, where the question actually is about. I leave it to you then to write an answer with the total remainder.
              – WarreG
              8 hours ago
















            0














            The Taylor series of $g(x) = sin(x) + cos(x)$ is
            $$
            1+x-frac{x^2}{2!}-frac{x^3}{3!}+frac{x^4}{4!}+frac{x^5}{5!}- ...
            $$

            You want to evaluate the function $g(-0.1)$ such that it's error is smaller than $0.001$.
            From the Taylor series you can see that the third term $frac{x^3}{3!}$ will be of that order, because $frac{-0.1^3}{6} sim 0.001$. The next term in the series will always be an order smaller so the error will be of the order of $0.0001$ or $mathcal{O}(x^4).$



            What you are left with is
            $$
            g(x) approx 1+x-frac{x^2}{2!}-frac{x^3}{3!}.
            $$

            Now you just fill in $-0.1$ to retrieve the value of the function in that point.






            share|cite|improve this answer

















            • 2




              Sorry, but your answer is at least misleading. "The next term" is NOT the same as "the remainder (the sum of all remaining terms)". That's true for series satisfying the Alternating Series Test, and often true for rapidly convergent series, but it's not true in general. So your statement that The next term in the series will always be an order smaller so the error will be... is false.
              – zipirovich
              9 hours ago












            • I'm saying for this example the next term will be an order smaller. I'm not stating anything general here.
              – WarreG
              8 hours ago










            • Yes, the next term will be smaller. But technically speaking, in general that's irrelevant to the question: the error is given by the remainder, not by the next term. If you claim that in this series the error $=$ the remainder can be bounded by the next term, you have to justify this claim. Otherwise, it's wrong.
              – zipirovich
              8 hours ago












            • You are right. But in this case, because $-1 < x <1$ the value will converge very rapidly to the exact value. Because each following term is guaranteed to be smaller you can approximately guess what order you have to use for the Taylor series, where the question actually is about. I leave it to you then to write an answer with the total remainder.
              – WarreG
              8 hours ago














            0












            0








            0






            The Taylor series of $g(x) = sin(x) + cos(x)$ is
            $$
            1+x-frac{x^2}{2!}-frac{x^3}{3!}+frac{x^4}{4!}+frac{x^5}{5!}- ...
            $$

            You want to evaluate the function $g(-0.1)$ such that it's error is smaller than $0.001$.
            From the Taylor series you can see that the third term $frac{x^3}{3!}$ will be of that order, because $frac{-0.1^3}{6} sim 0.001$. The next term in the series will always be an order smaller so the error will be of the order of $0.0001$ or $mathcal{O}(x^4).$



            What you are left with is
            $$
            g(x) approx 1+x-frac{x^2}{2!}-frac{x^3}{3!}.
            $$

            Now you just fill in $-0.1$ to retrieve the value of the function in that point.






            share|cite|improve this answer












            The Taylor series of $g(x) = sin(x) + cos(x)$ is
            $$
            1+x-frac{x^2}{2!}-frac{x^3}{3!}+frac{x^4}{4!}+frac{x^5}{5!}- ...
            $$

            You want to evaluate the function $g(-0.1)$ such that it's error is smaller than $0.001$.
            From the Taylor series you can see that the third term $frac{x^3}{3!}$ will be of that order, because $frac{-0.1^3}{6} sim 0.001$. The next term in the series will always be an order smaller so the error will be of the order of $0.0001$ or $mathcal{O}(x^4).$



            What you are left with is
            $$
            g(x) approx 1+x-frac{x^2}{2!}-frac{x^3}{3!}.
            $$

            Now you just fill in $-0.1$ to retrieve the value of the function in that point.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered 9 hours ago









            WarreG

            2089




            2089








            • 2




              Sorry, but your answer is at least misleading. "The next term" is NOT the same as "the remainder (the sum of all remaining terms)". That's true for series satisfying the Alternating Series Test, and often true for rapidly convergent series, but it's not true in general. So your statement that The next term in the series will always be an order smaller so the error will be... is false.
              – zipirovich
              9 hours ago












            • I'm saying for this example the next term will be an order smaller. I'm not stating anything general here.
              – WarreG
              8 hours ago










            • Yes, the next term will be smaller. But technically speaking, in general that's irrelevant to the question: the error is given by the remainder, not by the next term. If you claim that in this series the error $=$ the remainder can be bounded by the next term, you have to justify this claim. Otherwise, it's wrong.
              – zipirovich
              8 hours ago












            • You are right. But in this case, because $-1 < x <1$ the value will converge very rapidly to the exact value. Because each following term is guaranteed to be smaller you can approximately guess what order you have to use for the Taylor series, where the question actually is about. I leave it to you then to write an answer with the total remainder.
              – WarreG
              8 hours ago














            • 2




              Sorry, but your answer is at least misleading. "The next term" is NOT the same as "the remainder (the sum of all remaining terms)". That's true for series satisfying the Alternating Series Test, and often true for rapidly convergent series, but it's not true in general. So your statement that The next term in the series will always be an order smaller so the error will be... is false.
              – zipirovich
              9 hours ago












            • I'm saying for this example the next term will be an order smaller. I'm not stating anything general here.
              – WarreG
              8 hours ago










            • Yes, the next term will be smaller. But technically speaking, in general that's irrelevant to the question: the error is given by the remainder, not by the next term. If you claim that in this series the error $=$ the remainder can be bounded by the next term, you have to justify this claim. Otherwise, it's wrong.
              – zipirovich
              8 hours ago












            • You are right. But in this case, because $-1 < x <1$ the value will converge very rapidly to the exact value. Because each following term is guaranteed to be smaller you can approximately guess what order you have to use for the Taylor series, where the question actually is about. I leave it to you then to write an answer with the total remainder.
              – WarreG
              8 hours ago








            2




            2




            Sorry, but your answer is at least misleading. "The next term" is NOT the same as "the remainder (the sum of all remaining terms)". That's true for series satisfying the Alternating Series Test, and often true for rapidly convergent series, but it's not true in general. So your statement that The next term in the series will always be an order smaller so the error will be... is false.
            – zipirovich
            9 hours ago






            Sorry, but your answer is at least misleading. "The next term" is NOT the same as "the remainder (the sum of all remaining terms)". That's true for series satisfying the Alternating Series Test, and often true for rapidly convergent series, but it's not true in general. So your statement that The next term in the series will always be an order smaller so the error will be... is false.
            – zipirovich
            9 hours ago














            I'm saying for this example the next term will be an order smaller. I'm not stating anything general here.
            – WarreG
            8 hours ago




            I'm saying for this example the next term will be an order smaller. I'm not stating anything general here.
            – WarreG
            8 hours ago












            Yes, the next term will be smaller. But technically speaking, in general that's irrelevant to the question: the error is given by the remainder, not by the next term. If you claim that in this series the error $=$ the remainder can be bounded by the next term, you have to justify this claim. Otherwise, it's wrong.
            – zipirovich
            8 hours ago






            Yes, the next term will be smaller. But technically speaking, in general that's irrelevant to the question: the error is given by the remainder, not by the next term. If you claim that in this series the error $=$ the remainder can be bounded by the next term, you have to justify this claim. Otherwise, it's wrong.
            – zipirovich
            8 hours ago














            You are right. But in this case, because $-1 < x <1$ the value will converge very rapidly to the exact value. Because each following term is guaranteed to be smaller you can approximately guess what order you have to use for the Taylor series, where the question actually is about. I leave it to you then to write an answer with the total remainder.
            – WarreG
            8 hours ago




            You are right. But in this case, because $-1 < x <1$ the value will converge very rapidly to the exact value. Because each following term is guaranteed to be smaller you can approximately guess what order you have to use for the Taylor series, where the question actually is about. I leave it to you then to write an answer with the total remainder.
            – WarreG
            8 hours ago


















            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


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


            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%2f3061499%2fcalculating-a-function-value-with-taylor-series%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

            Mario Kart Wii

            What does “Dominus providebit” mean?

            Antonio Litta Visconti Arese