December 28th, 2015, 4:58 pm
Don't know Matlab, but in Mathematica, it's poor practice to write (0,b) as an integration range for large b. Instead, oneshould always write (0,1,b), forcing the integrator to sample a point where the integrand is O(1). This will cure some errors in that system anyway. In Mathematica, with xmax = 10^nTable[{n,NIntegrate[result[x],{x,0,1,10^n}]},{n,1,14}]1 0.0482362 0.1151233 0.1649364 0.1821845 0.1876396 0.1893657 0.189918 0.1900839 0.19013710 0.19015411 0.1901612 0.19016213 0.19016214 0.190162so apparently you need [$]x_{max} > 10^{12}[$] for 6 good digits.This is not surprising, as the same would be true of [$]\int_1^{x_{max}} x^{-3/2} \, dx[$]. A simpler approach in Mathematica is to use the keyword Infinity as the integration limit, which prompts the use of a suitable transformation method:NIntegrate[result[x],{x,0,1,Infinity}]0.190162 I will guess Matlab offers something similar.
Last edited by
Alan on December 27th, 2015, 11:00 pm, edited 1 time in total.