检测到舍入错误,无法达到要求的公差(或默认值)。尝试在 SCILAB 中使用更大的公差
Round-off error detected, the requested tolerance (or default) cannot be achieved. Try using bigger tolerances in SCILAB
我正在使用集成命令,但 scilab 向我显示检测到的舍入错误并告诉我使用我不知道的高容差值。
a=4
b1=1
b2=3
N=6
v=-50
for n=1:N
h(n,n)=n^2+(v/a)*integrate('1-cos(2*n*%pi*(r/a))','r',b1,b2)
for m=n+1:N
h(m,n)=(v/a)*integrate('(cos((m-n)*%pi*(r/a))-cos((m+n)*%pi*(r/a)))','r',b1,b2)
h(n,m)=h(m,n)
end
end
[al,bl,R]=spec(h,s);
el=al./bl;
e=R;
[el,k]=gsort(el)
disp(h);
disp(el)
integrate
的默认绝对公差在某些情况下可能过于严格。下面我在脚本第 9 行 integrate
的最后一个参数中将其更改为 1e-13
,现在运行正常(我还添加了矩阵 s
的定义,我认为它是身份矩阵,就像在您之前的消息中一样):
a=4
b1=1
b2=3
N=6
v=-50
for n=1:N
h(n,n)=n^2+(v/a)*integrate('1-cos(2*n*%pi*(r/a))','r',b1,b2)
for m=n+1:N
h(m,n)=(v/a)*integrate('(cos((m-n)*%pi*(r/a))-cos((m+n)*%pi*(r/a)))','r',b1,b2,1e-13)
h(n,m)=h(m,n)
end
end
s=eye(N,N);
[al,bl,R]=spec(h,s);
el=al./bl;
e=R;
[el,k]=gsort(el)
disp(h);
disp(el)
我正在使用集成命令,但 scilab 向我显示检测到的舍入错误并告诉我使用我不知道的高容差值。
a=4
b1=1
b2=3
N=6
v=-50
for n=1:N
h(n,n)=n^2+(v/a)*integrate('1-cos(2*n*%pi*(r/a))','r',b1,b2)
for m=n+1:N
h(m,n)=(v/a)*integrate('(cos((m-n)*%pi*(r/a))-cos((m+n)*%pi*(r/a)))','r',b1,b2)
h(n,m)=h(m,n)
end
end
[al,bl,R]=spec(h,s);
el=al./bl;
e=R;
[el,k]=gsort(el)
disp(h);
disp(el)
integrate
的默认绝对公差在某些情况下可能过于严格。下面我在脚本第 9 行 integrate
的最后一个参数中将其更改为 1e-13
,现在运行正常(我还添加了矩阵 s
的定义,我认为它是身份矩阵,就像在您之前的消息中一样):
a=4
b1=1
b2=3
N=6
v=-50
for n=1:N
h(n,n)=n^2+(v/a)*integrate('1-cos(2*n*%pi*(r/a))','r',b1,b2)
for m=n+1:N
h(m,n)=(v/a)*integrate('(cos((m-n)*%pi*(r/a))-cos((m+n)*%pi*(r/a)))','r',b1,b2,1e-13)
h(n,m)=h(m,n)
end
end
s=eye(N,N);
[al,bl,R]=spec(h,s);
el=al./bl;
e=R;
[el,k]=gsort(el)
disp(h);
disp(el)