Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Problem with NIntegrate' topicStudent Support Forum > General > "Problem with NIntegrate"

Next Comment >Help | Reply To Topic
Author Comment/Response
Gunnar
07/30/08 08:05am

Dear Mathematica specialists,
I have written a function to calculate the Poisson equation, namely a differential equation. It works well, and I can plot the result. The next step would be to integrate a function containing this result, and this does not work... can someone help me ? Hereafter I describe the problem in detail:
First I define

rho=1
chargetest[z_,s_]:=Which[z<=0,0,z>0 && z<=s, rho,z>s,0]

Then I define my function

plotPotential[fcharge_,rho_,epsilon_,s_,w_,h_,lg_,ld_]:=Module[
{resultat,poisson,potentiel,p1,p2},poisson=potentiel''[z]+fcharge[z,s]/epsilon==0;
resultat=potentiel[z]/.DSolve[{poisson,potentiel[-w]==0,potentiel[h]==0},{potentiel[z]},z];
p2=Plot[resultat,{z,lg,ld}
]

I can call it with

CalculatePotential[chargetest,1,1,10,1000,100,-100,100]

and it works, plotting the result.

My problem is that I now want to replace the Plot function above by

norma=NIntegrate[resultat*Exp[-(h-z)/20],{z,0,h}];
Print[norma]

... and I get an "integrand not numerical" error message. And this I do not understand: I can plot <resultat> but not calculate with it ??

Thanks very much in advance
Gunnar

URL: ,

Subject (listing for 'Problem with NIntegrate')
Author Date Posted
Problem with NIntegrate Gunnar 07/30/08 08:05am
Re: Problem with NIntegrate Xavier 07/31/08 00:21am
Re: Re: Problem with NIntegrate Gunnar 07/31/08 07:03am
Re: Problem with NIntegrate Xavier 07/31/08 12:28pm
Next Comment >Help | Reply To Topic