Re: FindRoot migration question
- To: mathgroup at smc.vnet.net
- Subject: [mg79928] Re: FindRoot migration question
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 9 Aug 2007 05:14:14 -0400 (EDT)
- Organization: Uni Leipzig
- References: <f9c176$6h8$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
you must prevent, that FindRoot[] is called with symbolic arguments
and replacing the pattern for LL1[]
with
LL1[nx_?NumericQ,cov_?NumericQ]:= ...
should do that.
Regards
Jens
Guillermo Barrenetxea wrote:
> Hi,
>
> I have recently migrated form mathematica 4 to mathematica 6, and some of
> the programs I was using are not correct any more.
> One recurrent error occurs with functions including FindRoot. I enclose here
> an example:
>
> thanks for your help,
> guillermo
>
>
>
>
> quit;
> cmin = 10^(-10); cmax = 1/100;
> sigma1[n1_, nx_, cov_, L_] := (4 Pi^2 L^2 nx (1 - n1))/(Log[1/cov] - ((3 -
> cov) (1 - cov)/2))
> LL1[nx_, cov_] := FindRoot[nx L^2 Pi (Log[L^2 Pi] - (1 - (1/(Pi L^2)))) ==
> Log[1/cov] - (1 - cov), {L, 1.0, 2.0}]
> sigm1[n1_, nx_, cov_] := sigma1[n1, nx, cov, L /. LL1[nx, cov]]
>
> sigm1[1/10000000000, 1/10000000000, 1/10000000000] (* this works perfectly
> *)
>
>
> (* however, if I want to interpolate the sim1 function, it complains *)
>
> sig1 = FunctionInterpolation[sigm1[n1, nx, cov], {n1, cmin, cmax}, {nx,
> cmin, cmax}, {cov, cmin,cmax}];
>
>