Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: envelope of an oscillatory InterpolatingFunction

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49826] Re: envelope of an oscillatory InterpolatingFunction
  • From: "Stergios J. Papadakis" <stergios.papadakis at jhuapl.edu>
  • Date: Tue, 3 Aug 2004 01:10:58 -0400 (EDT)
  • Organization: Johns Hopkins University Applied Physics Lab, Laurel, MD, USA
  • References: <cefh67$bs5$1@smc.vnet.net> <cejske$crk$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Paul Abbott wrote:

> 
>    Needs["Utilities`FilterOptions`"]
> 
>    RootsInRange[fn_, {x_, xmin_, xmax_}, opts___] :=   
>       Module[{p, pts, x, f = Function[x, Evaluate[fn]]},
>       p = Plot[f[x], {x, xmin, xmax}, Compiled -> False,
>          Evaluate[FilterOptions[Plot, opts]]]; 
>       pts = Cases[First[p], Line[{x__}] -> x, Infinity]; 
>       pts = Map[First, Select[Split[pts, 
>          Sign[Last[#2]]==-Sign[Last[#1]]&],Length[#1]==2& ],{2}]; 
>       (FindRoot[f[x] == 0, {x, Sequence @@ ##1}, 
>          Evaluate[FilterOptions[ FindRoot, opts]]]&) /@ pts]
> 
> Compute the (absolute) values of the extrema of the 
> InterpolatingFunction:
> 
>  {x, Abs[y[x]]} /. RootsInRange[Evaluate[y'[x] /. nsol],{x,0,50}] /. nsol
> 


Thanks very much!  Your RootsInRange is much better than my loop
using NMaximize.  I do have one final detail to ask about.
RootsInRange returns results of the form (where t is my
variable):

{t$9472 -> 3.3268729370875564`*^-7}

Is there a good way to get rid of the $9472, which seems to
be some sort of counter.  I admit I don't understand the last
bit of the RootsInRange function.  Right now I am manually
getting rid of the $9472 by typing it in.

ti = t$9472
optenv = {ti, Last[Abs[opticalz[ti]]]} /. optenvroots,

where optenvroots is the result from RootsInRange.


Thanks again,
Stergios



  • Prev by Date: Re: Using "Sum" (i = 1 ... N) in a function definition
  • Next by Date: Re: ListDensityPlot, ColorFunction, and associated confusions
  • Previous by thread: Re: envelope of an oscillatory InterpolatingFunction
  • Next by thread: Re: envelope of an oscillatory InterpolatingFunction