MathGroup Archive 1999

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

Search the Archive

Re: Solve transcendental functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21192] Re: Solve transcendental functions
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Fri, 17 Dec 1999 01:24:02 -0500 (EST)
  • Organization: Wolfram Research, Inc.
  • References: <831v41$g3d@smc.vnet.net> <385558EC.CD39697C@wolfram.com> <Pine.LNX.4.10.9912142010060.20201-100000@carmen.imada.sdu.dk>
  • Sender: owner-wri-mathgroup at wolfram.com

Niels Sandmann Pedersen wrote:
> 
> > You can find solutions for particular values of a, provided you supply a
> > starting point for a Newton-type iteration.
> >
> > f[x_,a_] := x^2-2Cos[a*x]/a
> > parametrizedSolve[f_, a_?NumberQ, init_] :=
> >       FindRoot[Evaluate[f[x,a]==D[f[x,a],x]], {x,init},
> >       AccuracyGoal->15, WorkingPrecision->20]
> >
> > For example, if I want to handle the case where a is 1, starting near
> > x=2, I can do as below.
> >
> > In[110]:= parametrizedSolve[f, 1, 2]
> > Out[110]= {x -> 2.1999981850434100730}
> >
> thanks, it works very well. But what if I need all the solutions in an
> interval, or maybe all solutions (if not infinite) ?
> 
> --
> Mvh, Niels Sandmann

It is not clear how you might obtain a continuum of solutions. For
example, how would you represent such a set? What I suspect you want is
a reasonable way to grab a specific solution x, given a specific value
of a (for example, say to plot x vs a). Generating solutions "on the
fly" with FindRoot may not be the best way to get this. In that case,
I'd suggest generating several for different values of a in some
interval, and then using an Interpolation to approximately reconstruct
those in between. This will then give fast evaluation of x as a function
of a. Below is code to do this for a in the interval {.1,2}. 

f[x_,a_] := x^2-2*Cos[a*x]/a
parametrizedSolve[f_, a_?NumberQ, init_] :=
	x /. FindRoot[Evaluate[f[x,a]==D[f[x,a],x]], {x,init},
	AccuracyGoal->15, WorkingPrecision->20]
data = Table[{a,parametrizedSolve[f,a,1]}, {a,1/10,2,1/10}];
func = Interpolation[data]

To see visually what we have, you might compare

Plot[func[a], {a,.1,2}]

vs

ListPlot[data]

Note that your in general your function may be multivalued, and giving
different starting values may generate different branches. Moreover,
some caution is needed because the values generated by FindRoot may
cause the interpolated function to cross branches In this case you'd
likely notice a cusp in the plot or something to that effect.


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Re: modified list interval calculation
  • Next by Date: Re: Help with Matrices in Mathematica
  • Previous by thread: Re: Solve transcendental functions
  • Next by thread: A Bitmap file as input for Mathematica 3.0