| 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: , |
|