MathGroup Archive 2003

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

Search the Archive

Re: guidance in mathematica programming in pde

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43646] Re: guidance in mathematica programming in pde
  • From: sean_incali at yahoo.com (sean kim)
  • Date: Sat, 27 Sep 2003 04:58:08 -0400 (EDT)
  • References: <bl0unq$3vv$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

farkhanda_yusaf at hotmail.com (farkhanda) wrote in message news:<bl0unq$3vv$1 at smc.vnet.net>...
> respected sir i have just started the mathematica and facing lot of
> problems. during my search on internet I found your group email
> address. you repliled to one student like me about the problem in
> mathematica.

yes, to charu bhat, from purdue, he had the same problem, as I did
while back(i wonder whatever happened to his problem anyway? )


> I am sending the problem with my approach of
> programming,if possible point out me my mistake and at the same time
> if write the programm of this problem again,it will better for me in
> the sense that it give me new idea to think on the same line.
> waiting for a very positive response.thank you very much


Don't you mean jf alcover's approach? 
as per http://forums.wolfram.com/mathgroup/archive/2003/Aug/msg00018.html?

or in google, 
http://groups.google.com/groups?q=jf+alcover+group:comp.soft-sys.math.mathematica+group:comp.soft-sys.math.mathematica+group:comp.soft-sys.math.mathematica&hl=en&lr=&ie=UTF-8&group=comp.soft-sys.math.mathematica&selm=bgcua9%249n2%241%40smc.vnet.net&rnum=2

Compare the above to the below. is the code below your approach? 

> MY APPROACH OF PROGRAMING
> ClearAll[u, x, t];
> 
> deltat = 0.01;
> deltax = 0.2;
> 
> (*we check the stability condition :*)
> Print["stability test = ", (deltat)/(deltax)^2 <= 1/2];
> kmax = Floor[1/deltax];
> nmax = Floor[1/deltat];
> 
> (*boundary conditions :*)
> u[k_Integer /; k <= 0 || k >= kmax, n_Integer] = 0;
> 
> (*initial conditions :*)
> u[k_Integer /; 0 <= k <= kmax/2, 0] := k deltax;
> u[k_Integer /; kmax/2 <= k <= kmax, 0] := 1 - k deltax;
> 
> (*difference scheme :*)
>  (u[k, n + 1] - u[k, n])/(deltat) == (u[k + 1, n] - 2u[k, n] + 
>             u[k - 1, n])/(deltax)^2;
> eq = 0.25 u[-1 + k, n] + 0.50 u[k, n] + 0.25 u[1 + k, n]
> 
> u[k_Integer /; 0 <= k <= kmax, n_Integer /; n > 0] :=
>     u[k, n] = 
>       0.25 u[-1 + k, n - 1] + 0.50 u[k, n - 1] + 0.25 u[1 + k, n - 1];
> abc = Table[u[k, n], {k, 0, kmax}, {n, 0, nmax - 1}] // Transpose // 
>     MatrixForm
> ListPlot3D[abc]


remove the MatrixForm at the end. ListPlot3D will take a list of lists
 as its argument. not lists in a matrix form. below is the fix.

*your code*  
abc = Table[u[k, n], {k, 0, kmax}, {n, 0, nmax - 1}] // Transpose
//MatrixForm
ListPlot3D[abc]

*fix* 
abc = Table[u[k, n], {k, 0, kmax}, {n, 0, nmax - 1}] // Transpose
ListPlot3D[abc]


good luck


  • Prev by Date: RE: Incorrect integral
  • Next by Date: Re: Mathematica commands needed to solve problem in Set Theory!
  • Previous by thread: guidance in mathematica programming in pde
  • Next by thread: Re: guidance in mathematica programming in pde