I am having a tough time formulating the right question but here goes.
I know that solving the pde as in here gives me an interpolating function. I understand that the interpolating function object is different from the interpolating polynomial.
So if I wanted to approximate the interpolating function through FourierSinSeries, I don't quite get how I might go about it.
I can't just do:
FourierSinSeries[InterpolatingFunction[{{0.,...},{0.,...},{0.,TMax}},<>],x,4]
I tried that it didn't quite give me a series expansion.
Edit:
Here's what I tried to do to get fourier coefficients describing my interpolating function.
Mathematica code:
Off[NDSolve::ibcinc];
k=0.0677;
{xMin,xMax}={-(\[Pi]/k),\[Pi]/k};
TMax=2500;
uSol[t_,x_]=u[t,x]/.NDSolve[{\!\(
\*SubscriptBox[\(\[PartialD]\), \(t\)]\(u[t, x]\)\)==-100 \!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\((
\*SuperscriptBox[\(u[t, x]\), \(3\)]\
\*SubscriptBox[\(\[PartialD]\), \(x, x, x\)]u[t, x])\)\)+1/3 \!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\((
\*SuperscriptBox[\(u[t, x]\), \(3\)]\
\*SubscriptBox[\(\[PartialD]\), \(x\)]u[t, x])\)\)-5 \!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\((
\*SuperscriptBox[\((
\*FractionBox[\(u[t, x]\), \(1 + u[t, x]\)])\), \(2\)]\
\*SubscriptBox[\(\[PartialD]\), \(x\)]u[t, x])\)\),u[0,x]==1-0.1 Cos[k x],
(*Piecewise Function for INITIAL CONDITION*)
(*u[0,x]== Piecewise[{{-0.1,-\[Pi]/k<= x<-\[Pi]/(10 k)},{ Cos[x],-\[Pi]/(10 k)<= x<= \[Pi]/(10 k)},{-0.1,\[Pi]/(10 k)<x<= \[Pi]/k}}],*)
(u^(0,1))[t,xMin]==0,
(u^(0,1))[t,xMax]==0,
(u^(0,3))[t,xMin]==0,
(u^(0,3))[t,xMax]==0
(*(u^(0,3))[t,xMin]==0,
(u^(0,3))[t,xMax]==0*)},
u,{t,0,TMax},{x,xMin,xMax},MaxStepSize->0.1,MaxSteps->100000,Method->{"BDF", "MaxDifferenceOrder"-> 5}][[1]]
Fourier series:
Since I now have uSol which, my fourier coeffs should be:
I1 = NIntegrate[uSol[0.1 TMax, x], {x, xMin, xMax}] (*I1 at time=0.1 TMax*)
a0 = (1/(2*xMin))*I1
an = NIntegrate[uSol[0.1 TMax, x] Cos[n \[Pi] x/xMax], {x, xMin, xMax}]
bn = NIntegrate[uSol[0.1 TMax, x] Sin[n \[Pi] x/xMax], {x, xMin, xMax}]
Using NIntegrate errors out with:
NIntegrate::inumr: The integrand Cos[0.0677 n x] <<1>>[250.,x] has evaluated to non-numerical values for all sampling points in the region with boundaries {{-46.4046,-46.3046}}. >>
However, using Integrate instead of NIntegrate gave me just the input as symbols.
Neither is the coefficient.
So what am I missing? There has to be a simpler way of figurijng out the fourier coeffs of an interpolating function. can I export data out of mathematica into .csv or some other format which is not dependent on mathematica to be interpreted?
NIntegrate[]). – J. M.'s missing motivation Aug 01 '12 at 14:27interpolating functionobject manually? And whyNIntegrate[]? – dearN Aug 01 '12 at 14:282 NIntegrate[f[t] Sin[n t], {t, 0, Pi}]/Pito generate your series coefficients, I meant. – J. M.'s missing motivation Aug 01 '12 at 14:31:P– dearN Aug 01 '12 at 16:25(u^(0,1))[t,xMin], maybe it'sDerivative[0,1][u][t,xMin]what you want? – Silvia Aug 02 '12 at 20:14NIntegratecan't integrate symbolic arguments. You haven't fixednso the integrand is not numerical; fixnto something and it should work. Unfortunately cut and pasting doesn't work for the reason @Silvia gave; if you fix that maybe we can help more easily. – acl Aug 02 '12 at 20:40fn = Interpolation[Table[{x, x^2}, {x, 0, 2 \[Pi], .1}]];and I try to calculate the nth coefficient of the fourier cos series asfn = Interpolation[Table[{x, x^2}, {x, 0, 2 \[Pi], .1}]];; it gives such and such an error; what am I doing wrong?" there's no need for theNDSolveetc – acl Aug 02 '12 at 21:20Derivative[0,1][u][t,xMin]display like(u^(0,1))[t,xMin]just for 2-D display in a notebook frontend, it has different underlying structure for interpretation. Refer to theInverseFunctionexample in this doc, please. Converting code toInputForm(Select the code, press ctrl+shift+i) before post it might be more convenient. – Silvia Aug 03 '12 at 08:52