Re: Find many Roots
- To: mathgroup at smc.vnet.net
- Subject: [mg32103] Re: Find many Roots
- From: Tom Burton <tburton at cts.com>
- Date: Mon, 24 Dec 2001 23:44:34 -0500 (EST)
- References: <a06p90$fb1$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
On Mon, 24 Dec 2001 08:33:36 +0000 (UTC), in comp.soft-sys.math.mathematica you wrote:
>Tan[x]==1/x, {x,0,12}]
For this particular problem, I would select:
Step 1: Find the approximate roots visually:
p1 = Plot[Tan[x]-1/x, {x,0,12}, PlotRange -> {-1,1}];
approx = {1, 3, 6, 10};
Step 2: Refine these approximations:
answers = FindRoot[Tan[x] == 1/x, {x,#}] & /@ approx
Step 3: Verify solutions
(Tan[x] - 1/x) /. answers
Step 4: Check for missing solutions
Show[ p1, Graphics[{Hue[0], PointSize[0.03], Point[{x,0}] /. answers}] ]
I higly recommend a visual method, but iff you need a more automated method, I would suggest something like
answers = FindRoot[Tan[x] == 1/x, {x,#}] & /@ Range[1,12]
xx = Select[
Union[ x /. answers, SameTest -> (Abs[#1-#2]<10^-6 &) ],
0 <= # <= 12 &]
Tom Burton