1

I want to evaluate a function of "two" variables using some data points (x,y(x)) (but one of them is related to the other) that I have made with the function Table.

My table of data (x,y(x)) that I have build in Mathematica using Table with a given complicated implicit equation is something like:

data = {{1.35, 3.56}, {1.55, 4.78}, {1.76, 8.89},...}

And imagine that I have the following function:

f[x_, y_] := x*y / (x^2 + y^2)

Now I want to evaluate my list of data points $(x,y(x))$ using my function, and make a plot of that, so plotting actually $f(x)$, because $y(x)$ is not an independent variable. How can that be done?

EXAMPLE:

If I evaluate the list data under the previous function, I will obtain something like

evaluation = {{1.35, 0.331}, {1.55, 0.293}, {1.76, 0.191}}

So precisely I want to do a plot of these points, but in a systematic way of course.

MarcoB
  • 67,153
  • 18
  • 91
  • 189
Joe
  • 111
  • 7
  • very closely related: 2688. Is ListPlot3D[ {##, f[##]}& @@@ data] what you want? – Kuba May 09 '18 at 14:02
  • okay, so I have eddited my post. Actually it's not a function f(x,y), it's given by y(x), so at the end the function is only for a given variable x, because the other is related like y(x) by the table of points – Joe May 09 '18 at 14:13
  • Then isn't data already the table of {x,y}? Use ListLinePlot[data]? – eyorble May 09 '18 at 14:17
  • no, I have edited the post again for clarify – Joe May 09 '18 at 14:28
  • 4
    Generate the processed data using {#1, f[#1, #2]} & @@@ data then use ListPlot. – MarcoB May 09 '18 at 15:15

1 Answers1

1

A simple solution is define f a little different than the way you show.

f[{x_, y_}] := {x, x y/(x^2 + y^2)}

With this definition,

data = {{1.35, 3.56}, {1.55, 4.78}, {1.76, 8.89}};
f /@ data

gives

{{1.35, 0.331537}, {1.55, 0.293415}, {1.76, 0.190508}}

m_goldberg
  • 107,779
  • 16
  • 103
  • 257