Solve struggles to solve equation with variable constraint

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











up vote
3
down vote

favorite
1












I am trying to find x,y set satisfying FOC with the constraint:



0<x<=y<1


Here is my code, which does not give anything.



Dbuy = 1 - (x/y) - x*Log[y/x];
Dwait = (x/y) - x;
revx = D[(Dbuy*x + Dwait*CCC*y), x]
revy = D[(Dbuy*x + Dwait*CCC*y), y]
revsln=Solve[revx==0, revy==0,x,y]


When I use FindRoot function instead of Solve for a fixed value of CCC (between 0 and 1, for example 0.4), it gives me numerical values (0.322, 0.581) if I add



x,0.01, y,0.01 


But I want some form of closed-form solution for



0<=C<=1


What do you guys think?










share|improve this question









New contributor




Ovunc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    Well, do you have any reason to expect a closed-form solution exists at all?
    – AccidentalFourierTransform
    2 hours ago










  • I feel that the root for the constraint 0<=x<=y<=1 has a closed-form. Is there a way to check it? Or is there a way to add a constraint to "Solve" function? Or is there a way to find a closed-form approximation?
    – Ovunc
    2 hours ago







  • 1




    In 11.3 I get a "This system cannot be solved with the methods available to Solve." message. Probably means the system cannot be solved with the methods available to Solve, no? Even if I drop the floating CCC I get Root objects parametrized near to a value.
    – b3m2a1
    2 hours ago














up vote
3
down vote

favorite
1












I am trying to find x,y set satisfying FOC with the constraint:



0<x<=y<1


Here is my code, which does not give anything.



Dbuy = 1 - (x/y) - x*Log[y/x];
Dwait = (x/y) - x;
revx = D[(Dbuy*x + Dwait*CCC*y), x]
revy = D[(Dbuy*x + Dwait*CCC*y), y]
revsln=Solve[revx==0, revy==0,x,y]


When I use FindRoot function instead of Solve for a fixed value of CCC (between 0 and 1, for example 0.4), it gives me numerical values (0.322, 0.581) if I add



x,0.01, y,0.01 


But I want some form of closed-form solution for



0<=C<=1


What do you guys think?










share|improve this question









New contributor




Ovunc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    Well, do you have any reason to expect a closed-form solution exists at all?
    – AccidentalFourierTransform
    2 hours ago










  • I feel that the root for the constraint 0<=x<=y<=1 has a closed-form. Is there a way to check it? Or is there a way to add a constraint to "Solve" function? Or is there a way to find a closed-form approximation?
    – Ovunc
    2 hours ago







  • 1




    In 11.3 I get a "This system cannot be solved with the methods available to Solve." message. Probably means the system cannot be solved with the methods available to Solve, no? Even if I drop the floating CCC I get Root objects parametrized near to a value.
    – b3m2a1
    2 hours ago












up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





I am trying to find x,y set satisfying FOC with the constraint:



0<x<=y<1


Here is my code, which does not give anything.



Dbuy = 1 - (x/y) - x*Log[y/x];
Dwait = (x/y) - x;
revx = D[(Dbuy*x + Dwait*CCC*y), x]
revy = D[(Dbuy*x + Dwait*CCC*y), y]
revsln=Solve[revx==0, revy==0,x,y]


When I use FindRoot function instead of Solve for a fixed value of CCC (between 0 and 1, for example 0.4), it gives me numerical values (0.322, 0.581) if I add



x,0.01, y,0.01 


But I want some form of closed-form solution for



0<=C<=1


What do you guys think?










share|improve this question









New contributor




Ovunc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am trying to find x,y set satisfying FOC with the constraint:



0<x<=y<1


Here is my code, which does not give anything.



Dbuy = 1 - (x/y) - x*Log[y/x];
Dwait = (x/y) - x;
revx = D[(Dbuy*x + Dwait*CCC*y), x]
revy = D[(Dbuy*x + Dwait*CCC*y), y]
revsln=Solve[revx==0, revy==0,x,y]


When I use FindRoot function instead of Solve for a fixed value of CCC (between 0 and 1, for example 0.4), it gives me numerical values (0.322, 0.581) if I add



x,0.01, y,0.01 


But I want some form of closed-form solution for



0<=C<=1


What do you guys think?







equation-solving mathematical-optimization






share|improve this question









New contributor




Ovunc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Ovunc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago









