MathGroup Archive 1998

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

Search the Archive

Re: Solve for positive, real-valued solutions



At 11:15 14-05-98 -0400, 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
>
>
>

hi Walter,

this worked for me: (trick : use FindRoot, not Solve (that's for
Polynomial stuff)
and give ( cc + 1. )  as starting value for a in Newton's Method.

In[1]:=
(a^c/c!)/Sum[a^i/i!,{i,0,c}]//FullSimplify Out[1]=
a^c/(E^a*Gamma[1 + c, a])
In[2]:=
P[c_, a_] := a^c/(E^a*Gamma[1 + c, a]) In[3]:=
Plot[Evaluate@Table[P[cc,aa],{cc,10}],{aa,0,10}] In[4]:=
Do[Print[cc," => ",
    mem=FindRoot[P[cc,a]==0.02`48,{a,1.+cc},AccuracyGoal->16,
        WorkingPrecision->48,MaxIterations->120],"\t \t =>",
    N[P[cc,a/.mem],48]],{cc,1,100}]


1 => {a -> 0.020408163265306122448979591836734693877551020408}	 	 =>0.02
2 => {a -> 0.2234668238993101948437713920410624500363950104}	 	 =>
0.02000000000000000000000000000000000000000679837 3 => {a ->
0.602206479066841072564710973702652204206514588}	 	 =>0.02 4 => {a ->
1.0922605004352352039072153673461129244824636855}	 	 =>0.02 5 => {a ->
1.6571430690550939276582696512921664010600694737}	 	 =>
0.02000000000000000000000000000000000000000026103 6 => {a ->
2.2758761026283289320034705896580175768265045248}	 	 =>0.02 7 => {a ->
2.935405689587233917272672941123801012256982316}	 	 =>0.02 8 => {a ->
3.627050474607427292015318308967795010382703535}	 	 =>
0.02000000000000000000000000000000000000000040908 9 => {a ->
4.344729245215880488115423746780855203900494059}	 	 =>
0.02000000000000000000000000000000006889144361885 10 => {a ->
5.084004630455149099429392282741982594449727571}	 	 =>0.02 11 => {a ->
5.841531139545520097883922187713682152434120013}	 	 =>0.02 12 => {a ->
6.614718301089956716730669501920446752171462404}	 	 =>0.02 13 => {a ->
7.401515366214546394545093596242628150301710401}	 	 =>0.02 14 => {a ->
8.200268296626338594028830589377932542763136811}	 	 =>0.02 15 => {a ->
9.009621620823930726353946688515237294392851423}	 	 =>0.02 16 => {a ->
9.828449178427261644256101863760963119801261401}	 	 =>0.02 17 => {a ->
10.655804058849134678933741887126230631712233232}	 	 =>0.02 18 => {a ->
11.490881646917342717143136758000710178992417445}	 	 =>0.02 19 => {a ->
12.332991835585594872064452623759047589833123378}	 	 =>0.02 20 => {a ->
13.181537787166228630124878183126410611555215038}	 	 =>0.02 21 => {a ->
14.035999461264442201773957034155182298438318304}	 	 =>0.02 22 => {a ->
14.895920671256663946425166422057954704262900052}	 	 =>0.02 23 => {a ->
15.760898792590454959775301203679608622153456795}	 	 =>0.02 24 => {a ->
16.630576491480621262210574193076075184790064033}	 	 =>0.02 25 => {a ->
17.504635012188948441911989227600261768185934878}	 	 =>0.02 26 => {a ->
18.382788680359644330624990024605243513192267688}	 	 =>0.02 27 => {a ->
19.264780365079874235580198254993920830361461175}	 	 =>0.02 28 => {a ->
20.150377704053582453480821362164353120630839599}	 	 =>0.02 29 => {a ->
21.039369941573162234590463214152039404983881914}	 	 =>0.02 30 => {a ->
21.931565262618850390763846097929416351451333449}	 	 =>0.02 31 => {a ->
22.826788531686083066693665097365324914989139241}	 	 =>0.02 32 => {a ->
23.724879364117854743046927235013283123863132776}	 	 =>0.02 33 => {a ->
24.625690472412026301263839929034298323207895363}	 	 =>0.02 34 => {a ->
25.529086241332145390581533195623068009141997271}	 	 =>0.02 35 => {a ->
26.434941494505106710560538823058677225847916816}	 	 =>0.02 36 => {a ->
27.343140422146161569238637846031536628268291464}	 	 =>0.02 37 => {a ->
28.253575645058424417644686878585361065003159086}	 	 =>0.02 38 => {a ->
29.166147394442837985088009397383441004803545733}	 	 =>0.02 39 => {a ->
30.080762790575364575729927885636280087272707637}	 	 =>0.02 40 => {a ->
30.997335206250096901438418018933762144597079293}	 	 =>0.02 41 => {a ->
31.91578370319433186661602829010041329681031591}	 	 =>0.02 42 => {a ->
32.83603253154534437927054844100224188262492121}	 	 =>0.02 43 => {a ->
33.75801068402449127177513590031016618412315011}	 	 =>0.02 44 => {a ->
34.6816514977192649401857477449730546967503390}	 	 =>0.02 45 => {a ->
35.60689229744045621730035554411275521978150592}	 	 =>0.02 46 => {a ->
36.53367407550105186379740302878635116839154453}	 	 =>0.02 47 => {a ->
37.46194120349870723516334698489437166473323300}	 	 =>0.02 48 => {a ->
38.39164117230077963393780359013031390803001985}	 	 =>0.02 49 => {a ->
39.32272435695097296473493582290210421596610213}	 	 =>0.02 50 => {a ->
40.2551438036565421693175015325258210882522473}	 	 =>0.02 51 => {a ->
41.18885503638842810657524374949930225712575173}	 	 =>0.02 52 => {a ->
42.12381588094477432628595101469083959440495260}	 	 =>0.02 53 => {a ->
43.05998630460011051557260157199699458186878140}	 	 =>0.02 54 => {a ->
43.99732826969553172249541065110533138600123794}	 	 =>0.02 55 => {a ->
44.93580559972559931820931196423756716589369426}	 	 =>0.02 56 => {a ->
45.87538385665051560688420776312613224487140484}	 	 =>0.02 57 => {a ->
46.81603022831159077063883068476609588578266257}	 	 =>0.02 58 => {a ->
47.75771342495763509450208885571770671671125665}	 	 =>0.02 59 => {a ->
48.70040358400260072900190742384529609883063835}	 	 =>0.02 60 => {a ->
49.64407218223302113922073719626658493336730253}	 	 =>0.02 61 => {a ->
50.58869195476961757163889078282579499347835578}	 	 =>0.02 62 => {a ->
51.53423682016260175938530799687076475757292288}	 	 =>0.02 63 => {a ->
52.48068181106617576341521226267052844897290635}	 	 =>0.02 64 => {a ->
53.42800300999576296148382048384509289540703778}	 	 =>0.02 65 => {a ->
54.37617748972266178040474185472612224118078909}	 	 =>0.02 66 => {a ->
55.32518325790600251430183951715487891376130688}	 	 =>0.02 67 => {a ->
56.27499920560188282692353146366538295390054702}	 	 =>0.02 68 => {a ->
57.2256050593250239787188599515294633369833764}	 	 =>0.02 69 => {a ->
58.17698133636979863690901005085616335793377158}	 	 =>0.02 70 => {a ->
59.12910930312552431632155976230210514941602378}	 	 =>0.02 71 => {a ->
60.08197093614591880922220275481802038903727504}	 	 =>0.02 72 => {a ->
61.03554888575494289475690955132373033268336351}	 	 =>0.02 73 => {a ->
61.98982644199122982213584568264700120311327096}	 	 =>0.02 74 => {a ->
62.94478750271119740156204591455890758352889217}	 	 =>0.02 75 => {a ->
63.90041654368699805872334665343947816121614115}	 	 =>0.02 76 => {a ->
64.85669859054989518396889757225850338589839626}	 	 =>0.02 77 => {a ->
65.81361919244264431199776413743523906477243245}	 	 =>0.02 78 => {a ->
66.77116439725616601854999717255770287167884551}	 	 =>0.02 79 => {a ->
67.72932072833636507181661098213531283295782464}	 	 =>0.02 80 => {a ->
68.68807516255650136490221773810330378669269160}	 	 =>
0.020000000000000000000000000000137731771358692 81 => {a ->
69.64741510965916166276449184679096402990938174}	 	 =>
0.020000000000000000000000000000109938517931037 82 => {a ->
70.60732839277971348707231997161133530982093199}	 	 =>
0.020000000000000000000000000000087840859975320 83 => {a ->
71.56780323007022854884015885403196208585175836}	 	 =>
0.020000000000000000000000000000070253716574014 84 => {a ->
72.52882821734931821753817255743802419188098516}	 	 =>
0.020000000000000000000000000000056242469129818 85 => {a ->
73.49039231170919420136838552576078072554609504}	 	 =>
0.020000000000000000000000000000045069073734371 86 => {a ->
74.45248481601661300785091790661726196675372224}	 	 =>
0.0200000000000000000000000000000361499592553 87 => {a ->
75.41509536424923536892039621873525411892280773}	 	 =>
0.02000000000000000000000000000002902346376945 88 => {a ->
76.37821390761337837466395037696057589978020225}	 	 =>
0.020000000000000000000000000000023323631021245 89 => {a ->
77.34183070139320019698172374859950680482495632}	 	 =>
0.020000000000000000000000000000018760552827764 90 => {a ->
78.30593629248507214466911457631579353648261697}	 	 =>
0.020000000000000000000000000000015104150119547 91 => {a ->
79.27052150757429356164043499814749295007366696}	 	 =>
0.020000000000000000000000000000012171462366533 92 => {a ->
80.23557744191442144871764586659316955711729020}	 	 =>
0.020000000000000000000000000000009816970382529 93 => {a ->
81.20109544867234524914750641022591254674345388}	 	 =>
0.020000000000000000000000000000007925026713139 94 => {a ->
82.16706712880486183782082736997374580447119418}	 	 =>
0.020000000000000000000000000000006403333118640 95 => {a ->
83.13348432143491780856830579778082596002823929}	 	 =>
0.020000000000000000000000000000005178331974117 96 => {a ->
84.10033909469790491423997837379242331261792524}	 	 =>
0.020000000000000000000000000000004191332737676 97 => {a ->
85.0676237370304373073068217244532518603137602}	 	 =>
0.02000000000000000000000000000000339534212090 98 => {a ->
86.03533074887592166676123716504568465903180477}	 	 =>
0.020000000000000000000000000000002752834680103 99 => {a ->
87.00345283478296746326738396851546394743957107}	 	 =>
0.020000000000000000000000000000002233777454701 100 => {a ->
87.97198289587428722637499826248570554139116947}	 	 =>
0.020000000000000000000000000000001814104046694 Dr. Wouter L. J.
MEEUSSEN
w.meeussen.vdmcc@vandemoortele.be
eu000949@pophost.eunet.be




  • Prev by Date: RE: graphics question
  • Next by Date: number theory
  • Prev by thread: Re: Solve for positive, real-valued solutions
  • Next by thread: Re: Solve for positive, real-valued solutions