MathGroup Archive 1998

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

Search the Archive

Re: Solve for positive, real-valued solutions


  • To: mathgroup@smc.vnet.net
  • Subject: [mg12451] Re: Solve for positive, real-valued solutions
  • From: Daniel Lichtblau <danl@wolfram.com>
  • Date: Tue, 19 May 1998 13:31:21 -0400
  • Organization: Wolfram Research, Inc.
  • References: <6jf2aj$3ut@smc.vnet.net>

Walter Johnston wrote:
> 
> How can I tell Solve[] to give me only positive, real-valued solutions?
> 
> Long Version:
> 
> I am trying to build a table of values for use in a database. The
> expression is
> 
> P[c_,a_]:=(a^c/c!)/Sum[a^i/i!,{i,0,c}].
> 
> and I then tell the system to
> 
> Do[Print[cc," => ",Solve[P[c,a]==0.02,a]],{cc,51,100,1}]
> 
> which works, but gives me a lot more than I want.
> 
> I have just started using Version 3.1 on my notebook (Windows NT 4.0)
> and would really appreciate any suggestions on how to speed this up and
> just get the positive, real-valued solutions I need for the database.
> 
> (RTFM statements won't help much. I am reading, but trying to shorten
> the learning curve and get some solutions NOW.)
> 
> Thanks.
> 
> Walter Johnston

You can save alot of trouble by using FindRoot instead of Solve. Below
is part of your example. 100 digits of working precision may be
overkill. You might instead play with the AccuracyGoal or MaxIterations
options.

In[8]:= Table[FindRoot[P[c,a]==N[1/50,100], {a,1},
WorkingPrecision->100], {c,50
,60}]
Out[8]= {{a ->
40.25514380365654216931750153252582108825224733954975370281399\
>       802096567583064973654134782140389116196},
>    {a -> 41.188855036388428106575243749499302257125751726300235682311781144\
>       86570521951250211953197306521208194},
>    {a -> 42.123815880944774326285951014690839594404952603593351518209081999\
>       95321544670381710033627392832634524},
  >    {a ->
43.059986304600110515572601571996994581868781405077221678073728269\
>       72729442080888008843107974096517325},
>    {a -> 43.997328269695531722495410651105331386001237941056767632464311672\
>       68667525413760683556827035393967340},
>    {a -> 44.935805599725599318209311964237567165893694259465115370351418612\
>       76526440987337463949935847729993057},
>    {a -> 45.875383856650515606884207763126132244871404835734890201224226228\
>       99097304270298364653781261333622989},
>    {a -> 46.816030228311590770638830684766095885782662572314771202341472697\
        >       02911687165402358844452609152083498},
>    {a -> 47.757713424957635094502088855717706716711256654258261022937573744\
>       74238401693118909094838353597794958},
>    {a -> 48.700403584002600729001907423845296098830638347949282456171702491\
>       07598571414806500335998191891256325},
>    {a -> 49.644072182233021139220737196266584933367302527105875178060235657\
>       05209234795488012252753388146205941}}
                                               

Daniel Lichtblau
Wolfram Research



  • Prev by Date: Re: Want a smooth function from Arg[ ]
  • Next by Date: <none>
  • Prev by thread: Re: Solve for positive, real-valued solutions
  • Next by thread: Nonlinear Programming Package for Mathematica?