MathGroup Archive 2011

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

Search the Archive

how packages work

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116664] how packages work
  • From: "Ted Sariyski" <tsariysk at craft-tech.com>
  • Date: Wed, 23 Feb 2011 05:24:23 -0500 (EST)
  • References: <201102210920.EAA20640@smc.vnet.net>

Hi,
I am confused how packages work. I have a simple function which I can plot
and evaluate without any messages or warnings, e.g. 

# f[3000, lam1, lam2]/.{lam1-> 4.*10^-7, lam2->5.*10^-7}
Out: -411.32

When I try FindRoot I get an obscure message followed by a correct result:

# FindRoot[f[x, lam1, lam2] == 0, {x, 3000}] (*lam1=4.*10^-7;
lam2=5.*10^-7*)

Out: NIntegrate::inumr: The integrand 3.74177*10^-16/((-1+E^(<<21>>/(x
z$36620))) z$36620^5) has evaluated to non-numerical values for all sampling
points in the region with boundaries {{4.*10^-7,5.*10^-7}}. >>
{x -> 4969.42}

Function f is defined through two modules in myUtils` package:

f[x_, lam1_, lam2_] := inbInt[x, lam1, lam2] - 420.;
     
(*myUtils`*)

inbInt[t_,l1_,l2_] :=
    Module[ {z,bbint},
        bbint = NIntegrate[pFun[t, z],{z,l1,l2}];
        Return[bbint];
    ];
	    
pFun[t_, x_] :=
    Module[ {bbint},
        bbint = (3.74*10^-16/ x^5)/(Exp[0.014/(x*t)]-1);
        Return[bbint];
    ]; 

How is that Plot doesn't complain for non-numerical values but FindRoot
does?

Thanks in advance,
--Ted

    
 



  • Prev by Date: Re: Delete elements from list..
  • Next by Date: Re: problem to define a complex variable
  • Previous by thread: Re: DeveloperContextFreeForm and local symbols in packages (more)
  • Next by thread: Odd behaviour of solution of PDE