Re: Using FindRoot or interpolation function with symbolic argument
- To: mathgroup at smc.vnet.net
- Subject: [mg92193] Re: Using FindRoot or interpolation function with symbolic argument
- From: dh <dh at metrohm.ch>
- Date: Mon, 22 Sep 2008 07:23:52 -0400 (EDT)
- References: <gb7ob8$nfp$1@smc.vnet.net>
Hi, if you do not compile f, your problem disappears. E.g.: f[y_?NumericQ] := (x /. FindRoot[ArcTanh[x] == y x, {x, 99/100}]) hope this helps, Daniel exoptery at gmail.com wrote: > I'd like to use NDSolve to integrate a pair of ODEs. Expressing > the system as a set of explicit equations, however, requires the > inverse of ArcTanh[x] / x. I thought I'd define a function for this > as follows: > > > f = Compile[{{y, _Real}}, x /. FindRoot[ArcTanh[x] == y x, {x, > 99/100}]]; > > > However, when I set, say, > > > eqn1 = u'[R] == u[R] f[(u[R] (1 + v[R])^2)/(1 + v[R]^2)] > > > Mathematica clearly dislikes the use of symbols instead of a numerical > argument. > > > Is there a way to define an NDSolve-digestible equation that > calls FindRoot with symbolic arguments? > > Thank you for your attention. > > J. > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail:<mailto:dh at metrohm.com> Internet:<http://www.metrohm.com>