Can't plot DSolve's solution to Riccati differential equation











up vote
2
down vote

favorite












DSolve gives a strange solution for the Riccati differential equation $ y' = (y^2) - 2 x^2 y + (x^4) + 2 x + 4 $



Opres = DSolve[y'[x] == y[x]^2-2x^2*y[x]+x^4+2x+4, y[x], x]


$left{left{y(x)to frac{1}{c_1 e^{4 i x}-frac{i}{4}}+x^2-2 iright}right}$



When I try plot this solution



Opresgraf = 
Plot[Evaluate[y[x] /. Opres /. C[1] -> Range[-3, 3]], {x, -4.7, 4.7},
PlotRange -> 4.7]


I get a blank graph.



My question is: how can I get a solution with DSolve (not with NDSolve, because in my student research project I need DSolve) and plot that solution, the most important is to plot that general solution with DSolve.










share|improve this question




















  • 1




    You can't plot a complex expression. You need to either plot its real value, its imaginary value or its modulus. Also you have a typo in the input, you need y[x] not y in the ODE itself.
    – Nasser
    4 hours ago






  • 1




    Is Range[-3.3] supposed to be Range[-3,3]?
    – That Gravity Guy
    4 hours ago















up vote
2
down vote

favorite












DSolve gives a strange solution for the Riccati differential equation $ y' = (y^2) - 2 x^2 y + (x^4) + 2 x + 4 $



Opres = DSolve[y'[x] == y[x]^2-2x^2*y[x]+x^4+2x+4, y[x], x]


$left{left{y(x)to frac{1}{c_1 e^{4 i x}-frac{i}{4}}+x^2-2 iright}right}$



When I try plot this solution



Opresgraf = 
Plot[Evaluate[y[x] /. Opres /. C[1] -> Range[-3, 3]], {x, -4.7, 4.7},
PlotRange -> 4.7]


I get a blank graph.



My question is: how can I get a solution with DSolve (not with NDSolve, because in my student research project I need DSolve) and plot that solution, the most important is to plot that general solution with DSolve.










share|improve this question




















  • 1




    You can't plot a complex expression. You need to either plot its real value, its imaginary value or its modulus. Also you have a typo in the input, you need y[x] not y in the ODE itself.
    – Nasser
    4 hours ago






  • 1




    Is Range[-3.3] supposed to be Range[-3,3]?
    – That Gravity Guy
    4 hours ago













up vote
2
down vote

favorite









up vote
2
down vote

favorite











DSolve gives a strange solution for the Riccati differential equation $ y' = (y^2) - 2 x^2 y + (x^4) + 2 x + 4 $



Opres = DSolve[y'[x] == y[x]^2-2x^2*y[x]+x^4+2x+4, y[x], x]


$left{left{y(x)to frac{1}{c_1 e^{4 i x}-frac{i}{4}}+x^2-2 iright}right}$



When I try plot this solution



Opresgraf = 
Plot[Evaluate[y[x] /. Opres /. C[1] -> Range[-3, 3]], {x, -4.7, 4.7},
PlotRange -> 4.7]


I get a blank graph.



My question is: how can I get a solution with DSolve (not with NDSolve, because in my student research project I need DSolve) and plot that solution, the most important is to plot that general solution with DSolve.










share|improve this question















DSolve gives a strange solution for the Riccati differential equation $ y' = (y^2) - 2 x^2 y + (x^4) + 2 x + 4 $



Opres = DSolve[y'[x] == y[x]^2-2x^2*y[x]+x^4+2x+4, y[x], x]


$left{left{y(x)to frac{1}{c_1 e^{4 i x}-frac{i}{4}}+x^2-2 iright}right}$



When I try plot this solution



Opresgraf = 
Plot[Evaluate[y[x] /. Opres /. C[1] -> Range[-3, 3]], {x, -4.7, 4.7},
PlotRange -> 4.7]


I get a blank graph.



My question is: how can I get a solution with DSolve (not with NDSolve, because in my student research project I need DSolve) and plot that solution, the most important is to plot that general solution with DSolve.







differential-equations






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 7 mins ago









kglr

173k8194400




173k8194400










asked 4 hours ago









Милош Вучковић

415




415








  • 1




    You can't plot a complex expression. You need to either plot its real value, its imaginary value or its modulus. Also you have a typo in the input, you need y[x] not y in the ODE itself.
    – Nasser
    4 hours ago






  • 1




    Is Range[-3.3] supposed to be Range[-3,3]?
    – That Gravity Guy
    4 hours ago














  • 1




    You can't plot a complex expression. You need to either plot its real value, its imaginary value or its modulus. Also you have a typo in the input, you need y[x] not y in the ODE itself.
    – Nasser
    4 hours ago






  • 1




    Is Range[-3.3] supposed to be Range[-3,3]?
    – That Gravity Guy
    4 hours ago








1




1




You can't plot a complex expression. You need to either plot its real value, its imaginary value or its modulus. Also you have a typo in the input, you need y[x] not y in the ODE itself.
– Nasser
4 hours ago




You can't plot a complex expression. You need to either plot its real value, its imaginary value or its modulus. Also you have a typo in the input, you need y[x] not y in the ODE itself.
– Nasser
4 hours ago




1




1




Is Range[-3.3] supposed to be Range[-3,3]?
– That Gravity Guy
4 hours ago




Is Range[-3.3] supposed to be Range[-3,3]?
– That Gravity Guy
4 hours ago










3 Answers
3






active

oldest

votes

















up vote
5
down vote













perhaps



Plot[Evaluate[ReIm@y[x] /. (Opres /. C[1] -> Range[-3, 3])], {x, -4.7, 4.7}, 
PlotRange -> 4.7]


enter image description here






share|improve this answer




























    up vote
    2
    down vote













    Try this



    Opres = DSolve[y'[x] == y[x]^2-2x^2 *y[x]+x^4+2x+4, y[x], x][[1]];
    Plot[{Re[y[x]/.Opres/.C[1]->Range[3.3]],Im[y[x]/.Opres/.C[1]->Range[3.3]]}, {x,-4.7,4.7}]





    share|improve this answer




























      up vote
      2
      down vote













      With a single graph you can only plot those solution that are imaginary or real.



      There are 2 real ones:



      sol = First[DSolve[y'[x] == y[x]^2 - 2 x^2*y[x] + x^4 + 2 x + 4, y[x], x]];
      zeroIm = FullSimplify[ComplexExpand[Im[y[x] /. sol]]] == 0 // Solve[#, C[1]] &



      $left{left{C[1]to -frac{1}{4}right},left{C[1]to frac{1}{4}right}right}$




      Plot[Evaluate[y[x] /. sol /. zeroIm], {x, -4.7, 4.7}]







      share|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: "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',
        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%2f186803%2fcant-plot-dsolves-solution-to-riccati-differential-equation%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        5
        down vote













        perhaps



        Plot[Evaluate[ReIm@y[x] /. (Opres /. C[1] -> Range[-3, 3])], {x, -4.7, 4.7}, 
        PlotRange -> 4.7]


        enter image description here






        share|improve this answer

























          up vote
          5
          down vote













          perhaps



          Plot[Evaluate[ReIm@y[x] /. (Opres /. C[1] -> Range[-3, 3])], {x, -4.7, 4.7}, 
          PlotRange -> 4.7]


          enter image description here






          share|improve this answer























            up vote
            5
            down vote










            up vote
            5
            down vote









            perhaps



            Plot[Evaluate[ReIm@y[x] /. (Opres /. C[1] -> Range[-3, 3])], {x, -4.7, 4.7}, 
            PlotRange -> 4.7]


            enter image description here






            share|improve this answer












            perhaps



            Plot[Evaluate[ReIm@y[x] /. (Opres /. C[1] -> Range[-3, 3])], {x, -4.7, 4.7}, 
            PlotRange -> 4.7]


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 4 hours ago









            kglr

            173k8194400




            173k8194400






















                up vote
                2
                down vote













                Try this



                Opres = DSolve[y'[x] == y[x]^2-2x^2 *y[x]+x^4+2x+4, y[x], x][[1]];
                Plot[{Re[y[x]/.Opres/.C[1]->Range[3.3]],Im[y[x]/.Opres/.C[1]->Range[3.3]]}, {x,-4.7,4.7}]





                share|improve this answer

























                  up vote
                  2
                  down vote













                  Try this



                  Opres = DSolve[y'[x] == y[x]^2-2x^2 *y[x]+x^4+2x+4, y[x], x][[1]];
                  Plot[{Re[y[x]/.Opres/.C[1]->Range[3.3]],Im[y[x]/.Opres/.C[1]->Range[3.3]]}, {x,-4.7,4.7}]





                  share|improve this answer























                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    Try this



                    Opres = DSolve[y'[x] == y[x]^2-2x^2 *y[x]+x^4+2x+4, y[x], x][[1]];
                    Plot[{Re[y[x]/.Opres/.C[1]->Range[3.3]],Im[y[x]/.Opres/.C[1]->Range[3.3]]}, {x,-4.7,4.7}]





                    share|improve this answer












                    Try this



                    Opres = DSolve[y'[x] == y[x]^2-2x^2 *y[x]+x^4+2x+4, y[x], x][[1]];
                    Plot[{Re[y[x]/.Opres/.C[1]->Range[3.3]],Im[y[x]/.Opres/.C[1]->Range[3.3]]}, {x,-4.7,4.7}]






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 4 hours ago









                    Bill

                    5,41059




                    5,41059






















                        up vote
                        2
                        down vote













                        With a single graph you can only plot those solution that are imaginary or real.



                        There are 2 real ones:



                        sol = First[DSolve[y'[x] == y[x]^2 - 2 x^2*y[x] + x^4 + 2 x + 4, y[x], x]];
                        zeroIm = FullSimplify[ComplexExpand[Im[y[x] /. sol]]] == 0 // Solve[#, C[1]] &



                        $left{left{C[1]to -frac{1}{4}right},left{C[1]to frac{1}{4}right}right}$




                        Plot[Evaluate[y[x] /. sol /. zeroIm], {x, -4.7, 4.7}]







                        share|improve this answer



























                          up vote
                          2
                          down vote













                          With a single graph you can only plot those solution that are imaginary or real.



                          There are 2 real ones:



                          sol = First[DSolve[y'[x] == y[x]^2 - 2 x^2*y[x] + x^4 + 2 x + 4, y[x], x]];
                          zeroIm = FullSimplify[ComplexExpand[Im[y[x] /. sol]]] == 0 // Solve[#, C[1]] &



                          $left{left{C[1]to -frac{1}{4}right},left{C[1]to frac{1}{4}right}right}$




                          Plot[Evaluate[y[x] /. sol /. zeroIm], {x, -4.7, 4.7}]







                          share|improve this answer

























                            up vote
                            2
                            down vote










                            up vote
                            2
                            down vote









                            With a single graph you can only plot those solution that are imaginary or real.



                            There are 2 real ones:



                            sol = First[DSolve[y'[x] == y[x]^2 - 2 x^2*y[x] + x^4 + 2 x + 4, y[x], x]];
                            zeroIm = FullSimplify[ComplexExpand[Im[y[x] /. sol]]] == 0 // Solve[#, C[1]] &



                            $left{left{C[1]to -frac{1}{4}right},left{C[1]to frac{1}{4}right}right}$




                            Plot[Evaluate[y[x] /. sol /. zeroIm], {x, -4.7, 4.7}]







                            share|improve this answer














                            With a single graph you can only plot those solution that are imaginary or real.



                            There are 2 real ones:



                            sol = First[DSolve[y'[x] == y[x]^2 - 2 x^2*y[x] + x^4 + 2 x + 4, y[x], x]];
                            zeroIm = FullSimplify[ComplexExpand[Im[y[x] /. sol]]] == 0 // Solve[#, C[1]] &



                            $left{left{C[1]to -frac{1}{4}right},left{C[1]to frac{1}{4}right}right}$




                            Plot[Evaluate[y[x] /. sol /. zeroIm], {x, -4.7, 4.7}]








                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 3 hours ago

























                            answered 4 hours ago









                            Coolwater

                            14.3k32452




                            14.3k32452






























                                 

                                draft saved


                                draft discarded



















































                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f186803%2fcant-plot-dsolves-solution-to-riccati-differential-equation%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'