MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Could some one please help

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99924] Could some one please help
  • From: gtw <graceneetw at google.com>
  • Date: Tue, 19 May 2009 06:46:58 -0400 (EDT)

I am new in numerical.  The following is
to try to solve D[u[x,y],x,x]+D[u[x,y],y,y]=1-u[x,y]
The line eqns=... is wrong (I think) 
Could someone tell me how to fix?
Besides, how to put Neumann boundary condition
Thanks

num = 80; hStep = N[1/(num + 1)];
vars = Table[u[i, j], {i, num}, {j, num}];
Short[vars, 3]
kern = {{0, 1, 0}, {1, -4, 1}, {0, 1, 0}}/hStep^2;
lap = ListCorrelate[kern, vars, {2, 2}, 0];
(* equation for solution on grid*)Short[
eqns = Thread[Map[Flatten, lap == 1 - u[i, j]]], 20]
{vec, mat} = CoefficientArrays[eqns, Flatten[vars]]
sol = LinearSolve[mat, -vec];
sol = Partition[sol, num];
ListContourPlot[sol]
ListPlot3D[sol]


  • Prev by Date: Re: Use of names
  • Next by Date: Re: "SelectionData" and palettes
  • Previous by thread: Re: How Long?
  • Next by thread: Re: Could some one please help