0
$\begingroup$

Lets say I have a function y with 2 variables u and v :

$f(u,v)=y=u+4v$

I want to plot y in 2-D. My first axis is u and my second is v. How do I plot this, if I have a list of values for my y?

I tried

g[y_]:= InverseFunction[y[u_,v_]] 

and put my values in with g/@{1,2,3,4,5} and then created

Table[g[ylist[[i]]{i,1,Length[ylist]}]

This does not work.

Then I tried

aa = Table[ ]

plot = ContourPlot[u+4v, {u, -24, 24}, {v, -20, 20}, Contours -> aa]

but what do I put in Table[ ]? I only have the values for y.

Thank you for the answers. I solved my Problem by just adding my list of values with

Contours->{1,2,3}.

plot = ContourPlot[u+4v, {u, -24, 24}, {v, -20, 20}, Contours -> {1,2,3}]
$\endgroup$
2
  • $\begingroup$ I don't think the problem you have is finding a representation of your wishes in Mathematica. What you seem to want is expressed so fuzzily that most probably you didn't really think about the problem itself. I suggest you try to come up with a better description of your problem. One thing to note is that your function is not invertible. For any given y there's an infinite amount of u and v values that yield this y value. So that's one reason (apart from incorrect syntax) your InverseFunction doesn't work. In the last code box you could put the values in a list and use e.g. aa={3,7,9}. $\endgroup$ Jul 8, 2015 at 14:24
  • $\begingroup$ Is ContourPlot what you want? (The inverse function does not exist mathematically, since y is not one-to-one, so that cannot be what you're after.) Why not just go through some of the docs for ContourPlot and substitute your u+4v, {u, -24, 24}, {v, -20, 20} for the functions there? If you start with ContourPlot[u+4v, {u, -24, 24}, {v, -20, 20}], you can put your mouse over a contour line and it will tell you the value of the contour (that could go in your aa for instance). $\endgroup$
    – Michael E2
    Jul 8, 2015 at 16:53

1 Answer 1

1
$\begingroup$

Using the default contours in ContourPlot you will see that your function ranges from about -100 to 100 within your PlotRange.

Manipulate[
 ContourPlot[u + 4 v, {u, -24, 24}, {v, -20, 20}, 
  ContourLabels -> True, 
  Contours -> Range[-100, 100, delta]], {{delta, 25}, {5, 10, 20, 25, 
   40, 50}}, ControlType -> SetterBar]

enter image description here

$\endgroup$

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