1
$\begingroup$

How would I go about plotting a single point in the $x,y$ plane given by; $$\left(\frac{\lambda d -b\mu}{ad-bc}, \frac{a \mu -c\lambda}{ad-bc} \right)$$ Where we can take $a,b,c,d,\mu$ to be positive constants and $\lambda$ to be some parameter that is free to change. Namely, I want to have $\lambda$ in a manipulate environment and see how the point changes whilst the streamplot changes accordingly. It can be noted that in fact this is a fixed point to the system of differential equations; $$ \frac{du}{dt}=u(\lambda-au-bv)$$ $$ \frac{dv}{dt}=v(\mu-cu-dv) $$ I have currently implemented the differential equation, having the streamplot in the manipulate environment, all that is left now is to somehow plot this point on the same graph where changing the value of lambda simultaneously moves the fixed point and the streamplot surrounding it. This is what I have done so far;

        LVA[a_, b_, c_, d_, u_, l_] := {x*(l - a*x - b*y), y*(u - c*x - d*y)}
        FPStream = 
        Manipulate[
        StreamPlot[
        LVA[2, 1, 1.2, 2.1, 0.6, l], {x, -0.4, 0.4}, {y, -0.4, 0.4}, 
        PlotLabel -> Row[{"l = ", l}], GridLines -> Automatic], {l, 0, 2}]

Thank you for your help in advance!

$\endgroup$
  • 1
    $\begingroup$ This seems like the same question you posted yesterday, only this time you added the definition of LVA. You received some suggestions in comments to that previous question. What have you tried to implement those? $\endgroup$ – MarcoB Jun 3 at 6:50
  • $\begingroup$ @MarcoB I have tried to implement a 'plot' type of function, but I am unsure how to do this in mathematica. In MATLAB, what I generally use, you can just use the 'hold on' command. I'm new to Mathematica and I was wondering whether there is any command which does something similar. I have looked through the suggestions and am still struggling to find a solution. $\endgroup$ – MATHBOI Jun 3 at 7:20
5
$\begingroup$

In MATLAB, what I generally use, you can just use the 'hold on' command.

There is no hold on in Mathematica, but you can add a point to a plot in many ways. One is to use Epilog

enter image description here

Code

Clear["Global`*"];
fx[a_, b_, c_, d_, u_, L0_, x_, y_] := x*(L0 - a*x - b*y)
fy[a_, b_, c_, d_, u_, L0_, x_, y_] := y*(u - c*x - d*y);
xCoord[a_, b_, c_, d_, u_, L0_] := (L0*d - b*u)/(a*d - b*c);
yCoord[a_, b_, c_, d_, u_, L0_] := (a*u - c*L0)/(a*d - b*c);

Manipulate[
 Module[{x0, y0},

  x0 = xCoord[a, b, c, d, u, L0];
  y0 = yCoord[a, b, c, d, u, L0];

  Grid[{
    {Row[{"xCoord = ", x0, " yCoord =", y0}]},
    {StreamPlot[{fx[a, b, c, d, u, L0, x, y], 
       fy[a, b, c, d, u, L0, x, y]}, {x, -1, 1}, {y, -1, 1},
      Epilog -> {Red, PointSize[.04], Point[{x0, y0}]}
      , ImageSize -> 300, PerformanceGoal -> "Quality"
      ]
     }
    }]
  ]

 ,

 {{a, 2, "a"}, 0, 2, .1, Appearance -> "Labeled"},
 {{b, 1, "b"}, 0, 2, .1, Appearance -> "Labeled"},
 {{c, 1.2, "c"}, 0, 2, .1, Appearance -> "Labeled"},
 {{d, 2.1, "d"}, 0, 3, .1, Appearance -> "Labeled"},
 {{u, 0.6, "u"}, 0, 2, .1, Appearance -> "Labeled"},
 {{L0, 1, "L"}, 0, 2, .1, Appearance -> "Labeled"},
 TrackedSymbols :> {a, b, c, d, u, L0}
 ]
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you for detailed response! If I wish to plot multiple points, can I just do the same as you have presented but rather have different functions for xcord and ycord? And of course carry this change out through the code? $\endgroup$ – MATHBOI Jun 3 at 12:03
  • $\begingroup$ @MATHBOI what other points do you want to add? Do they have other functions like the above? You can add them the same as shown in the above code. $\endgroup$ – Nasser Jun 3 at 12:05
  • $\begingroup$ Yes it is, another point that I wanted to plot was $$\left(\frac{\lambda}{a},0 \right)$$ $\endgroup$ – MATHBOI Jun 4 at 3:03
  • $\begingroup$ Fiddled around with the Point function a bit and got it working! Thank you for your assistance! $\endgroup$ – MATHBOI Jun 4 at 3:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.