0
$\begingroup$

I need to do some computations with maple which I don't know how to do it. So I thought I can ask you.

I am going to pick a simple function, as simple as possible. let's take $f(x,y):=x^2+y^2$. I want to make a list with maple to give me a list of numbers producing with $f(x,y)$ for integral value $x=1...5$, and $y=1...5$, in other word a list consists of $f(1,1), f(1,2), f(1,3),..., f(5,5)$.

Of course my function and the range is much more complicate, so I just took this particular function just to be more precise.

Thank you.

  • 0
    @Theo: I don't know either, so I didn't vote to close on this one. OTOH, the old version of myself would have said "RTFM" for this question, but I'm *really* trying to be a nice guy these days...2011-08-14

1 Answers 1

3

Here's one way:

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

$ f := (x,y) \to x^2 + y^2 $

> M := Matrix(5, 5, f); 

$ M := \begin{bmatrix} 2 & 5 & 10 & 17 & 26 \\ 5 & 8 & 13 & 20 & 29 \\ 10 & 13 & 18 & 25 & 34 \\ 17 & 20 & 25 & 32 & 41 \\ 26 & 29 & 34 & 41 & 50 \end{bmatrix}$

> ListTools:-Flatten( convert(M, listlist) );   

$[2, 5, 10, 17, 26, 5, 8, 13, 20, 29, 10, 13, 18, 25, 34, 17, 20, 25, 32, 41, 26, 29, 34, 41, 50]$