Crank-Nicolson is much less accurate than implicit FTCS.

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











up vote
1
down vote

favorite
1












I am worried about this. I am solving the heat equation with α=1 and homogeneous Dirichlet boundary conditions. I use dt=0.00001, dx=0.01, nx=101 in the interval [0,1]. I found that the implicit FTCS gives me an error (difference between the analytic solution and the numerically computed solution) between 0 and 0.006. The C-N method for exactly the same problem gives me an error between 0 and 0.14. That is about two orders of magnitude larger in C-N. I expected higer precision in C-N. Any idea why is this happening? I evaluated the error in times 0.1,0.2,0.3,0.4,0.5. I have
graphs for this with $x in [0,1]$ with $dx=0.01$. All is done in Python.



I appreciate any suggestion about this (other than telling me I have a bug in my code. I seriously consider this as an option and I am looking into this, but I cannot yet find a bug).



When I use $dt=0.1$ C-N is more accurate than FTCS. Errors in C-N in $[-0.12,0.3]$ and FTCS $[0,0.8]$.



Thanks.







share|cite|improve this question




















  • A better site for this question would be scicomp.stackexchange.com.
    – Mattos
    Aug 26 at 23:14










  • @Mattos: Thanks for your suggestion. I will post it there. I guess I can include Python code there, right?
    – Herman Jaramillo
    Aug 27 at 1:43






  • 1




    Yes, you can include your code there.
    – Mattos
    Aug 27 at 2:43














up vote
1
down vote

favorite
1












I am worried about this. I am solving the heat equation with α=1 and homogeneous Dirichlet boundary conditions. I use dt=0.00001, dx=0.01, nx=101 in the interval [0,1]. I found that the implicit FTCS gives me an error (difference between the analytic solution and the numerically computed solution) between 0 and 0.006. The C-N method for exactly the same problem gives me an error between 0 and 0.14. That is about two orders of magnitude larger in C-N. I expected higer precision in C-N. Any idea why is this happening? I evaluated the error in times 0.1,0.2,0.3,0.4,0.5. I have
graphs for this with $x in [0,1]$ with $dx=0.01$. All is done in Python.



I appreciate any suggestion about this (other than telling me I have a bug in my code. I seriously consider this as an option and I am looking into this, but I cannot yet find a bug).



When I use $dt=0.1$ C-N is more accurate than FTCS. Errors in C-N in $[-0.12,0.3]$ and FTCS $[0,0.8]$.



Thanks.







share|cite|improve this question




















  • A better site for this question would be scicomp.stackexchange.com.
    – Mattos
    Aug 26 at 23:14










  • @Mattos: Thanks for your suggestion. I will post it there. I guess I can include Python code there, right?
    – Herman Jaramillo
    Aug 27 at 1:43






  • 1




    Yes, you can include your code there.
    – Mattos
    Aug 27 at 2:43












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I am worried about this. I am solving the heat equation with α=1 and homogeneous Dirichlet boundary conditions. I use dt=0.00001, dx=0.01, nx=101 in the interval [0,1]. I found that the implicit FTCS gives me an error (difference between the analytic solution and the numerically computed solution) between 0 and 0.006. The C-N method for exactly the same problem gives me an error between 0 and 0.14. That is about two orders of magnitude larger in C-N. I expected higer precision in C-N. Any idea why is this happening? I evaluated the error in times 0.1,0.2,0.3,0.4,0.5. I have
graphs for this with $x in [0,1]$ with $dx=0.01$. All is done in Python.



I appreciate any suggestion about this (other than telling me I have a bug in my code. I seriously consider this as an option and I am looking into this, but I cannot yet find a bug).



When I use $dt=0.1$ C-N is more accurate than FTCS. Errors in C-N in $[-0.12,0.3]$ and FTCS $[0,0.8]$.



Thanks.







share|cite|improve this question












I am worried about this. I am solving the heat equation with α=1 and homogeneous Dirichlet boundary conditions. I use dt=0.00001, dx=0.01, nx=101 in the interval [0,1]. I found that the implicit FTCS gives me an error (difference between the analytic solution and the numerically computed solution) between 0 and 0.006. The C-N method for exactly the same problem gives me an error between 0 and 0.14. That is about two orders of magnitude larger in C-N. I expected higer precision in C-N. Any idea why is this happening? I evaluated the error in times 0.1,0.2,0.3,0.4,0.5. I have
graphs for this with $x in [0,1]$ with $dx=0.01$. All is done in Python.



I appreciate any suggestion about this (other than telling me I have a bug in my code. I seriously consider this as an option and I am looking into this, but I cannot yet find a bug).



When I use $dt=0.1$ C-N is more accurate than FTCS. Errors in C-N in $[-0.12,0.3]$ and FTCS $[0,0.8]$.



Thanks.









share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Aug 26 at 22:51









Herman Jaramillo

1,174818




1,174818











  • A better site for this question would be scicomp.stackexchange.com.
    – Mattos
    Aug 26 at 23:14










  • @Mattos: Thanks for your suggestion. I will post it there. I guess I can include Python code there, right?
    – Herman Jaramillo
    Aug 27 at 1:43






  • 1




    Yes, you can include your code there.
    – Mattos
    Aug 27 at 2:43
















  • A better site for this question would be scicomp.stackexchange.com.
    – Mattos
    Aug 26 at 23:14










  • @Mattos: Thanks for your suggestion. I will post it there. I guess I can include Python code there, right?
    – Herman Jaramillo
    Aug 27 at 1:43






  • 1




    Yes, you can include your code there.
    – Mattos
    Aug 27 at 2:43















A better site for this question would be scicomp.stackexchange.com.
– Mattos
Aug 26 at 23:14




A better site for this question would be scicomp.stackexchange.com.
– Mattos
Aug 26 at 23:14












@Mattos: Thanks for your suggestion. I will post it there. I guess I can include Python code there, right?
– Herman Jaramillo
Aug 27 at 1:43




@Mattos: Thanks for your suggestion. I will post it there. I guess I can include Python code there, right?
– Herman Jaramillo
Aug 27 at 1:43




1




1




Yes, you can include your code there.
– Mattos
Aug 27 at 2:43




Yes, you can include your code there.
– Mattos
Aug 27 at 2:43















active

oldest

votes











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%2f2895613%2fcrank-nicolson-is-much-less-accurate-than-implicit-ftcs%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2895613%2fcrank-nicolson-is-much-less-accurate-than-implicit-ftcs%23new-answer', 'question_page');

);

Post as a guest













































































這個網誌中的熱門文章

How to combine Bézier curves to a surface?

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

Carbon dioxide