How to increase accuracy of Plot












1












$begingroup$


I have the following code below:



num = 25;
U[x_] := 50*(Sech[1.5*(x - 5.8)])^4 - 0.14*(Sech[0.5*(x - 6.5)])^2
V[x_] := U[x] - U[3.8]
Plot[V[x], {x, 0, 4.75}, PlotRange -> All];
A := 1.05459^2*0.01/2/1.6726/1.60219
{vals, funs} =
NDEigensystem[-(A/x)*D[x*D[[Psi][x], {x}], {x}] +
V[x]*[Psi][x], [Psi][x], {x, 0, 5}, num];


And I get next graphic:
enter image description here
Here, as I expect there should not be such a sharp peak at the beginning of Plot. So I tried to increase a number of points for Plot:



Plot[Evaluate[funs[[25]]/
Sqrt[NIntegrate[x*(funs[[25]])^2, {x, 0, 5},
AccuracyGoal -> 10]]], {x, 0, 5}, PlotLegends -> vals[[25]],
PlotRange -> All]


And get next:
enter image description here
It's the same graph but in different ranges. So my question is How can I do the same but in range from 0 to 5.










share|improve this question









$endgroup$












  • $begingroup$
    I think PlotPoints is the option you need
    $endgroup$
    – mikado
    2 hours ago






  • 1




    $begingroup$
    This is not an issue of Plot. The interpolating function that you are using (funs[[25]]) already has this shape.
    $endgroup$
    – Sjoerd C. de Vries
    2 hours ago


















1












$begingroup$


I have the following code below:



num = 25;
U[x_] := 50*(Sech[1.5*(x - 5.8)])^4 - 0.14*(Sech[0.5*(x - 6.5)])^2
V[x_] := U[x] - U[3.8]
Plot[V[x], {x, 0, 4.75}, PlotRange -> All];
A := 1.05459^2*0.01/2/1.6726/1.60219
{vals, funs} =
NDEigensystem[-(A/x)*D[x*D[[Psi][x], {x}], {x}] +
V[x]*[Psi][x], [Psi][x], {x, 0, 5}, num];


And I get next graphic:
enter image description here
Here, as I expect there should not be such a sharp peak at the beginning of Plot. So I tried to increase a number of points for Plot:



Plot[Evaluate[funs[[25]]/
Sqrt[NIntegrate[x*(funs[[25]])^2, {x, 0, 5},
AccuracyGoal -> 10]]], {x, 0, 5}, PlotLegends -> vals[[25]],
PlotRange -> All]


And get next:
enter image description here
It's the same graph but in different ranges. So my question is How can I do the same but in range from 0 to 5.










share|improve this question









$endgroup$












  • $begingroup$
    I think PlotPoints is the option you need
    $endgroup$
    – mikado
    2 hours ago






  • 1




    $begingroup$
    This is not an issue of Plot. The interpolating function that you are using (funs[[25]]) already has this shape.
    $endgroup$
    – Sjoerd C. de Vries
    2 hours ago
















1












1








1





$begingroup$


I have the following code below:



num = 25;
U[x_] := 50*(Sech[1.5*(x - 5.8)])^4 - 0.14*(Sech[0.5*(x - 6.5)])^2
V[x_] := U[x] - U[3.8]
Plot[V[x], {x, 0, 4.75}, PlotRange -> All];
A := 1.05459^2*0.01/2/1.6726/1.60219
{vals, funs} =
NDEigensystem[-(A/x)*D[x*D[[Psi][x], {x}], {x}] +
V[x]*[Psi][x], [Psi][x], {x, 0, 5}, num];


And I get next graphic:
enter image description here
Here, as I expect there should not be such a sharp peak at the beginning of Plot. So I tried to increase a number of points for Plot:



Plot[Evaluate[funs[[25]]/
Sqrt[NIntegrate[x*(funs[[25]])^2, {x, 0, 5},
AccuracyGoal -> 10]]], {x, 0, 5}, PlotLegends -> vals[[25]],
PlotRange -> All]


And get next:
enter image description here
It's the same graph but in different ranges. So my question is How can I do the same but in range from 0 to 5.










share|improve this question









$endgroup$




I have the following code below:



num = 25;
U[x_] := 50*(Sech[1.5*(x - 5.8)])^4 - 0.14*(Sech[0.5*(x - 6.5)])^2
V[x_] := U[x] - U[3.8]
Plot[V[x], {x, 0, 4.75}, PlotRange -> All];
A := 1.05459^2*0.01/2/1.6726/1.60219
{vals, funs} =
NDEigensystem[-(A/x)*D[x*D[[Psi][x], {x}], {x}] +
V[x]*[Psi][x], [Psi][x], {x, 0, 5}, num];


And I get next graphic:
enter image description here
Here, as I expect there should not be such a sharp peak at the beginning of Plot. So I tried to increase a number of points for Plot:



Plot[Evaluate[funs[[25]]/
Sqrt[NIntegrate[x*(funs[[25]])^2, {x, 0, 5},
AccuracyGoal -> 10]]], {x, 0, 5}, PlotLegends -> vals[[25]],
PlotRange -> All]


And get next:
enter image description here
It's the same graph but in different ranges. So my question is How can I do the same but in range from 0 to 5.







