Re: Solve for positive, real-valued solutions
- To: mathgroup@smc.vnet.net
- Subject: [mg12463] Re: Solve for positive, real-valued solutions
- From: Paul Abbott <paul@physics.uwa.edu.au>
- Date: Tue, 19 May 1998 13:31:31 -0400
- Organization: University of Western Australia
- References: <6jf2aj$3ut@smc.vnet.net>
Walter Johnston wrote: > How can I tell Solve[] to give me only positive, real-valued solutions? You can't! > 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 think that the c in P[c,a] should be cc (or, instead, use c throughout). It is best to avoid Do and Print and use Table instead (because the output is re-usable). You really need to use FindRoot. A look at the plot of P[c,a] suggests a good starting guess for the root. Table[{c, a /. FindRoot[P[a, c] == 0.02, {a, c - 10}]}, {c, 51, 100}] Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul@physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________