Re: Defining a Function??
- To: mathgroup@smc.vnet.net
- Subject: [mg11440] Re: [mg11407] Defining a Function??
- From: "C. Woll" <carlw@u.washington.edu>
- Date: Thu, 12 Mar 1998 01:33:30 -0500
Hi, Anytime a function just echoes your input, it probably means you haven't given your function the right input. In your case, notice that your function definition expects 11 arguments, and you are only giving it 10. So, add another argument and see what happens. Carl Woll Dept of Physics U of Washington On Sun, 8 Mar 1998, Corey & Alicia Beaverson wrote: > Below is a program that I have written, with much help from the critique > on my last program...thanks everybody!. Anyway, if I define all of the > varibles as global, the program runs and outputs the results. I want to > set it up as a function though so I can use it for more than one case. > I am not sure what I am doing wrong here but for some reason it does > not seem to run, instead it just gives me the input back.....Thanks in > advance!!! > > > > In[29]:= > > OneDPlaneWall[L_,rho_,k_,c_,Tinfo_,TinfL_,ho_,hL_,time_,T_,n_]:= > Module[{ alpha, deltax, Bio, BiL, foo, foi,foL, deltat, fo}, > alpha=k/(rho*c); > deltax=L/(n-1); > Bio=(ho*deltax)/k; > BiL=(hL*deltax)/k; > foo=1/(2(1+Bio)); > foi= 0.5; > foL=1/(2(1+BiL)); > fo=Min[foo,foi,foL]; > deltat=(fo(deltax)^2)/alpha; > T=Table[T, {n}]; > While[ Min[T]>0, > time=time+deltat; > T[[1]]=((1-2*fo-2*Bio*fo)T[[1]] +fo*2(T[[2]]+Bio*Tinfo)); > T[[Range[2,n-1]]]= > Table[Int=((1-2*fo)T[[i]]+fo(T[[i-1]]+T[[i+1]])), {i,2,n-1}]; > T[[n]]=((1-2*fo-2*BiL*fo)T[[n]]+fo*2(T[[n-1]]+BiL*TinfL))];] > T > time > > > Out[30]= > Table[T,{n}] > Out[31]= > time > In[32]:= > OneDPlaneWall[0.25,1860,0.72,17,-6,100,60,0,17,11] Out[32]= > OneDPlaneWall[0.25,1860,0.72,17,-6,100,60,0,17,11] > > >