Tag Info

New answers tagged

3

I'd recommend using NDSolve instead of FunctionInterpolation, as recommended to me by some the of the Wolfram folks. pf[t_?NumericQ] := {Cos[t], Sin[t]}; pi = NDSolveValue[{y[t] == pf[t], y[0] == pf[0], s'[t] == 1, s[0] == 0}, y, {t, 0., 2. Pi}]; pi[2] (* {-0.416147, 0.909297} *) If pf is differentiable, then perhaps this: pi = NDSolveValue[{y'[t] == ...


2

Kinda kludgy, but: g[x_] = Through[(FunctionInterpolation[#, {t, 0., 2. Pi}] & /@ {Cos[t], Sin[t]})[x]] It works: g[2.0] (*{-0.416147, 0.909297}*) I'd be interested to see if there was a better way. I'm also surprised your original code doesn't work (although I may just be speaking out of ignorance here).


5

Interpolation and Approximation If you would like to have a functional model approximating instead of interpolating your data, you can use (besides others) Fit: data=gasprices[[1,2;;]]/.{y_,v_}->{Round@y,v}; approx=Fit[data,{1,x,x^2,x^3},x]; (* simple cubic fit *) interp=Interpolation[data]; (* cubic interpolation *) ...


4

You can just use the Interpolation Function: gasprices={{{"Year", "EUR05/GJ"}, {2000., 14.4041}, {2005., 22.8756}, {2010., 29.1499}, {2015., 29.4374}, {2020., 30.3778}, {2025., 33.2288}, {2030., 35.099}, {2040., 36.8245}, {2050., 38.2697}}}; iFunct = Interpolation[gasprices[[1, 2 ;; All]]]; This creates a function iFunct[]. You can get the interpolated ...



Top 50 recent answers are included