MathGroup Archive 2003

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

Search the Archive

Mathematica Programming Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42539] Mathematica Programming Problem
  • From: "Loh" <lohleeping at hotmail.com>
  • Date: Mon, 14 Jul 2003 05:42:08 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hai,
    
       I would like to ask something regarding programming in 
Mathematica.

       Below is what I wrote in Mathematica,

T1[n_]:=Module[{list1={},i,m=1,y},
                    While[m<=n, =
y=1/(n-1)!Sum[Binomial[n,i](-1)^(n-i)(i-x)^(n-1),{i,m,n}];
                                     list1=PrependTo[list1,y];
                                             m++];
                                                    list1]

T2[n_]:=Module[{list2={},,j=1},
                While[j<=n, P[x_]:=Part[T1[n],j];
                    list2=PrependTo[list2,P[t+n-j];   
                        j++];
                            list2]

Can you please help me to look at T2. Is there any problem ?
When I run those function, it's ok. But when I key in T2[3],
the output is: { x^2/2, -3/2+3x-x^2, 9/2-3x+x^2/2 }.

But,the actual answer should have variable t inside, isn't it?
Please reply A.S.A.P.

Thank you very much.

Best regards,
Loh


  • Prev by Date: Re: Crank-Nicolson finite difference method for 2D
  • Next by Date: Re: Need for (FindFit, Refine) ?
  • Previous by thread: Re: Crank-Nicolson finite difference method for 2D
  • Next by thread: Re: Mathematica Programming Problem