MathGroup Archive 2014

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

Search the Archive

Using FindRoot with free parameters

  • To: mathgroup at
  • Subject: [mg132565] Using FindRoot with free parameters
  • From: steviep2 <ssplotkin at>
  • Date: Sat, 12 Apr 2014 05:15:39 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

I want to define a function of 2 parameters that uses FindRoot. I.e. I have a known but complicated function f[n_,x_] = "complicated function of (n,x)". I want to find the value of x where f[n,x] == alpha, and I want to call this a function xf[alpha_,n_].

So my attempts (this is non-working code) looks something like this: 

xf[alpha_, n_] =  Function[{x}, x /. FindRoot[f[n,x] - alpha, {x, 2}]]

xf[alpha_, n_] =  Function[x /. FindRoot[f[n, x] - alpha, {x, 2}]][alpha, n]

It seems this is a pretty simple question-- basically using FindRoot but holding off on substituting in the parameters until later. Is there a simple solution?


  • Prev by Date: Variable section and hollow Tubes for economic 3D printing
  • Next by Date: Re: checking the sign of all terms in a long expression
  • Previous by thread: Re: List vs. array in Mathematica
  • Next by thread: Re: Using FindRoot with free parameters