Re: FindRoot anomaly (example from Mathematica Tutorial)
- To: mathgroup at smc.vnet.net
- Subject: [mg72201] Re: [mg72118] FindRoot anomaly (example from Mathematica Tutorial)
- From: gardyloo <gardyloo at mail.wsu.edu>
- Date: Thu, 14 Dec 2006 05:49:25 -0500 (EST)
- References: <200612131138.GAA23570@smc.vnet.net>
And yet the solutions you get from that FindRoot are mostly incorrect. Apparently, the default method that FindRoot is using gets hung up when Cos[x] is approximately +/- 1 (after all, the Newton's method is expected to go wonky at these particular points). So, for example, the "root" x->56.542772508541205` (just to pick one at random) does NOT satisfy the original equation. Ersek's RootSearch function finds only seven roots to the equation between x = 1 and x = 100: sol = RootSearch[3*Cos[x] == Log[x], {x, 1, 100}] {{x -> 1.447258617277903}, {x -> 5.301987341712279}, {x -> 7.13951454299577}, {x -> 11.970165552607465}, {x -> 13.10638768062491}, {x -> 18.624716143898215}, {x -> 19.0387370100137}} Possibly ( I haven't tried it) forcing FindRoot to use the secant method by supplying different starting conditions might make for a more stringent search. Regards, C.O. howardfink at gmail.com wrote: > FindRoot[3Cos[x] == Log[x], {x, 1}] is on page 12 of the tutorial that > starts up in Mathematica 5. > I was interested in how the seed affects the answer, so I made a table > > sol = Table[FindRoot[3Cos[x] == Log[x], {x, b}], {b, 100}]; > > and then plotted the solutions > > ListPlot[x /. sol] > > I got a nice table, but the seed of 22 returns {x -> -207.932 + > 1.39227 i]} > > so the plot returns the error: > Graphics::gptn: Coordinate -207.932 + 1.39227\\[ImaginaryI] in {22, > -207.932 \ > + 1.39227\\[ImaginaryI]} is not a floating-point number. > > The other 99 results make a nice plot. > > > -- ========================================================== Curtis Osterhoudt gardyloo at mail.remove_this.wsu.and_this.edu PGP Key ID: 0x088E6D7A Please avoid sending me Word or PowerPoint attachments See http://www.gnu.org/philosophy/no-word-attachments.html ========================================================== --------------000801010502040909070705 Content-Type: text/x-vcard; charset="utf-8"; name="gardyloo.vcf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="gardyloo.vcf" X-Sun-Content-Length: 296 YmVnaW46dmNhcmQNCmZuOkN1cnRpcyAgT3N0ZXJob3VkdA0KbjpPc3RlcmhvdWR0O0N1cnRp cyANCmVtYWlsO2ludGVybmV0OmdhcmR5bG9vQG1haWwucmVtb3ZlX3RoaXMud3N1LmFuZF90 aGlzLmVkdQ0KdGVsO3dvcms6NTA5LjMzNS40OTQ2DQpub3RlOlBHUCBLZXkgSUQ6IDB4MDg4 RTZEN0ENCngtbW96aWxsYS1odG1sOkZBTFNFDQp2ZXJzaW9uOjIuMQ0KZW5kOnZjYXJkDQoN Cg== --------------000801010502040909070705--
- Follow-Ups:
- Re: Re: FindRoot anomaly (example from Mathematica
- From: Carl Woll <carlw@wolfram.com>
- Re: Re: FindRoot anomaly (example from Mathematica
- References:
- FindRoot anomaly (example from Mathematica Tutorial)
- From: howardfink@gmail.com
- FindRoot anomaly (example from Mathematica Tutorial)