Re: Operations on InterpolatingFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg100889] Re: Operations on InterpolatingFunction
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Wed, 17 Jun 2009 04:45:13 -0400 (EDT)
Hi, Solving a simple differential equation: ifun = First[ u /. NDSolve[{u''[t] + u[t] == 0, u[0] == 0, u'[0] == 1}, u, {t, 0, \[Pi]}]] returns the InterpolationFunction object, as expected. I can integrate this function (and obtain another InterpolatingFunction to be plotted, etc.) by: Integrate[ifun[t], t] 1. Why doesn't the following produce an InterpolatingFunction in the same way? Integrate[ifun[t]^2, t] 2. How can I normalize the solutions found using NDSolve? Norm[ifunt[t]] doesn't work... Thanks for any help. Dear Porsha, It seems that the built-in function Norm does not apply to integrals, does it? Why not to define a norm that you need. Say, you need the Hilbert norm on your interval {0,Pi}: ifun = First[ u /. NDSolve[{u''[t] + u[t] == 0, u[0] == 0, u'[0] == 1}, u, {t, 0, \[Pi]}]]; f=Function[x,ifun[x]]; In[43]:= a = NIntegrate[f[x]^2, {x, 0, Pi}]; (* This is the square of the norm *) fn[x_] := f[x]/Sqrt[a]; (* This is the normalized function *) NIntegrate[fn[x]^2, {x, 0, Pi}] (* this is control *) Out[45]= 1. Have fun and success, Alexei -- Alexei Boulbitch, Dr., habil. Senior Scientist IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 Contern Luxembourg Phone: +352 2454 2566 Fax: +352 2454 3566 Website: www.iee.lu This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.