a***u 发帖数: 72 | 1 第一个例子,
定义吧:
functmp0[y_,t_]:=Block[{x},
NIntegrate[ g(x,y,t), {x,-Infinity,Infinity} ]/
NIntegrate[ h(x,y,t), {x,-Infinity,Infinity} ]
]
f[t_]:=Block[{y},
NIntegrate[functmp0[y,t],{y,-Infinity,Infinity}]
]
Plot[f[t],{t,tmin,tmax}];
NIntegrate[ NIntegrate[ x+y, {x,0,1} ], {y,0,1} ] 简单
NIntegrate[x+y,{x,0,1},{y,0,1}];
Solve[ x + NIntegrate[x+y,{y,0,1}] == 1, x ] 不好
定义:
functmp1[x_]:=Block[{y},
-1+x + NIntegrate[ x+y, { |
|
R******y 发帖数: 651 | 2 【 以下文字转载自 Physics 讨论区 】
发信人: RICIIkey (昵称太短!), 信区: Physics
标 题: mathematica 积分问题
发信站: BBS 未名空间站 (Sat Nov 8 18:53:40 2008)
f[x_, y_, z_] := x^2 + y^2 + z^2;
g[x_, y_] := NIntegrate[f[x, y, z], {z, 0, 1}]
NIntegrate[g[x, y]^2 + g[x, y]^(1/2), {x, 0, 1}, {y, 0, 1}]
出错信息是
NIntegrate::inum: Integrand f[x, y, z] is not numerical at {z} = {0.5`}
我只要NIntegrate 的结果,Integrate 是没问题的。 |
|
R******y 发帖数: 651 | 3 f[x_, y_, z_] := x^2 + y^2 + z^2;
g[x_, y_] := NIntegrate[f[x, y, z], {z, 0, 1}]
NIntegrate[g[x, y]^2 + g[x, y]^(1/2), {x, 0, 1}, {y, 0, 1}]
出错信息是
NIntegrate::inum: Integrand f[x, y, z] is not numerical at {z} = {0.5`}
我只要NIntegrate 的结果,Integrate 是没问题的。 |
|
x***u 发帖数: 6421 | 4 In[1]:= f[x_, y_, z_] := x^2 + y^2 + z^2;
g[x_, y_] := NIntegrate[f[x, y, z], {z, 0, 1}];
NIntegrate[g[x, y]^2 + g[x, y]^0.5, {x, 0, 1}, {y, 0, 1}]
During evaluation of In[1]:= NIntegrate::inumr: The integrand \
x^2+y^2+z^2 has evaluated to non-numerical values for all sampling \
points in the region with boundaries {{0,1}}. >>
During evaluation of In[1]:= NIntegrate::inumr: The integrand \
x^2+y^2+z^2 has evaluated to non-numerical values for all sampling \
points in the region with boundaries |
|
S*********g 发帖数: 5298 | 5 Use NIntegrate and put the NIntegrate of G in Hold |
|
|
q***t 发帖数: 3 | 7 列位大虾有用mathematica的吧?
请教一个问题。希望绘出一个曲线 f(t);其定义为一个积分:
\int g(x,y,t) dx
f(t) = \int ------------------ dy (1)
\int h(x,y,t) dx
g(x,y,t)和h(x,y,t)都是给定的函数。里外的三个积分限都是
(-Infinity,Infinity),一般是没有解析表达的。如果用
Integrate[ g(x,y,t), x ]
f(t) = NIntegrate[ --------------------------, y ] (2)
Integrate[ h(x,y,t), x ]
计算就太慢了。原因是 mathematica 试图简化 Integrate[ g(x,y,t), x ] 未果。
可是改成数值积分:
|
|
S*********g 发帖数: 5298 | 8 No, that's not what he wanted.
Because in the real life problem, it could be impossible
for Mathematica to do an Integrate for the given f and g
The solution is:
NIntegrate[Hold[g[x,y]^2+Sqrt[g[x,y] ] ],{x,0,1},{y,0,1}] |
|
dm 发帖数: 92 | 9 There seems to be a convention change since v6?
f[x_?NumberQ, y_?NumberQ, z_?NumberQ] := x^2 + y^2 + z^2;
g[x_?NumberQ, y_?NumberQ] := NIntegrate[f[x, y, z], {z, 0, 1}] |
|
R******y 发帖数: 651 | 10 比如求f[x,y]=x^2+y^3, x [-1,1], y 是[0,x]
NIntegrate[f[x,y],{y,0,x},{x,-1,1}] 就不行。 |
|
S*********g 发帖数: 5298 | 11 NIntegrate[f[x,y],{x,-1,1},{y,0,x}] |
|
S*********g 发帖数: 5298 | 12 Hold[NIntegrate[g[x],{x,0,b}]] |
|