vvostri

66 Reputation

3 Badges

16 years, 220 days

MaplePrimes Activity


These are answers submitted by vvostri

Thank you, Jean-Marc! Looks like a better way to me.

Thank you for responding, Jean-Marc. The problem is that if one changes the axes ranges the way you show (e.g. X range from 180 to 360), Maple will try to read the data from rows 180-360, rather than to substitute 0.86 to 180 and 8.14 to 360.

 

Thank you, Robert - it worked!

A question related to Matrixplot command:

Suppose I have a 20 by 40 matrix. If I plot it, the x range will be 1..20 and the y range - 1..40. The actual range for my data is 180..360 and -50..50 for x and y accordingly. Is there a way to put these numbers on the plot axes instead of the row/column number?

Thank you!

Yes, thank you very much, Axel!

 

I am a newbie to Maple and was not aware of the expressions like you used for the creation of M. Now I have something like this:

F:=(x,y)->sin(x)*cos(y)

f:=x->x*Pi/180

 

X:=f(<seq(0..360,45)>)

Y:=f(<seq(0..360,60)>)

 

i:=ArrayNumElems(X)

j:=ArrayNumElems(Y)

 

M:= Matrix(i,j,(k,l))->[(max(X)-min(X))*(k-1)/(i-1), (max(Y)-min(Y))*(l-1)/(j-1)]

map('x->F(x[1],x[2])',M)

evalf(%)

 

I understand that this is not the most code-efficient solution, but hey - it works! :-)

Thanks again!

Let's say that the range of x is i1..im and the range of y is j..jn (just to consider the case where i is independent of j).

What I would like to obtain, is the following m by n array:

 

F(i1,j1)    F(i1j2)   ...   F(i1jn)

F(i2,j1)    F(i2j2)   ...   F(i2jn)

...

F(im,j1)    F(imj2)   ...   F(imjn)

 

In the code you provide, the result is the list: F(i1j1), F(i2j2), ... , F(imjn)

 

Does this make more sense?

 

 

Ok, I think I have figured out how to do this, but I still have some trouble at the last step:

 

i:=ArrayNumElems(Y)

for j from 1 by 1 to i do map(a,X,Y[j]) end do

 

However, this returns i matrices, while I would like the result to be in one matrix.

Thank you for the detailed response, Jean-Marc! looks like the safest way is to declare a new variable, that will serve just for reporting the answer with evalf function and not used anywhere else in the calculations.

I see... I did not realize that evalfx performs all intermediate calculations with x digits as well.

Thank you very much, Alec!

Page 1 of 1