# How to determine specific values of a function on each streamline

I was thinking if there is a way to obtain the values of a function from a streamline plot. This is what I mean:

Consider a typical streamline plot from the documentation: StreamPlot[{-1 - x^2 + y, 1 + x - y^2}, {x, -3, 3}, {y, -3, 3}, StreamPoints -> {{{{1, 0}, Red}, {{-1, -1}, Green}, Automatic}}] with a typical output My Question: is there a way one could dynamically display the value of the functions that were plotted for the green streamline for instance, as you hover your cursor along the line (green streamline)? Thank you.

• You mean, display each point that went into drawing a particular stream line? – J. M.'s torpor Oct 8 '16 at 4:47
• I understand you mean something analoguous to: right click on the graph and select "get coordinates". – Dr. Wolfgang Hintze Oct 8 '16 at 12:51
• Thanks for your comment @Dr.WolfgangHintze. What I meant is what bbgodfrey actually showed. To display the corresponding value of the functions at a given coordinate. – D. Andrew Oct 8 '16 at 14:44
• In V12.2, due to a change in StreamPlot, one has to add the option StreamColorFunction -> None to reproduce the figure in the question. – Michael E2 Jan 11 at 2:36

## 1 Answer

Since ToolTip does not appear to work here, try

Dynamic[{loc = MousePosition["Graphics", {0, 0}],
{-1 - x^2 + y, 1 + x - y^2} /. {x -> First@loc, y -> Last@loc}}]


which gives a result that looks like

{{x, y}, {xstream, ystream}}


where x and y are the positions on the plot (the coordinates provided by Get Coordinate Tool as suggested by Dr. Wolfgang Hintze in a comment above), and xstream and ystream are the corresponding values of the functions there. For instance, when the mouse is at the tip of the Red streamline, the coordinates and values are approximately

((0.0308851, 1.0987}, {0.00331156, 0.101788}}


The output can be dressed up a bit, if desired, by

Dynamic[StringForm["loc = , val = ",
loc = MousePosition["Graphics", {0, 0}],
val = {-1 - x^2 + y, 1 + x - y^2} /. {x -> First@loc, y -> Last@loc}]]

• Thanks, @bbgodfrey. This is what I actually meant.This concept could be useful to gain some insight beforehand of what the solutions of some complex functions should be even before attempting to solve them. – D. Andrew Oct 8 '16 at 14:52
• @bbgodfrey excellent solution (+1). – Dr. Wolfgang Hintze Oct 9 '16 at 7:37