I have defined function myfun as: function f=myfun(x) if x>1 f=1./(x.*x); else f=4./sqrt(x); end end
This function is continuous and has continuous first derivative. When I run
As expected. However, when I enter >> integral(@myfun,0,inf)
Which is surprising!!!!