b3m2a1

25k254147




25k254147






New contributor




Ovunc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









Ovunc

234




234




New contributor




Ovunc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Ovunc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Ovunc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1




    Well, do you have any reason to expect a closed-form solution exists at all?
    – AccidentalFourierTransform
    2 hours ago










  • I feel that the root for the constraint 0<=x<=y<=1 has a closed-form. Is there a way to check it? Or is there a way to add a constraint to "Solve" function? Or is there a way to find a closed-form approximation?
    – Ovunc
    2 hours ago







  • 1




    In 11.3 I get a "This system cannot be solved with the methods available to Solve." message. Probably means the system cannot be solved with the methods available to Solve, no? Even if I drop the floating CCC I get Root objects parametrized near to a value.
    – b3m2a1
    2 hours ago












  • 1




    Well, do you have any reason to expect a closed-form solution exists at all?
    – AccidentalFourierTransform
    2 hours ago










  • I feel that the root for the constraint 0<=x<=y<=1 has a closed-form. Is there a way to check it? Or is there a way to add a constraint to "Solve" function? Or is there a way to find a closed-form approximation?
    – Ovunc
    2 hours ago







  • 1




    In 11.3 I get a "This system cannot be solved with the methods available to Solve." message. Probably means the system cannot be solved with the methods available to Solve, no? Even if I drop the floating CCC I get Root objects parametrized near to a value.
    – b3m2a1
    2 hours ago







1




1




Well, do you have any reason to expect a closed-form solution exists at all?
– AccidentalFourierTransform
2 hours ago




Well, do you have any reason to expect a closed-form solution exists at all?
– AccidentalFourierTransform
2 hours ago












I feel that the root for the constraint 0<=x<=y<=1 has a closed-form. Is there a way to check it? Or is there a way to add a constraint to "Solve" function? Or is there a way to find a closed-form approximation?
– Ovunc
2 hours ago





I feel that the root for the constraint 0<=x<=y<=1 has a closed-form. Is there a way to check it? Or is there a way to add a constraint to "Solve" function? Or is there a way to find a closed-form approximation?
– Ovunc
2 hours ago





1




1




In 11.3 I get a "This system cannot be solved with the methods available to Solve." message. Probably means the system cannot be solved with the methods available to Solve, no? Even if I drop the floating CCC I get Root objects parametrized near to a value.
– b3m2a1
2 hours ago




In 11.3 I get a "This system cannot be solved with the methods available to Solve." message. Probably means the system cannot be solved with the methods available to Solve, no? Even if I drop the floating CCC I get Root objects parametrized near to a value.
– b3m2a1
2 hours ago










2 Answers
2






active

oldest

votes

















up vote
3
down vote













Until someone comes up with a method that yields an analytical solution, you can use NArgMax:



argmax[c_?NumericQ] := NArgMax[Dbuy*x + Dwait*c*y, 
0 <= c <= 1, 0 <= x <=1, 0<= y < 1, x <= y, x, y]
ParametricPlot[Evaluate@t, t, argmax[t], t, 0, 1,
PlotRange -> 0, 1, 0, 1, Frame -> True]


enter image description here






share|improve this answer






















  • are these the optimal (x,y) combinations for 0<=c<=1?
    – Ovunc
    5 secs ago

















up vote
2
down vote













Here's a way to get a sense for the kinds of things for want. We'll solve this (exactly!) for a large number of values for CCC, plot them, and extract meaning out of that.



Here's the basic code I'll fux with:



blurg[CCC_] :=
Block[

ccc = Rationalize[CCC],
Dbuy,
Dwait,
revx,
revy,
x, y
,
Dbuy = 1 - (x/y) - x*Log[y/x];
Dwait = (x/y) - x;
revx = D[(Dbuy*x + Dwait*ccc*y), x];
revy = D[(Dbuy*x + Dwait*ccc*y), y];
Solve[revx == 0, revy == 0, x, y, Reals]
]

solns =
blurg /@ Rest@Subdivide[0, 1, 100];

