Re: question about NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg124983] Re: question about NIntegrate
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Thu, 16 Feb 2012 03:26:01 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Hi, I want to use function NIntegrate to integrate a function of x that depends on two parameters y and z. However, when I write something of the kind: y=10; z=1; NIntegrate[Exp[-(x-y)/z],{x,0,Infinity}] I get an error: Integrand is not numerical at {x} = {1.} Strangely, if my function has only one parameter, the following code works fine: y=10; NIntegrate[Exp[-(x-y)],{x,0,Infinity}] giving the result 22026.5 What am I doing wrong? Leslaw Hi, Leslaw, Your code worked for me: y=10; z=1; NIntegrate[Exp[-(x-y)/z],{x,0,Infinity}] 22026.5 inT[y_,z_]:=NIntegrate[Exp[-(x-y)/z],{x,0,Infinity}]; inT[10,1] 22026.5 NIntegrate[Exp[-(x-y)/z],{x,0,Infinity}]/.{y->10,z->1} 22026.5 You may have typed something wrong, or some invisible sign. Just retype your function once more. Have fun, Alexei Alexei BOULBITCH, Dr., habil. IEE S.A. ZAE Weiergewan, 11, rue Edmond Reuter, L-5326 Contern, LUXEMBOURG Office phone : +352-2454-2566 Office fax: +352-2454-3566 mobile phone: +49 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu<mailto:alexei.boulbitch at iee.lu>