I'm interested in looking at graphing the phase portraits of 2x2 autonomous ODEs, and I'm using the StreamPlot function.

Here is one simple example:

StreamPlot[{-y, -2 x}, {x, -5, 5}, {y, -5, 5}]

I'm finding it very tedious to continue typing , {x,-5,5}, {-5,5} etc. as part of every separate plot I construct. Is there some faster way to input my range? I don't want to have to rely on ctrl c ctrl v etc.

I'm sorry if this is a silly question!

  • $\begingroup$ Make a button with the appropriate placeholders, perhaps? $\endgroup$ – J. M. will be back soon May 28 '16 at 15:14
  • $\begingroup$ Silly that I didn't think of that, thank you! $\endgroup$ – kiwi703 May 28 '16 at 15:39
  • $\begingroup$ Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 May 28 '16 at 16:34
  • $\begingroup$ Thank you! This community is very intimidating because everyone seems like an expert and I feel I can't contribute anything yet, but I'll do those suggestions $\endgroup$ – kiwi703 May 29 '16 at 1:39


inpField[arg_, fs_: 5] := InputField[arg, FieldSize -> fs, Background -> Yellow, 
  Appearance -> "Frameless"]

Interpretation[{f = {-y, -2 x}, xmin = 0, xmax = 1, ymin = 0, ymax = 1},
 Panel@Row[{"StreamPlot[", inpField[Dynamic[f], 12],
    ", \n ", Invisible["StreamPlo"], "{x, ", 
    inpField[Dynamic[xmin]], ",", inpField[Dynamic[xmax]], 
    "}, \n ", Invisible["StreamPlo"], "{y, ", 
    inpField[Dynamic[ymin]], ",", inpField[Dynamic[ymax]], "}]"}],
 StreamPlot[f, {x, xmin, xmax}, {y, ymin, ymax}]]

Mathematica graphics

Fill-in the input fields and Shift+Enter:

Mathematica graphics

Mathematica graphics


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.