N[x, y /. #, 50] & /@ solns //
ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


enter image description here



You can see you always have two solutions and they converge down to those end-points at CCC=1 and apparently diverge as CCC->0



You can also look at the symbolic solutions returned but they will be nasty. Lots of complicated Root objects



Here's another fun example:



solns =
blurg /@ Rest@Subdivide[0, .01, 25];

N[x, y /. #, 50] & /@ solns //
ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


enter image description here



This shows the divergence over that side of the solutions.






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



    );






    Ovunc is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184359%2fsolve-struggles-to-solve-equation-with-variable-constraint%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote













    Until someone comes up with a method that yields an analytical solution, you can use NArgMax:



    argmax[c_?NumericQ] := NArgMax[Dbuy*x + Dwait*c*y, 
    0 <= c <= 1, 0 <= x <=1, 0<= y < 1, x <= y, x, y]
    ParametricPlot[Evaluate@t, t, argmax[t], t, 0, 1,
    PlotRange -> 0, 1, 0, 1, Frame -> True]


    enter image description here






    share|improve this answer






















    • are these the optimal (x,y) combinations for 0<=c<=1?
      – Ovunc
      5 secs ago














    up vote
    3
    down vote













    Until someone comes up with a method that yields an analytical solution, you can use NArgMax:



    argmax[c_?NumericQ] := NArgMax[Dbuy*x + Dwait*c*y, 
    0 <= c <= 1, 0 <= x <=1, 0<= y < 1, x <= y, x, y]
    ParametricPlot[Evaluate@t, t, argmax[t], t, 0, 1,
    PlotRange -> 0, 1, 0, 1, Frame -> True]


    enter image description here






    share|improve this answer






















    • are these the optimal (x,y) combinations for 0<=c<=1?
      – Ovunc
      5 secs ago












    up vote
    3
    down vote










    up vote
    3
    down vote









    Until someone comes up with a method that yields an analytical solution, you can use NArgMax:



    argmax[c_?NumericQ] := NArgMax[Dbuy*x + Dwait*c*y, 
    0 <= c <= 1, 0 <= x <=1, 0<= y < 1, x <= y, x, y]
    ParametricPlot[Evaluate@t, t, argmax[t], t, 0, 1,
    PlotRange -> 0, 1, 0, 1, Frame -> True]


    enter image description here






    share|improve this answer














    Until someone comes up with a method that yields an analytical solution, you can use NArgMax:



    argmax[c_?NumericQ] := NArgMax[Dbuy*x + Dwait*c*y, 
    0 <= c <= 1, 0 <= x <=1, 0<= y < 1, x <= y, x, y]
    ParametricPlot[Evaluate@t, t, argmax[t], t, 0, 1,
    PlotRange -> 0, 1, 0, 1, Frame -> True]


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 1 hour ago

























    answered 2 hours ago









    kglr

    167k8188390




    167k8188390











    • are these the optimal (x,y) combinations for 0<=c<=1?
      – Ovunc
      5 secs ago
















    • are these the optimal (x,y) combinations for 0<=c<=1?
      – Ovunc
      5 secs ago















    are these the optimal (x,y) combinations for 0<=c<=1?
    – Ovunc
    5 secs ago




    are these the optimal (x,y) combinations for 0<=c<=1?
    – Ovunc
    5 secs ago










    up vote
    2
    down vote













    Here's a way to get a sense for the kinds of things for want. We'll solve this (exactly!) for a large number of values for CCC, plot them, and extract meaning out of that.



    Here's the basic code I'll fux with:



    blurg[CCC_] :=
    Block[

    ccc = Rationalize[CCC],
    Dbuy,
    Dwait,
    revx,
    revy,
    x, y
    ,
    Dbuy = 1 - (x/y) - x*Log[y/x];
    Dwait = (x/y) - x;
    revx = D[(Dbuy*x + Dwait*ccc*y), x];
    revy = D[(Dbuy*x + Dwait*ccc*y), y];
    Solve[revx == 0, revy == 0, x, y, Reals]
    ]

    solns =
    blurg /@ Rest@Subdivide[0, 1, 100];

    N[x, y /. #, 50] & /@ solns //
    ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


    enter image description here



    You can see you always have two solutions and they converge down to those end-points at CCC=1 and apparently diverge as CCC->0



    You can also look at the symbolic solutions returned but they will be nasty. Lots of complicated Root objects



    Here's another fun example:



    solns =
    blurg /@ Rest@Subdivide[0, .01, 25];

    N[x, y /. #, 50] & /@ solns //
    ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


    enter image description here



    This shows the divergence over that side of the solutions.






    share|improve this answer


























      up vote
      2
      down vote













      Here's a way to get a sense for the kinds of things for want. We'll solve this (exactly!) for a large number of values for CCC, plot them, and extract meaning out of that.



      Here's the basic code I'll fux with:



      blurg[CCC_] :=
      Block[

      ccc = Rationalize[CCC],
      Dbuy,
      Dwait,
      revx,
      revy,
      x, y
      ,
      Dbuy = 1 - (x/y) - x*Log[y/x];
      Dwait = (x/y) - x;
      revx = D[(Dbuy*x + Dwait*ccc*y), x];
      revy = D[(Dbuy*x + Dwait*ccc*y), y];
      Solve[revx == 0, revy == 0, x, y, Reals]
      ]

      solns =
      blurg /@ Rest@Subdivide[0, 1, 100];

      N[x, y /. #, 50] & /@ solns //
      ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


      enter image description here



      You can see you always have two solutions and they converge down to those end-points at CCC=1 and apparently diverge as CCC->0



      You can also look at the symbolic solutions returned but they will be nasty. Lots of complicated Root objects



      Here's another fun example:



      solns =
      blurg /@ Rest@Subdivide[0, .01, 25];

      N[x, y /. #, 50] & /@ solns //
      ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


      enter image description here



      This shows the divergence over that side of the solutions.






      share|improve this answer
























        up vote
        2
        down vote










        up vote
        2
        down vote









        Here's a way to get a sense for the kinds of things for want. We'll solve this (exactly!) for a large number of values for CCC, plot them, and extract meaning out of that.



        Here's the basic code I'll fux with:



        blurg[CCC_] :=
        Block[

        ccc = Rationalize[CCC],
        Dbuy,
        Dwait,
        revx,
        revy,
        x, y
        ,
        Dbuy = 1 - (x/y) - x*Log[y/x];
        Dwait = (x/y) - x;
        revx = D[(Dbuy*x + Dwait*ccc*y), x];
        revy = D[(Dbuy*x + Dwait*ccc*y), y];
        Solve[revx == 0, revy == 0, x, y, Reals]
        ]

        solns =
        blurg /@ Rest@Subdivide[0, 1, 100];

        N[x, y /. #, 50] & /@ solns //
        ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


        enter image description here



        You can see you always have two solutions and they converge down to those end-points at CCC=1 and apparently diverge as CCC->0



        You can also look at the symbolic solutions returned but they will be nasty. Lots of complicated Root objects



        Here's another fun example:



        solns =
        blurg /@ Rest@Subdivide[0, .01, 25];

        N[x, y /. #, 50] & /@ solns //
        ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


        enter image description here



        This shows the divergence over that side of the solutions.






        share|improve this answer














        Here's a way to get a sense for the kinds of things for want. We'll solve this (exactly!) for a large number of values for CCC, plot them, and extract meaning out of that.



        Here's the basic code I'll fux with:



        blurg[CCC_] :=
        Block[

        ccc = Rationalize[CCC],
        Dbuy,
        Dwait,
        revx,
        revy,
        x, y
        ,
        Dbuy = 1 - (x/y) - x*Log[y/x];
        Dwait = (x/y) - x;
        revx = D[(Dbuy*x + Dwait*ccc*y), x];
        revy = D[(Dbuy*x + Dwait*ccc*y), y];
        Solve[revx == 0, revy == 0, x, y, Reals]
        ]

        solns =
        blurg /@ Rest@Subdivide[0, 1, 100];

        N[x, y /. #, 50] & /@ solns //
        ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


        enter image description here



        You can see you always have two solutions and they converge down to those end-points at CCC=1 and apparently diverge as CCC->0



        You can also look at the symbolic solutions returned but they will be nasty. Lots of complicated Root objects



        Here's another fun example:



        solns =
        blurg /@ Rest@Subdivide[0, .01, 25];

        N[x, y /. #, 50] & /@ solns //
        ListPlot[#, PlotStyle -> Map[Hue, Range[0, 1, 1/Length@solns]]] &


        enter image description here



        This shows the divergence over that side of the solutions.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 1 hour ago

























        answered 1 hour ago









        b3m2a1

        25k254147




        25k254147




















            Ovunc is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            Ovunc is a new contributor. Be nice, and check out our Code of Conduct.












            Ovunc is a new contributor. Be nice, and check out our Code of Conduct.











            Ovunc is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184359%2fsolve-struggles-to-solve-equation-with-variable-constraint%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            Installing NextGIS Connect into QGIS 3?

            One-line joke