MathGroup Archive 2005

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

Search the Archive

Re: refer to the result of FindRoot[ ]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61558] Re: refer to the result of FindRoot[ ]
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sat, 22 Oct 2005 00:36:07 -0400 (EDT)
  • References: <dja24u$fg7$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

perimeterbow at gmail.com wrote:
> FindRoot[] returns result in this format {x->2.123}, how can I get rid
> of the x-> so I can use the number directly to automate calculation
> flow?
> Thanks.
> 
Hello,

x/.FindRoot[.....]

This works because FindRoot returns a list of transformation rules - 
which is just the thing for use in a replacement.

For example:

x/.FindRoot[Sin[x]\[Equal]Cos[x],{x,0}]

The thing to realise is that often you don't really want the value of x, 
but the value of some expression involving x - say f[x]. In that case, 
you can do the whole thing in one step:

f[x]/.FindRoot[Sin[x]\[Equal]Cos[x],{x,0}]

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: Warning from Piecewise
  • Next by Date: Re: refer to the result of FindRoot[ ]
  • Previous by thread: Re: refer to the result of FindRoot[ ]
  • Next by thread: Re: refer to the result of FindRoot[ ]