MathGroup Archive 2001

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

Search the Archive

Re: How to do a simple loop?


Thanks for the help, Oliver! 
I thought it could be done easier, without numerical stuff.
Vadim.

"Oliver Friedrich" <oliver.friedrich at tz-mikroelektronik.de> wrote in message news:<9ll7pm$m3p$1 at smc.vnet.net>...
> Hi Vadim,
> 
> 1. To print the function i times
> 
> Table[x*i-i,{i,100}]//TableForm
> 
> It creates a list with i elements. Each element represents your desired
> expression.
> 
> 2. Plot the function
> 
> Scan[ Plot[ x i-i, {i,0,#}]&, Range[100]]
> 
> Range creates a table with elements 1 to 100. Scan operates the Plot
> function on each of that elements. The element is inserted at the # (a so
> called pure function). Careful with that x, you must replace it with a
> numerical value, cause Plot won't evaluate on non-numeric expressions.
> 
> 3. Find the Integral
> 
> Map[Integrate [x i-i, {x, 0, #}]&,Range[5]]
> 
> Same as above, except that Map creates a list with the result.
> 
> Have fun
> 
> Oliver Friedrich
> 
> 
> 
> "Vadim Nagornyi" <vnagornyi at netscape.net> schrieb im Newsbeitrag
> news:9ligqt$is2$1 at smc.vnet.net...
> > Still using 2.2 ...
> > OK, I have a function that depends on an integer, for example F=x*i-i.
> > For i ranging from 1 to 100 I need to perform the following:
> >
> > 1. Display the function equation.
> > 2. Plot the function in the range 0...i
> > 3. Find the integral of the function for the same range.
> >
> > The loop body looks simple:
> >
> > F
> > Plot[F, {x, 0, i}]
> > Integrate [F, {x, 0, i}]
> >
> > but how to iterare this?
> >
> > Thanks,
> > Vadim.
> >


  • Prev by Date: Re: Effect of changing chip on MathPass/MacineID
  • Next by Date: Re: ,Date calculating software?
  • Previous by thread: Re: How to do a simple loop?
  • Next by thread: Pentium 3 versus Pentium, also memory, bus speeds