Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'two variable function and lists' topicStudent Support Forum > General > "two variable function and lists"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
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: ,

Subject (listing for 'two variable function and lists')
Author Date Posted
two variable function and lists Igor Barani 10/31/00 07:58am
Re: two variable function and lists Forum Modera... 10/31/00 08:45am
Re: two variable function and lists Aaron Honecker 10/31/00 1:25pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic