Second order accurate numerical approximation for first derivative Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Taylor expansion: first derivative approximation with third orderBoundary Conditions for a Finite Difference Approximation of a Sixth Derivative“Symmetric” numerical computation of second derivativeNumerical differentiation (approximation with three supporting points )Second order one-sided finite difference approximation to a partial derivative4th order accurate difference formula less accurate than 2nd order formula?Approximation of the first derivative by writing Taylor expansionsDerivation of fourth-order accurate formula for the second derivativeApproximation of $log(x)$ for very small $x$Second order approximation of first derivative gives odd results
What is a more techy Technical Writer job title that isn't cutesy or confusing?
Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?
Trying to understand entropy as a novice in thermodynamics
I can't produce songs
Was Kant an Intuitionist about mathematical objects?
Special flights
Is multiple magic items in one inherently imbalanced?
How can I prevent/balance waiting and turtling as a response to cooldown mechanics
One-one communication
Is there public access to the Meteor Crater in Arizona?
Why is the change of basis formula counter-intuitive? [See details]
Is it dangerous to install hacking tools on my private linux machine?
Why BitLocker does not use RSA
AppleTVs create a chatty alternate WiFi network
How does light 'choose' between wave and particle behaviour?
I got rid of Mac OSX and replaced it with linux but now I can't change it back to OSX or windows
Should a wizard buy fine inks every time he want to copy spells into his spellbook?
Why complex landing gears are used instead of simple,reliability and light weight muscle wire or shape memory alloys?
What is the "studentd" process?
The Nth Gryphon Number
What does the writing on Poe's helmet say?
Sally's older brother
Can an iPhone 7 be made to function as a NFC Tag?
How do living politicians protect their readily obtainable signatures from misuse?
Second order accurate numerical approximation for first derivative
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Taylor expansion: first derivative approximation with third orderBoundary Conditions for a Finite Difference Approximation of a Sixth Derivative“Symmetric” numerical computation of second derivativeNumerical differentiation (approximation with three supporting points )Second order one-sided finite difference approximation to a partial derivative4th order accurate difference formula less accurate than 2nd order formula?Approximation of the first derivative by writing Taylor expansionsDerivation of fourth-order accurate formula for the second derivativeApproximation of $log(x)$ for very small $x$Second order approximation of first derivative gives odd results
$begingroup$
We just learnt about one sided and centred difference approximations in class and we have been given a problem to find $a_0, a_1$ and $a_2$ in the below numerical approximation for a first derivative in order to make the approximation second order accurate:$$F'(x) approx frac1Delta x[a_0F(x + Delta x) + a_1F(x + 2 Delta x) + a_2F(x + 3 Delta x)].$$
Would it be right to say that we want the RHS to be in this form: $$fracF(x + Delta x) - F(x -Delta x)2 Delta x$$ and so, somehow, we'd manipulate the Taylor expansion of each $F(...)$ term in the first derivative approximation equation?
derivatives numerical-methods
$endgroup$
add a comment |
$begingroup$
We just learnt about one sided and centred difference approximations in class and we have been given a problem to find $a_0, a_1$ and $a_2$ in the below numerical approximation for a first derivative in order to make the approximation second order accurate:$$F'(x) approx frac1Delta x[a_0F(x + Delta x) + a_1F(x + 2 Delta x) + a_2F(x + 3 Delta x)].$$
Would it be right to say that we want the RHS to be in this form: $$fracF(x + Delta x) - F(x -Delta x)2 Delta x$$ and so, somehow, we'd manipulate the Taylor expansion of each $F(...)$ term in the first derivative approximation equation?
derivatives numerical-methods
$endgroup$
add a comment |
$begingroup$
We just learnt about one sided and centred difference approximations in class and we have been given a problem to find $a_0, a_1$ and $a_2$ in the below numerical approximation for a first derivative in order to make the approximation second order accurate:$$F'(x) approx frac1Delta x[a_0F(x + Delta x) + a_1F(x + 2 Delta x) + a_2F(x + 3 Delta x)].$$
Would it be right to say that we want the RHS to be in this form: $$fracF(x + Delta x) - F(x -Delta x)2 Delta x$$ and so, somehow, we'd manipulate the Taylor expansion of each $F(...)$ term in the first derivative approximation equation?
derivatives numerical-methods
$endgroup$
We just learnt about one sided and centred difference approximations in class and we have been given a problem to find $a_0, a_1$ and $a_2$ in the below numerical approximation for a first derivative in order to make the approximation second order accurate:$$F'(x) approx frac1Delta x[a_0F(x + Delta x) + a_1F(x + 2 Delta x) + a_2F(x + 3 Delta x)].$$
Would it be right to say that we want the RHS to be in this form: $$fracF(x + Delta x) - F(x -Delta x)2 Delta x$$ and so, somehow, we'd manipulate the Taylor expansion of each $F(...)$ term in the first derivative approximation equation?
derivatives numerical-methods
derivatives numerical-methods
asked Apr 2 at 10:56
FrancisFrancis
393
393
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
The formula you mention is a centered difference, but you are required to obtain a forward difference. You just need to use Taylor's formula and compute the coefficients that cancel out the lower order terms.
$$
F(x+Delta x)= F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+ 2 Delta x)= F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+3Delta x)= F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3)
$$
so you see that
beginalign*
F'(x)-frac1Delta x & (a_0 F(x+Delta x)+a_1 F(x+2Delta x) + a_2 F(x+3 Delta x))\
=& frac1Delta xleft(F'(x) Delta x - a_0 (F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3))right.\
& - a_1 (F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3))\
& left.- a_2 (F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3))right)\
=& frac1Delta xleft( -(a_0+a_1+a_2)F(x)+(1-a_0-2a_1-3a_2)F'(x)Delta xright.\
& left.-(a_0+4a_1+9a_2)F''(x) (Delta x)^2/2 + O((Delta x)^3)right)
endalign*
To get the desired accuracy you just have to set $a_0, a_1, a_2$ such that
$$
a_0+a_1+a_2=0, quad a_0+2a_1+3a_2 = 1, quad a_0+4a_2+9a_2=0,
$$
that is
$$
a_0 = -frac 52, quad a_1 =4, quad a_2=-frac 32
$$
and the formula becomes
$$
F'(x) approx frac12Delta x left(-5 F(x+Delta x)+8F(x+2 Delta x) - 4F(x+3 Delta x) right)
$$
$endgroup$
add a comment |
$begingroup$
$a_0f(x+Delta x) = a_0f(x) + a_0Delta xf'(x) + a_0frac12Delta x^2f'(x) + a_0frac16Delta x^3f'''(xi_1)$
$a_1f(x+2Delta x) = a_1f(x) + a_12Delta xf'(x) +
a_12Delta x^2f''(x) + a_1frac43Delta x^3f'''(xi_2)$
$a_2f(x+3Delta x) = a_2f(x) + a_23Delta xf(x) + a_2frac94Delta x^2f''(x) + a_2frac92Delta x^3f'''(xi_3) $
this implies the augmented matrix:
$left(beginarrayc
1 & 1 & 1 & 0\
1 & 2 & 3 & 1 \
frac12 & 2 & frac94 & 0
endarrayright)$
do you see why?
$endgroup$
add a comment |
Your Answer
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3171715%2fsecond-order-accurate-numerical-approximation-for-first-derivative%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
$begingroup$
The formula you mention is a centered difference, but you are required to obtain a forward difference. You just need to use Taylor's formula and compute the coefficients that cancel out the lower order terms.
$$
F(x+Delta x)= F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+ 2 Delta x)= F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+3Delta x)= F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3)
$$
so you see that
beginalign*
F'(x)-frac1Delta x & (a_0 F(x+Delta x)+a_1 F(x+2Delta x) + a_2 F(x+3 Delta x))\
=& frac1Delta xleft(F'(x) Delta x - a_0 (F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3))right.\
& - a_1 (F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3))\
& left.- a_2 (F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3))right)\
=& frac1Delta xleft( -(a_0+a_1+a_2)F(x)+(1-a_0-2a_1-3a_2)F'(x)Delta xright.\
& left.-(a_0+4a_1+9a_2)F''(x) (Delta x)^2/2 + O((Delta x)^3)right)
endalign*
To get the desired accuracy you just have to set $a_0, a_1, a_2$ such that
$$
a_0+a_1+a_2=0, quad a_0+2a_1+3a_2 = 1, quad a_0+4a_2+9a_2=0,
$$
that is
$$
a_0 = -frac 52, quad a_1 =4, quad a_2=-frac 32
$$
and the formula becomes
$$
F'(x) approx frac12Delta x left(-5 F(x+Delta x)+8F(x+2 Delta x) - 4F(x+3 Delta x) right)
$$
$endgroup$
add a comment |
$begingroup$
The formula you mention is a centered difference, but you are required to obtain a forward difference. You just need to use Taylor's formula and compute the coefficients that cancel out the lower order terms.
$$
F(x+Delta x)= F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+ 2 Delta x)= F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+3Delta x)= F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3)
$$
so you see that
beginalign*
F'(x)-frac1Delta x & (a_0 F(x+Delta x)+a_1 F(x+2Delta x) + a_2 F(x+3 Delta x))\
=& frac1Delta xleft(F'(x) Delta x - a_0 (F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3))right.\
& - a_1 (F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3))\
& left.- a_2 (F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3))right)\
=& frac1Delta xleft( -(a_0+a_1+a_2)F(x)+(1-a_0-2a_1-3a_2)F'(x)Delta xright.\
& left.-(a_0+4a_1+9a_2)F''(x) (Delta x)^2/2 + O((Delta x)^3)right)
endalign*
To get the desired accuracy you just have to set $a_0, a_1, a_2$ such that
$$
a_0+a_1+a_2=0, quad a_0+2a_1+3a_2 = 1, quad a_0+4a_2+9a_2=0,
$$
that is
$$
a_0 = -frac 52, quad a_1 =4, quad a_2=-frac 32
$$
and the formula becomes
$$
F'(x) approx frac12Delta x left(-5 F(x+Delta x)+8F(x+2 Delta x) - 4F(x+3 Delta x) right)
$$
$endgroup$
add a comment |
$begingroup$
The formula you mention is a centered difference, but you are required to obtain a forward difference. You just need to use Taylor's formula and compute the coefficients that cancel out the lower order terms.
$$
F(x+Delta x)= F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+ 2 Delta x)= F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+3Delta x)= F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3)
$$
so you see that
beginalign*
F'(x)-frac1Delta x & (a_0 F(x+Delta x)+a_1 F(x+2Delta x) + a_2 F(x+3 Delta x))\
=& frac1Delta xleft(F'(x) Delta x - a_0 (F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3))right.\
& - a_1 (F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3))\
& left.- a_2 (F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3))right)\
=& frac1Delta xleft( -(a_0+a_1+a_2)F(x)+(1-a_0-2a_1-3a_2)F'(x)Delta xright.\
& left.-(a_0+4a_1+9a_2)F''(x) (Delta x)^2/2 + O((Delta x)^3)right)
endalign*
To get the desired accuracy you just have to set $a_0, a_1, a_2$ such that
$$
a_0+a_1+a_2=0, quad a_0+2a_1+3a_2 = 1, quad a_0+4a_2+9a_2=0,
$$
that is
$$
a_0 = -frac 52, quad a_1 =4, quad a_2=-frac 32
$$
and the formula becomes
$$
F'(x) approx frac12Delta x left(-5 F(x+Delta x)+8F(x+2 Delta x) - 4F(x+3 Delta x) right)
$$
$endgroup$
The formula you mention is a centered difference, but you are required to obtain a forward difference. You just need to use Taylor's formula and compute the coefficients that cancel out the lower order terms.
$$
F(x+Delta x)= F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+ 2 Delta x)= F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3)
$$
$$
F(x+3Delta x)= F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3)
$$
so you see that
beginalign*
F'(x)-frac1Delta x & (a_0 F(x+Delta x)+a_1 F(x+2Delta x) + a_2 F(x+3 Delta x))\
=& frac1Delta xleft(F'(x) Delta x - a_0 (F(x)+F'(x) Delta x + fracF''(x)2 (Delta x)^2 + O((Delta x)^3))right.\
& - a_1 (F(x)+F'(x) 2 Delta x + fracF''(x)2 (2 Delta x)^2 + O((Delta x)^3))\
& left.- a_2 (F(x)+F'(x) 3Delta x + fracF''(x)2 (3Delta x)^2 + O((Delta x)^3))right)\
=& frac1Delta xleft( -(a_0+a_1+a_2)F(x)+(1-a_0-2a_1-3a_2)F'(x)Delta xright.\
& left.-(a_0+4a_1+9a_2)F''(x) (Delta x)^2/2 + O((Delta x)^3)right)
endalign*
To get the desired accuracy you just have to set $a_0, a_1, a_2$ such that
$$
a_0+a_1+a_2=0, quad a_0+2a_1+3a_2 = 1, quad a_0+4a_2+9a_2=0,
$$
that is
$$
a_0 = -frac 52, quad a_1 =4, quad a_2=-frac 32
$$
and the formula becomes
$$
F'(x) approx frac12Delta x left(-5 F(x+Delta x)+8F(x+2 Delta x) - 4F(x+3 Delta x) right)
$$
answered Apr 4 at 8:04
PierreCarrePierreCarre
2,2781215
2,2781215
add a comment |
add a comment |
$begingroup$
$a_0f(x+Delta x) = a_0f(x) + a_0Delta xf'(x) + a_0frac12Delta x^2f'(x) + a_0frac16Delta x^3f'''(xi_1)$
$a_1f(x+2Delta x) = a_1f(x) + a_12Delta xf'(x) +
a_12Delta x^2f''(x) + a_1frac43Delta x^3f'''(xi_2)$
$a_2f(x+3Delta x) = a_2f(x) + a_23Delta xf(x) + a_2frac94Delta x^2f''(x) + a_2frac92Delta x^3f'''(xi_3) $
this implies the augmented matrix:
$left(beginarrayc
1 & 1 & 1 & 0\
1 & 2 & 3 & 1 \
frac12 & 2 & frac94 & 0
endarrayright)$
do you see why?
$endgroup$
add a comment |
$begingroup$
$a_0f(x+Delta x) = a_0f(x) + a_0Delta xf'(x) + a_0frac12Delta x^2f'(x) + a_0frac16Delta x^3f'''(xi_1)$
$a_1f(x+2Delta x) = a_1f(x) + a_12Delta xf'(x) +
a_12Delta x^2f''(x) + a_1frac43Delta x^3f'''(xi_2)$
$a_2f(x+3Delta x) = a_2f(x) + a_23Delta xf(x) + a_2frac94Delta x^2f''(x) + a_2frac92Delta x^3f'''(xi_3) $
this implies the augmented matrix:
$left(beginarrayc
1 & 1 & 1 & 0\
1 & 2 & 3 & 1 \
frac12 & 2 & frac94 & 0
endarrayright)$
do you see why?
$endgroup$
add a comment |
$begingroup$
$a_0f(x+Delta x) = a_0f(x) + a_0Delta xf'(x) + a_0frac12Delta x^2f'(x) + a_0frac16Delta x^3f'''(xi_1)$
$a_1f(x+2Delta x) = a_1f(x) + a_12Delta xf'(x) +
a_12Delta x^2f''(x) + a_1frac43Delta x^3f'''(xi_2)$
$a_2f(x+3Delta x) = a_2f(x) + a_23Delta xf(x) + a_2frac94Delta x^2f''(x) + a_2frac92Delta x^3f'''(xi_3) $
this implies the augmented matrix:
$left(beginarrayc
1 & 1 & 1 & 0\
1 & 2 & 3 & 1 \
frac12 & 2 & frac94 & 0
endarrayright)$
do you see why?
$endgroup$
$a_0f(x+Delta x) = a_0f(x) + a_0Delta xf'(x) + a_0frac12Delta x^2f'(x) + a_0frac16Delta x^3f'''(xi_1)$
$a_1f(x+2Delta x) = a_1f(x) + a_12Delta xf'(x) +
a_12Delta x^2f''(x) + a_1frac43Delta x^3f'''(xi_2)$
$a_2f(x+3Delta x) = a_2f(x) + a_23Delta xf(x) + a_2frac94Delta x^2f''(x) + a_2frac92Delta x^3f'''(xi_3) $
this implies the augmented matrix:
$left(beginarrayc
1 & 1 & 1 & 0\
1 & 2 & 3 & 1 \
frac12 & 2 & frac94 & 0
endarrayright)$
do you see why?
answered Apr 4 at 5:36
GeauxMathGeauxMath
1114
1114
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3171715%2fsecond-order-accurate-numerical-approximation-for-first-derivative%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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