<

lsw187

10 Reputation

One Badge

8 years, 27 days

MaplePrimes Activity


These are questions asked by lsw187

How do I get values out of solved augmented matric in 2D math input? I cannot simply assign the solutions to a value by x:=A[1,5}, because it's an augmented matrix.

I keep getting an error about the while. It is calling it an invalid if statement.  It may relate to semi colons, but I cannot find any errors myself. Please help.

InterpolIDW2:=proc(n,rwin,mink,p,R,IR)       

local ix,iy,i,j,i0,i1,j0,j1,k;      

local count,wgt,top,bot,hp;      

print(`n=`,n,`rwin=`,rwin,`mink=`,mink,`p=`,p);      

hp:=p/2;        

for iy from 1 to n do      

for ix from 1 to n do           

if (IR(ix,iy)=0) then                

i0:=max(1,ix-rwin);  i1:=min(n,ix+rwin);                

j0:=max(1,iy-rwin);  j1:=min(n,iy+rwin);                 

k:=add(add(IR(i,j),i=i0..i1),j=j0..j1)                                                                

while (k<mink )do                              

if(i0>1) then                                       

i0:= i0-1;                                       

k:= k+ add(IR(i0,j),j=j0..j1)                              

end if;                              

if(i0<1) then                                        

i0:=i0+1;                                        

k:= k+ add(IR(i0,j),j=j0..j1)                              

end if;                              

if(j0>1) then                                        

  j0:=j0-1;                                       

  k:= k+ add(IR(i,j0),i=i0..i1)                         

  end if;                           

 if(j0<1) then                                

 j0:= j0+1;                                         

k:= k+ add(IR(i,j0),i=i0..i1)                             

end if;                         

end do;                  

top:=0;  bot:=0;                

for j from j0 to j1 do                

for i from i0 to i1 do                      

if (IR(i,j)<>0) then                           

wgt:=1/evalf[14](((ix-i)^(2)+(iy-j)^(2))^(hp));                           

top:=top+wgt*R(i,j);                           

bot:=bot+wgt;                      

end if;                

end do;                

end do;                

R(ix,iy):=top/bot;           

end if;      

end do;      

end do;  

end proc:

Page 1 of 1