Home > Archive > Mathematica > August 2006 > Preventing NIntegrate from reevaluating after DumpSave and Get
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Preventing NIntegrate from reevaluating after DumpSave and Get
|
|
| Chris Rodgers 2006-08-18, 4:07 am |
| Hi,
I have been running a computation in Mathematica which attempts to
NIntegrate[myformula,{t,0,infinity}] for many different model parameters.
The results are in a large list. e.g.
resultslist = {0, 7, 13.33,
NIntegrate[myformula_at_tricky_parameter
_vals,{t,0,infinity}],11,2,...}
Notice that sometimes NIntegrate does not converge for particular model
parameters.
At the end of a long-running batch job, I DumpSave this results list.
Now, my question is this:
When I load the results back into Mathematica and try to use them things
are very slow. I suspect that this is because Mathematica retries
evaluating all the NIntegrate[...] on which it got stuck the first time
around.
I have tried e.g.
Get["MyFile.mx"]
sanelist = resultslist /. NIntegrate[___]->NotANumber
but this also takes ages evaluating the NIntegrate[...].
Is there an easy way to load the .mx file and eliminate any of the
non-converged NIntegrate[...] entries without having to wait for them to
all be evaluated another time?
Many thanks in advance,
Chris Rodgers.
| |
| albert 2006-08-19, 4:03 am |
| Hi,
> When I load the results back into Mathematica and try to use them things
> are very slow. I suspect that this is because Mathematica retries
> evaluating all the NIntegrate[...] on which it got stuck the first time
> around.
>
> I have tried e.g.
>
> Get["MyFile.mx"]
even here the NSolves will be evaluated since Mathematica basically tries to
evaluate everything it sees...
> sanelist = resultslist /. NIntegrate[___]->NotANumber
> but this also takes ages evaluating the NIntegrate[...].
to import the Results unevaluated, you could try something like this:
Block[{NIntegrate},
Get["MyFile.mx"]/.NIntegrate[___]->NotANumber
]
this is untested, but I think it should work. Anyway it should be worth a
try.
hth,
albert
| |
| Jens-Peer Kuska 2006-08-19, 4:03 am |
| Hi,
you must remove the NIntegrate[] calls *before* you make the dump-save.
Or, just an idea
Block[{NIntegrate},
NIntegrate[any__]:=Indeterminate
Get["MyFile.mx"]
]
overwrite temporal NIntegrate[]
Regards
Jens
Chris Rodgers wrote:
> Hi,
>
> I have been running a computation in Mathematica which attempts to
> NIntegrate[myformula,{t,0,infinity}] for many different model parameters.
>
> The results are in a large list. e.g.
> resultslist = {0, 7, 13.33,
> NIntegrate[myformula_at_tricky_parameter
_vals,{t,0,infinity}],11,2,...}
>
> Notice that sometimes NIntegrate does not converge for particular model
> parameters.
>
> At the end of a long-running batch job, I DumpSave this results list.
>
> Now, my question is this:
>
> When I load the results back into Mathematica and try to use them things
> are very slow. I suspect that this is because Mathematica retries
> evaluating all the NIntegrate[...] on which it got stuck the first time
> around.
>
> I have tried e.g.
>
> Get["MyFile.mx"]
>
> sanelist = resultslist /. NIntegrate[___]->NotANumber
>
> but this also takes ages evaluating the NIntegrate[...].
>
> Is there an easy way to load the .mx file and eliminate any of the
> non-converged NIntegrate[...] entries without having to wait for them to
> all be evaluated another time?
>
> Many thanks in advance,
>
> Chris Rodgers.
>
| |
| Peter Pein 2006-08-19, 4:03 am |
| Chris Rodgers schrieb:
> Hi,
.....
> I have tried e.g.
>
> Get["MyFile.mx"]
>
> sanelist = resultslist /. NIntegrate[___]->NotANumber
>
> but this also takes ages evaluating the NIntegrate[...].
>
> Is there an easy way to load the .mx file and eliminate any of the
> non-converged NIntegrate[...] entries without having to wait for them to
> all be evaluated another time?
>
> Many thanks in advance,
>
> Chris Rodgers.
>
Hi Chris,
maybe it helps to do a
resultlist = resultlist /. _NIntegrate -> NotANumber
_before_ dumpsaving?
I have to admit, I didn't try it.
Peter
|
|
|
|
|