I am unable to plot a function of two variables f(x,y).
Kindly, some one help me plot this function.
Mathematica file is attached here.
u[x_] := Exp[-4 (x - 1)^2]
?[x_] := Exp[-Integrate[u[y]/0.2, {y, 0, x}]]
f[x_, t_] := Integrate[(x - z)/t ?[z] Exp[-(x - z)^2/(0.4 t)], {z, -?, ?}]/
Integrate[?[z] Exp[-(x - z)^2/(0.4 t)], {z, -?, ?}]
Plot3D[f[x, t], {x, 1, 3}, {t, 1, 3}]
mthiel
(Marco Thiel)
November 21, 2015, 4:44pm
2
Hi,
this here appears to work:
u[x_] := Exp[-4 (x - 1)^2];
\[Phi][x_] := Evaluate@Exp[-Integrate[u[y]/0.2, {y, 0, x}]];
f[x_, t_] :=
NIntegrate[(x - z)/
t \[Phi][z] Exp[-(x - z)^2/(
0.4 t)], {z, -\[Infinity], \[Infinity]}]/
NIntegrate[\[Phi][z] Exp[-(x - z)^2/(
0.4 t)], {z, -\[Infinity], \[Infinity]}];
appears to work. Basically you have to use numerical integration instead of symbolic integration.
Plot3D[f[x, t], {x, 1, 3}, {t, 1, 3}]
Cheers,
Marco
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2015-11-21at16.43.21.png&userId=48754
fkampas
(Frank Kampas)
November 21, 2015, 5:00pm
3
I tried doing you code step by step. The integral in the numerator of the definition of f is taking a long time. Have you tried NIntegrate instead of Integrate?