Re: A problem with NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg119189] Re: A problem with NIntegrate
- From: Alexei Boulbitch <alexei.boulbitch at iee.lu>
- Date: Tue, 24 May 2011 05:58:48 -0400 (EDT)
Dear Anna, The imaginary part like here: NIntegrate[((1 - (u/40)^2.5)*((1/((1 + 0.06*(u - t)))))/ Exp[0.01*u*(1.5 - 1)])^(1/1.5), {u, t, 40}] /. t -> 0 NIntegrate::nlim: u = t is not a valid limit of integration.>> 19.7871 + 8.43907*10^-28 I is the machine error. You should simply skip it. This can be easily done by the function Chop. Try this: tab = Table[{t, NIntegrate[((1 - (u/40)^2.5)*((1/((1 + 0.06*(u - t)))))/ Exp[0.01*u*(1.5 - 1)])^(1/1.5), {u, t, 40}]}, {t, 0, 40, 1}] // Chop {{0, 19.7871}, {1, 19.2601}, {2, 18.7278}, {3, 18.1903}, {4, 17.6475}, {5, 17.0997}, {6, 16.5472}, {7, 15.99}, {8, 15.4286}, {9, 14.8633}, {10, 14.2945}, {11, 13.7225}, {12, 13.1479}, {13, 12.5712}, {14, 11.993}, {15, 11.4137}, {16, 10.8341}, {17, 10.2548}, {18, 9.6765}, {19, 9.1001}, {20, 8.52637}, {21, 7.95624}, {22, 7.39067}, {23, 6.83071}, {24, 6.27749}, {25, 5.73225}, {26, 5.19632}, {27, 4.67117}, {28, 4.15839}, {29, 3.65976}, {30, 3.17726}, {31, 2.71308}, {32, 2.26972}, {33, 1.85006}, {34, 1.45742}, {35, 1.09575}, {36, 0.769879}, {37, 0.485919}, {38, 0.252122}, {39, 0.0810213}, {40, 0}} Then you get a nice smooth dependence of your integral upon t that could be easily approximated analytically, if needed. Play with this: lstPl = ListPlot[tab, PlotStyle -> Red]; ft = Fit[tab, {1, t, t^2, t^3}, t] plFt = Plot[ft, {t, 0, 40}]; Show[{lstPl, plFt}] Have fun, Alexei Hi all, I need to numerically integrate a function by utilizing =93Table=94 commandin the process (please see the code below), but for the parameter values I am interested in, I get complex results. I do not know why this is happening. Also, how do I get "normal" real values instead, and also ensuring that the answer is reasonably correct which one would expect from NIntegrate command. Thanks a lot. Table[NIntegrate[((1-(u/40)^2.5)*((1/((1+0.06*(u-t)))))/Exp[0.01*u*(1.5-1)])^(1/1.5),{u,t,40}],{t,0,40,1}] -- Alexei Boulbitch, Dr. habil. Senior Scientist Material Development IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 CONTERN Luxembourg Tel: +352 2454 2566 Fax: +352 2454 3566 Mobile: +49 (0) 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu 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.