Jared
Jared

Reputation: 638

Using variables in mathematica functions

I am trying to replicate a simple stream plot (see this stack exchange post) example using Wolfram Mathematica; however, I cannot seem to do this using variables (which is more readable). I would like the following behavior:

(*What I would like to do*)
xdot = 2xy;
ydot = 1 - x^2 - y^2;
StreamPlot[
    {xdot, ydot}, 
    {x, -4, 4}, 
    {y, -4, 4}
]

(*A working code would be the following
StreamPlot[
    {2 x*y, 1 - x^2 - y^2}, 
    {x, -4, 4}, 
    {y, -4, 4}
]
*)

Upvotes: 1

Views: 111

Answers (1)

Jared
Jared

Reputation: 638

I made a simple syntax error.

xdot = 2*x*y (*not 2xy*)

Upvotes: 1

Related Questions