## 10 Reputation

8 years, 311 days

## @tomleslie Thank you very much! It did h...

@tomleslie
Thank you very much! It did help on plotting the graph! (Yes, N is the range P)

However, I found a new problem which I do not seem to find an answer even to why it is wrong. Maybe you could help me finding the problem:

I have a function which calculates a number for [x,y] which depends on the values surrounding said initial cell (from [x-1,y-1] yo [x+1,y+1]). However, for the values on the border, the idea is to go around to the opposite side, creating a Torus of the sort.
The solution I seemed to have found was to create 4 indices, 2 controled with 'for' and 2 which were modified accordingly as imputs for the function:

x:=x0;y:=y0;
for r from x-1 to x+1 do
print("r",r);
for t from y-1 to y+1 do
print("t",t);
if r=0 then i:=N; else i:=r; fi;
if t=0 then j:=N; else j:=t; fi;
if r=N+1 then i:=1; else i:=r; fi;
if t=N+1 then j:=1; else j:=t; fi;
print("i",i);print("j",j);
function(i,j);
od; od;

(the print commands are for the tests I have been running so see where the potential error lied).
If you run this script, you can clearly see for x0,y0<>1 that it works perfectly, even for x0,y0=N where it succesfully goes around and changes to 1. However, for x0,y0=1 it isn't able to detect that r&t=0 and so it doesn't change it to N; creating an error where it tries to find the value 0 of an Array.

Thanks,
Enrique

## ....

@acer I will not continue using my initial aproach, it's just that I was kind of happy because although clunky, I was close to a (very ugly) solution. Thank you for the clarification on the distinction of arrays and tables! This kind of stuff are the ones the teachers should be (also) teaching.

Also, I think I found out where the missunderstanding came from: I tried uncomenting the interpolate part (obviously recomenting the "for smoothness part"), but it gave me the error:

surfdata(Matrix(T), 0..nx, 0..tmax, style=surface,

dimension=2, labels=["x", "t"],
#dimension=3, labels=["x", "t", "T"],

gridsize=[100,100], interpolate, #for smoothness

["Indigo","Blue","Cyan","Green","Yellow","Orange","Red"]]);

Error, (in plot/options2d) unexpected option: interpolate

which linked me to a "there is no help awailable for this error" webpage. That's why I thought that I needed to interpolate it manually.

## Great help! but still having a tiny issu...

First of all: thank you for the quick respopnse, despite me not being able to read it so fast! It was REALLY helpfull!

I'm glad to know that I was pretty close to achieving my objective yesterday. I used the grid command to but didn't seem to fix the problem because I did not know the 'restrictoranges' command. However, I cannot use this method because of the fact that I'm truncating the values and the temperatures I'm using is only 1-10 (and in another problem I have T1=1 and T2=2.

I did not know the whole array command and how to write that. It will help me a lot in the future. Is it necessary to write the first line [T:=Array(0..nx,0..tmax,datatype=float[8]):] always?

And two more questions: what is the gridsize? And how can I interpolate? whould I need to create an extra (tedious) proc with a Romberg, or is there a quick and easy command already integrated into Maple?

Thank you again,

Enrique

 Page 1 of 1
﻿