Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

nintegrate vs nintegrateinterpolatingfunction vs integrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55570] nintegrate vs nintegrateinterpolatingfunction vs integrate
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Wed, 30 Mar 2005 03:21:02 -0500 (EST)
  • Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Dear MathGroup,

I'm trying to get distance versus time functions from lists of time
and velocity data. I've done this before, but with the data sets I am
using now, I keep running into complex number errors. The only working
implementation I found is to use nintegrate (& functioninterpolation),
but it is much slower than nintegrateinterpolatingfunction or
integrate (& functioninterpolation), at least for working on
interpolated data:

My data sets (errors "work" with either; I use both below):
http://www.epa.gov/otaq/emisslab/methods/uddscol.txt
&
http://www.epa.gov/otaq/emisslab/methods/hwycol.txt

What do you think is causing the problem? Do you have any solutions or
workarounds?

BTW, I multiplied the mph by 1397/3125 after I imported the data (mph
to meters per second).

Thank you for your valuable time,

some working example code:

nbname=ToFileName["FileName"/.NotebookInformation[EvaluationNotebook[]]];
nbdir=DirectoryName[nbname];
englishtracedata=
    MapThread[
      Partition[
          Drop[Import[ToFileName[nbdir,#1],"List"],#2],{2}]&,{{"uddscol.txt",
          "hwycol.txt"},{11,11}}];
tracedata=Apply[{#1,1397 #2/3125}&,englishtracedata,{2}];
tracedatafuncs=Interpolation/@tracedata;
outerlimits=Map[{Min@#,Max@#}&,Transpose/@tracedata,{2}];
MapThread[
  Plot[#1[x],Evaluate[{x,Sequence@@#2[[1]]}]]&,{tracedatafuncs,
    outerlimits}];(*I wonder why the Evaluate is required and*how*
    it actually solves the problem???*)distancefuncs=
  MapThread[
    Block[{t,arbittime,dist},
        dist[arbittime_?NumericQ]:=NIntegrate[#1[t],{t,0,arbittime}];
        FunctionInterpolation[
          dist[t],{t,Evaluate[Sequence@@#2[[1]]]}]]&,{tracedatafuncs,
      outerlimits}]
MapThread[
    Plot[#1[x],Evaluate[{x,Sequence@@#2[[1]]}]]&,{distancefuncs,outerlimits}];


-- 
Chris Chiasson
Kettering University
Mechanical Engineering
Graduate Student
1 810 265 3161


  • Prev by Date: Re: Unicode Support
  • Next by Date: Mathematica hangs when solving sys. of equations w/ certain parameters
  • Previous by thread: Re : intersection point from listplots
  • Next by thread: Re: nintegrate vs nintegrateinterpolatingfunction vs integrate