From: dh on
Hi,as you do not give an example I can not be sure. But it sounds like
the ever recurring problem of a function being evaluated with symbolic
arguments. To ensure that the computations are done numerically, you may
e.g. define:
f[x_?NumericQ]:=...
Daniel


On 31.03.2010 12:27, bagarti wrote:
> 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
>


--

Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh(a)metrohm.com>
Internet:<http://www.metrohm.com>


From: ingolf.dahl on
Yes, surely there is such a method, to give you only the numerical values,
just avoid symbolic integration and iterations in your procedures. A good
start is to specify that your own functions should only take numeric
arguments. As example:

f[x_?NumericQ] := x^2

will only evaluate for numeric values of the argument. You have to check
each step of your code, and understand what Mathematica really does to it.
In most practical cases, it is possible to do all necessary symbolic
calculations first, check that carefully, and then use the results to
streamline the procedures for the numeric values, if you have many different
sets of numerical data to evaluate in the same way.

But if you want some more detailed help from the MathGroup, it would help
tremendously to know more in detail what your code is doing inside. The
details are VERY IMPORTANT for the time required, and often there are many
ways to obtain the same result, most slow and a few ways very fast.

Ingolf Dahl
Sweden

-----Original Message-----
From: bagarti [mailto:bagarti(a)gmail.com]
Sent: den 31 mars 2010 12:28
Subject: How to do numerical computations?

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