MathGroup Archive 2010

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

Search the Archive

Re: How to do numerical computations?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108813] Re: How to do numerical computations?
  • From: dr DanW <dmaxwarren at gmail.com>
  • Date: Thu, 1 Apr 2010 06:01:58 -0500 (EST)
  • References: <hov834$94q$1@smc.vnet.net>

I'm taking a guess that you have a fairly complicated Block[] or
Module[] with an integration that involves some parameters.
Mathematica is hitting that integration and trying to evaluate it
symbolically, which can be time consuming.  I think what you want to
do is prevent that integration from evaluating until it gets numerical
values for the parameters.  One way to do this is to create a function
out of the integration that requires numerical input.  A trivial
example is

int[a_?NumericQ] := NIntegrate[ Sin[x] , {x, 0, a} ]

This way, when you say

b = int[c]

where c has no value, Mathematica will hold it as int[c] and not
attempt a symbolic evaluation.  Later, you can say c = 3., and the
numerical integration can be evaluated quite quickly.

Daniel


  • Prev by Date: Re: Mathematica starts badly 1 time over 5 in OSX
  • Next by Date: Combinatorica NetworkFlow: Does it work?
  • Previous by thread: Re: Mathematica starts badly 1 time over 5 in OSX
  • Next by thread: Re: How to do numerical computations?