| Author |
Comment/Response |
Forum Moderator
email me
 |
10/31/00 08:45am
>Hello, >
>I would like to solve a function of two variables x and y and evaluate it over a range of values of x and y that I already have accumulated in lists. That is, I have separate lists of x and y values, but of equal length, and I want mathematica to substitute them into the function it generated.
>
>For example,
>
>Evaluate[Table[ f(x,y),{x, list of data for x}, {y, list of data for y}]];
>
>I don't know the syntax for {x, list of data for x} <-- I think that is wrong syntax if you want to supply values of x for a function to evaluate. Please let me know how I can specify input in this case. Thank you.
>
>Sincerely,
>Igor Barani
============
Here is one way:
First the lists:
In[18]:= x = Table[i, {i, 1, 3}]
Out[18]= {1,2,3}
In[19]:= y=Table[j, {j, 4,6}]
Out[19]= {4,5,6}
Then the passing the lists to the function. f is left undefined to show the passing of the variables.
In[20]:= Table[f[x[[i]], y[[i]]], {i, 1, Length[x]}]
Out[20]= {f[1,4],f[2,5],f[3,6]}
Tom Zeller
Forum Moderator
URL: , |
|