[Date Index]
[Thread Index]
[Author Index]
Re: How to do numerical computations?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg108808] Re: How to do numerical computations?
*From*: "Nasser M. Abbasi" <nma at 12000.org>
*Date*: Thu, 1 Apr 2010 06:01:02 -0500 (EST)
*Organization*: Aioe.org NNTP Server
*References*: <hov834$94q$1@smc.vnet.net>
"bagarti" <bagarti at gmail.com> wrote in message
news:hov834$94q$1 at smc.vnet.net...
> Hello,
> Any body please help me,
>
> I have written some mathematica code which contains some complicated
> functions.The functions involve integrations and iterations in the
> intermediate steps. When I run the code it takes a hell lot of time. I do
> not know what mathematica is doing inside, actually I have another code in
> fortran that takes only a few minutes to do all the calculations but there
> are other problems like it dosent work for some parameter range.
>
> Is there a method in which I can ask mathematica to give me only the
> numerical values just like any executable program does.
>
> Thanks.
> TaB
>
Symbolic computation is very useful for the analysis and the investigation
of a problem analytically. (funny thing to say, because how else would one
do this other by symbolic computation?)
But when it comes to solving the problem on a large scale, and for speed, I
think you want to switch to numerical computation. This could be as easily
as warping N[] around an expression, or having the initial parameters be
floating point values instead of rational (i.e. for the values of the
variables used, write 1.0/2 or 0.5 instead of 1/2 and write 1.0 instead of
1).
There is a cascading effect here, if one variable is floating point, then
the calculation of the expression which this variable is in will be done
numerically and will be normally faster.
Also, try to use functions such as NIntegrate and NSolve and NDSolve instead
of the symbolic versions.
I wrote a small finite elements program last year in Mathematica, and it was
very slow when the number of elements and the stiffness matrix became large,
this is because at first I kept everything in symbolic form, so all the
terms were in symbolic form until the end when I substitute numerical values
for the variables.
When I started to make some of the changes above, and to assign a numerical
values for the variables early on, the program ran much much faster than
before.
--Nasser
Prev by Date:
**Re: How to do numerical computations?**
Next by Date:
**A simple ParallelDo problem**
Previous by thread:
**Re: How to do numerical computations?**
Next by thread:
**Re: How to do numerical computations?**
| |