Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question

closed as off topic by Grigory M, Asaf Karagila, Qiaochu Yuan Aug 14 '11 at 18:41

Questions on Mathematics Stack Exchange are expected to relate to math within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
1  
@J.M. I'm not quite sure why this is considered off-topic. Can you illuminate me? –  t.b. Aug 14 '11 at 18:54
    
@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... –  J. M. Aug 14 '11 at 18:56
add comment

1 Answer 1

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]$$

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.