Question: Matrix containing the values of f(x,y) for a list of (x,y)

I would like to construct a Matrix containing the output of a function f(x,y) for different values of x and y, with the x-values varying (say) along the column and the y-values varying along the row.

I have been able to construct the list of points at which I want to evaluate the function, namely the lists X and Y below. I have been able to use the seq command to construct a Matrix that has the x-values in the first column and the f(x,y) values in the second column for some FIXED value of y. I'd like to make the y-value VARY as well. I don't seem to be able to figure this one out on my own though.

thanks!

 

> restart;
> f := (x,y) -> x + y;

                         f := (x, y) -> x + y

> X := [seq(10+10*i,i=0..4)];
> Y := [seq(10+10*i,i=0..5)];

                      X := [10, 20, 30, 40, 50]


                    Y := [10, 20, 30, 40, 50, 60]

> < seq( < x | f(x,y) >, x = X ) >;

                            [10    10 + y]
                            [            ]
                            [20    20 + y]
                            [            ]
                            [30    30 + y]
                            [            ]
                            [40    40 + y]
                            [            ]
                            [50    50 + y]

> < seq( < y | f(x,y) >, y = Y ) >;

                            [10    x + 10]
                            [            ]
                            [20    x + 20]
                            [            ]
                            [30    x + 30]
                            [            ]
                            [40    x + 40]
                            [            ]
                            [50    x + 50]
                            [            ]
                            [60    x + 60]
 

Please Wait...