Re: help
- To: mathgroup@smc.vnet.net
- Subject: [mg11692] Re: help
- From: "Lev Muchnik" <levm@pob.huji.ac.il>
- Date: Sat, 21 Mar 1998 18:35:25 -0500
- Organization: Hebrew Univercity Of Jerusalem
- References: <6esofp$67g@smc.vnet.net>
The second problem is easy. I suggest you use the Table command: In[1]:=seq[a_ ,b_ ,n_]:=Table[x, { x , a , b , (b-a)/n } ] Use it like this: In[2]:=seq[ 10, 30, 7] Out[2]:= ({10, 90\7, 110\7, 130\7, 150\7, 170\7, 190\7, 30} Use In[3]:=RealSeq[a_ ,b_ ,n_]:=Table[N[x], { x , a , b , (b-a)/n } ] If you want to receive floating point results. In[4]:=RealSeq[10,30,7] Out[4]:= {10.,12.8571,15.7143,18.5714,21.4286,24.2857,27.1429,30.} tie@cscn.com wrote in message <6esofp$67g@smc.vnet.net>... >how can i do the following with mathematica: > >1. let X be a vector of N nonnegative numbers. > let Y be any og length N. > form the vector comprised of Y replicated according to the >corresponding > value of the element of X. > > >2. write a function seq[a,b,n] which returns n equally-spaced numbers on >the > interval [a,b]. > >thanks. > >tie@cscn.com >