MathGroup Archive 2005

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

Search the Archive

Re: Do loop is faulty


a[[i]] is part i of the list a

a=Table[Random[Integer,{1,10}],{10}];
b=Table[Random[Integer,{1,4}],{10}];

c=Table[Integrate[a[[i]]*x*Sin[b[[i]]*x],{x,0,b[[i]]}],{i,10}];

c[[3]]

(3/4)*(-4*Cos[4] + Sin[4])

%//N

1.39333


Bob Hanlon

> 
> From: "dumb_founded" <andreajagger_8 at hotmail.com>
To: mathgroup at smc.vnet.net
> Date: 2005/03/20 Sun AM 04:12:05 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg55380] [mg55368] Do loop is faulty
> 
> I define array a[i] and array b[i] of dimension 10.  Then I go through
> the following Do loop, or try to, that is.
> 
> 
> Array[c,10];
> Do[c[i]=NIntegrate[a[i]*x*Sin[b[i]*x],{x,0,b[i]}]
> 
> I get numerous error messages saying that b[i] is not a valid limit of
> integration.
> 
> This is sheer headache.  I will never try to use Mathematica for
> numerical analysis again.
> 
> All your efforts on this matter are sincerely appreciated.
> 
> 
> 
> Thanks
> 
> 


  • Prev by Date: Re: simple cipher
  • Next by Date: Re: Print on Paper
  • Previous by thread: Re: Do loop is faulty
  • Next by thread: Re: Do loop is faulty