plotting graphics recursion precision-and-accuracy






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 hours ago









JohnJohn

32716




32716












  • $begingroup$
    I think PlotPoints is the option you need
    $endgroup$
    – mikado
    2 hours ago






  • 1




    $begingroup$
    This is not an issue of Plot. The interpolating function that you are using (funs[[25]]) already has this shape.
    $endgroup$
    – Sjoerd C. de Vries
    2 hours ago




















  • $begingroup$
    I think PlotPoints is the option you need
    $endgroup$
    – mikado
    2 hours ago






  • 1




    $begingroup$
    This is not an issue of Plot. The interpolating function that you are using (funs[[25]]) already has this shape.
    $endgroup$
    – Sjoerd C. de Vries
    2 hours ago


















$begingroup$
I think PlotPoints is the option you need
$endgroup$
– mikado
2 hours ago




$begingroup$
I think PlotPoints is the option you need
$endgroup$
– mikado
2 hours ago




1




1




$begingroup$
This is not an issue of Plot. The interpolating function that you are using (funs[[25]]) already has this shape.
$endgroup$
– Sjoerd C. de Vries
2 hours ago






$begingroup$
This is not an issue of Plot. The interpolating function that you are using (funs[[25]]) already has this shape.
$endgroup$
– Sjoerd C. de Vries
2 hours ago












1 Answer
1






active

oldest

votes


















4












$begingroup$

The problem does not seem to be in Plot but in NDEigensystem. Apparently, the default method used for your function is not ideal. If you provide a method explicitly it seems to work better.



{vals, funs} = 
NDEigensystem[
-(A/x)*D[x*D[ψ[x], {x}], {x}] + V[x]*ψ[x],
ψ[x],
{x, 0, 5},
num,
Method -> {"PDEDiscretization" ->
{"FiniteElement", {"MeshOptions" -> {"MaxCellMeasure" -> 0.001}}}}];

Multicolumn[Plot[#, {x, 0, 5}, PlotRange -> All] & /@ funs]


Mathematica graphics






share|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: "387"
    };
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192936%2fhow-to-increase-accuracy-of-plot%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4












    $begingroup$

    The problem does not seem to be in Plot but in NDEigensystem. Apparently, the default method used for your function is not ideal. If you provide a method explicitly it seems to work better.



    {vals, funs} = 
    NDEigensystem[
    -(A/x)*D[x*D[ψ[x], {x}], {x}] + V[x]*ψ[x],
    ψ[x],
    {x, 0, 5},
    num,
    Method -> {"PDEDiscretization" ->
    {"FiniteElement", {"MeshOptions" -> {"MaxCellMeasure" -> 0.001}}}}];

    Multicolumn[Plot[#, {x, 0, 5}, PlotRange -> All] & /@ funs]


    Mathematica graphics






    share|improve this answer









    $endgroup$


















      4












      $begingroup$

      The problem does not seem to be in Plot but in NDEigensystem. Apparently, the default method used for your function is not ideal. If you provide a method explicitly it seems to work better.



      {vals, funs} = 
      NDEigensystem[
      -(A/x)*D[x*D[ψ[x], {x}], {x}] + V[x]*ψ[x],
      ψ[x],
      {x, 0, 5},
      num,
      Method -> {"PDEDiscretization" ->
      {"FiniteElement", {"MeshOptions" -> {"MaxCellMeasure" -> 0.001}}}}];

      Multicolumn[Plot[#, {x, 0, 5}, PlotRange -> All] & /@ funs]


      Mathematica graphics






      share|improve this answer









      $endgroup$
















        4












        4








        4





        $begingroup$

        The problem does not seem to be in Plot but in NDEigensystem. Apparently, the default method used for your function is not ideal. If you provide a method explicitly it seems to work better.



        {vals, funs} = 
        NDEigensystem[
        -(A/x)*D[x*D[ψ[x], {x}], {x}] + V[x]*ψ[x],
        ψ[x],
        {x, 0, 5},
        num,
        Method -> {"PDEDiscretization" ->
        {"FiniteElement", {"MeshOptions" -> {"MaxCellMeasure" -> 0.001}}}}];

        Multicolumn[Plot[#, {x, 0, 5}, PlotRange -> All] & /@ funs]


        Mathematica graphics






        share|improve this answer









        $endgroup$



        The problem does not seem to be in Plot but in NDEigensystem. Apparently, the default method used for your function is not ideal. If you provide a method explicitly it seems to work better.



        {vals, funs} = 
        NDEigensystem[
        -(A/x)*D[x*D[ψ[x], {x}], {x}] + V[x]*ψ[x],
        ψ[x],
        {x, 0, 5},
        num,
        Method -> {"PDEDiscretization" ->
        {"FiniteElement", {"MeshOptions" -> {"MaxCellMeasure" -> 0.001}}}}];

        Multicolumn[Plot[#, {x, 0, 5}, PlotRange -> All] & /@ funs]


        Mathematica graphics







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 1 hour ago









        Sjoerd C. de VriesSjoerd C. de Vries

        57.6k10155298




        57.6k10155298






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematica 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%2fmathematica.stackexchange.com%2fquestions%2f192936%2fhow-to-increase-accuracy-of-plot%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

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            TypeError: fit_transform() missing 1 required positional argument: 'X'