MathGroup Archive 2005

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

Search the Archive

Re: Re: Asking questions


and thus spake Bharat Bhole [2005.06.24 @ 02:30]:
> 
> Suppose I am running a code
> MapThread[func,{Table[d,{d,1,10}]] which takes very long to evaluate for the
> entire list. Mathematica gives me the output ONLY after 'func[d]' has been
> evaluated for all d from 1 to 10.

That's because the kernel is only doing what you tell it to do.  The
matheamtica kernel is single threaded.  You will only 'get a result'
when the entire function has been evaluated.

> Is it possible to make Mathematica give
> the output as it is evaluating after each d. For example, is it possible to
> make it give output after it has evaluated func[1], then func[2] and so on.
> Thank you for your help.
You can get the kernel to Print[] the results as it maps like:

((Print[#]; #)&@f[#]) & /@ Range[10]

but this still won't allow you to use the results in the kernel until
the entire Map call has ended.

(unless, of course, you use another mathematica kernel). 

--
/*------------------------------*\
|        stephen layland         |
|    Documentation Programmer    |
| http://members.wri.com/layland |
\*------------------------------*/


  • Prev by Date: Re: Module command acting funny...
  • Next by Date: Re: Re: Asking questions
  • Previous by thread: Re: Re: Asking questions
  • Next by thread: Re: Re: Asking questions