Defining a Function??
- To: mathgroup@smc.vnet.net
- Subject: [mg11407] Defining a Function??
- From: Corey & Alicia Beaverson <cbeavers@utk.edu>
- Date: Sun, 8 Mar 1998 20:13:27 -0500
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]
- Follow-Ups:
- Re: Defining a Function??
- From: Des Penny <penny@suu.edu>
- Re: Defining a Function??
- From: Sean Ross <seanross@worldnet.att.net>
- Re: Defining a Function??